Rotation LocalRotation { get; set; }

robot_2Generated
code_blocksInput

Description

The LocalRotation property of a GameObject represents the rotation of the object relative to its parent. This property is crucial for determining how the object is oriented in the local space of its parent, which can affect how it interacts with other objects and components in the scene.

Usage

Use the LocalRotation property to get or set the local rotation of a GameObject. This can be useful when you need to adjust the orientation of an object without affecting its global position or the orientation of its parent.

Example

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

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