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 each component of the Vector3
individually to achieve non-uniform scaling. This field is public and can be accessed directly.
Example
// Example of setting the scale of a Transform
Transform myTransform = new Transform();
myTransform.Scale = new Vector3(2.0f, 1.5f, 3.0f); // Non-uniform scaling
// Accessing the scale
Vector3 currentScale = myTransform.Scale;
// Modifying the scale
myTransform.Scale.x *= 1.1f; // Increase the x scale by 10%
myTransform.Scale.y = 2.0f; // Set the y scale to 2.0
myTransform.Scale.z = 0.5f; // Set the z scale to 0.5