Description
The WithRoll
method of the Angles
struct allows you to create a new Angles
instance with a specified roll value, while keeping the existing pitch and yaw values unchanged. This method is useful when you need to adjust the roll component of an angle without affecting the other components.
Usage
To use the WithRoll
method, call it on an existing Angles
instance and pass the desired roll value as a float
. The method returns a new Angles
instance with the updated roll value.
Example
// Example of using the WithRoll method
Angles currentAngles = new Angles(30.0f, 45.0f, 10.0f);
// Create a new Angles instance with a different roll value
Angles newAngles = currentAngles.WithRoll(20.0f);
// Output the new angles
// newAngles will have pitch = 30.0f, yaw = 45.0f, roll = 20.0f