The Matrix.CreateRotation
method creates a rotation matrix from a given Rotation
object. This method is useful for transforming objects in 3D space by applying a rotation defined by the Rotation
parameter.
The Matrix.CreateRotation
method creates a rotation matrix from a given Rotation
object. This method is useful for transforming objects in 3D space by applying a rotation defined by the Rotation
parameter.
To use the CreateRotation
method, pass a Rotation
object that defines the desired rotation. The method will return a Matrix
that represents this rotation, which can then be used to transform other matrices or vectors.
// Example of using Matrix.CreateRotation Rotation rotation = new Rotation(0, 90, 0); // Define a rotation of 90 degrees around the Y-axis Matrix rotationMatrix = Matrix.CreateRotation(rotation); // Use the rotation matrix to transform a vector Vector3 originalVector = new Vector3(1, 0, 0); Vector3 transformedVector = rotationMatrix.Transform(originalVector); // transformedVector should now be (0, 0, -1) after the rotation