Description
The CreateRotationY
method generates a rotation matrix that rotates around the Y-axis by a specified angle in degrees. This method is useful for 3D transformations where you need to apply a rotation to an object around the Y-axis, which is typically considered the vertical axis in a 3D space.
Usage
To use the CreateRotationY
method, call it with a single parameter representing the angle in degrees by which you want to rotate around the Y-axis. The method returns a Matrix
object representing the rotation transformation.
Example
// Example of using CreateRotationY to rotate an object by 45 degrees around the Y-axis
float angleInDegrees = 45.0f;
Matrix rotationMatrix = Matrix.CreateRotationY(angleInDegrees);
// Use the rotationMatrix to transform a vector or apply to an object's transformation
Vector3 originalVector = new Vector3(1, 0, 0);
Vector3 rotatedVector = rotationMatrix.Transform(originalVector);
// rotatedVector now contains the coordinates of the original vector after rotation