Rotation LocalRotation { get; set; }

robot_2Generated
code_blocksInput

Description

The LocalRotation property represents the local rotation of the game object to which this component is attached. It is expressed as a Rotation type, which defines the orientation of the game object in its local space, relative to its parent.

Usage

Use the LocalRotation property to get or set the local rotation of a game object. This is useful when you need to manipulate the orientation of a game object independently of its parent's rotation.

Example

// Example of setting the local rotation of a component
Component myComponent = someGameObject.GetComponent<Component>();
myComponent.LocalRotation = Rotation.FromAxis(Vector3.Up, 45.0f); // Rotates the object 45 degrees around the up axis

// Example of getting the local rotation of a component
Rotation currentRotation = myComponent.LocalRotation;
Vector3 eulerAngles = currentRotation.Angles();

// Output the current local rotation in Euler angles
DebugOverlay.Text(0, $"Local Rotation: {eulerAngles}", myComponent.GameObject.Position);