Rotation WorldRotation { get; set; }

robot_2Generated
code_blocksInput

Description

The WorldRotation property of a GameObject represents the rotation of the object in world space. This property provides the orientation of the object relative to the global coordinate system, rather than its local coordinate system or its parent object.

Usage

Use the WorldRotation property to get or set the rotation of a GameObject in world space. This is useful when you need to align the object with a specific direction in the scene or when you want to apply a rotation that is independent of the object's parent.

Example

// Example of setting the world rotation of a GameObject
GameObject myObject = new GameObject();
myObject.WorldRotation = Rotation.FromAxis(Vector3.Up, 90); // Rotates the object 90 degrees around the up axis

// Example of getting the world rotation of a GameObject
Rotation currentRotation = myObject.WorldRotation;
Console.WriteLine($"Current World Rotation: {currentRotation}");