The Transform.Add
method allows you to add a position offset to the current transform. This method modifies the transform's position by adding the specified vector, either in local or world space, depending on the worldSpace
parameter.
The Transform.Add
method allows you to add a position offset to the current transform. This method modifies the transform's position by adding the specified vector, either in local or world space, depending on the worldSpace
parameter.
To use the Add
method, provide a reference to a Vector3
that represents the position offset you want to add. Specify whether the offset should be applied in world space by setting the worldSpace
parameter to true
or false
for local space.
// Example of using Transform.Add Transform currentTransform = new Transform(); Vector3 offset = new Vector3(1.0f, 0.0f, 0.0f); // Add offset in world space currentTransform = currentTransform.Add(ref offset, true); // Add offset in local space currentTransform = currentTransform.Add(ref offset, false);