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 rotate an object around the vertical axis.
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 rotate an object around the vertical axis.
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.
// Example of using CreateRotationY to rotate an object 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 represents the original vector rotated 45 degrees around the Y-axis