The Scale
property of the BoxCollider
class represents the size of the box collider, measured from corner to corner. This property is of type Vector3
, allowing you to specify the width, height, and depth of the box in 3D space.
The Scale
property of the BoxCollider
class represents the size of the box collider, measured from corner to corner. This property is of type Vector3
, allowing you to specify the width, height, and depth of the box in 3D space.
To use the Scale
property, you can directly get or set its value on an instance of BoxCollider
. This property is useful for defining the dimensions of the box collider in your scene, which affects how it interacts with other colliders and physics objects.
// Example of setting the Scale property of a BoxCollider BoxCollider boxCollider = new BoxCollider(); boxCollider.Scale = new Vector3(2.0f, 3.0f, 1.5f); // Accessing the Scale property Vector3 currentScale = boxCollider.Scale; // Output the current scale // Note: Use a logging method appropriate for your environment // e.g., Log.Info(currentScale.ToString());