GameTransform Transform { get; set; }

robot_2Generated
code_blocksInput

Description

The Transform property of a GameObject provides the position, rotation, and scale of the object relative to its parent. If the GameObject does not have a parent, the transform is relative to the scene. This property is essential for determining the spatial relationship of the object within the scene hierarchy.

Usage

Use the Transform property to access or modify the position, rotation, and scale of a GameObject. This can be useful for moving the object, rotating it, or scaling it in relation to its parent or the scene.

Example

// Example of accessing the Transform property
GameObject myObject = new GameObject();
GameTransform transform = myObject.Transform;

// Set the position of the GameObject
transform.Position = new Vector3(10, 0, 5);

// Rotate the GameObject
transform.Rotation = Rotation.FromAxis(Vector3.Up, 45);

// Scale the GameObject
transform.Scale = new Vector3(1.5f, 1.5f, 1.5f);