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

To access or modify the local rotation of a GameObject, you can use the LocalRotation property. This property is of type Rotation, which allows you to set or get the rotation in terms of angles or quaternions.

For example, to set the local rotation of a GameObject to a specific angle, you can do the following:

Example

// Assuming 'gameObject' is an instance of GameObject

// Set the local rotation to a specific angle
Rotation newRotation = Rotation.FromAxis(Vector3.Up, 45.0f); // 45 degrees around the Up axis
gameObject.LocalRotation = newRotation;

// Get the current local rotation
Rotation currentRotation = gameObject.LocalRotation;