Vector3 Scale

book_4_sparkGenerated
code_blocksInput

Description

The Scale field of the Transform struct represents the scale component of a transform in 3D space. It is a Vector3 type, allowing for non-uniform scaling along the x, y, and z axes. This field does not directly affect the Position or Rotation fields of the Transform.

Usage

Use the Scale field to adjust the size of an object in 3D space. You can set it to a Vector3 value to specify different scaling factors for each axis. This is useful for stretching or compressing objects along specific directions.

Example

// Example of setting the Scale field of a Transform
Transform myTransform = new Transform();
myTransform.Scale = new Vector3(2.0f, 1.0f, 0.5f); // Scale x by 2, y by 1, z by 0.5

// Accessing the Scale field
Vector3 currentScale = myTransform.Scale;

// Modifying the Scale field
myTransform.Scale = new Vector3(currentScale.x * 1.5f, currentScale.y, currentScale.z);