The PointToLocal
method of the Transform
struct converts a point from world space to local space. This is useful when you need to determine the position of a point relative to the local coordinate system of a transform.
The PointToLocal
method of the Transform
struct converts a point from world space to local space. This is useful when you need to determine the position of a point relative to the local coordinate system of a transform.
To use the PointToLocal
method, you need to have a Transform
instance. Pass a Vector3
reference representing the world point you want to convert. The method will return a Vector3
representing the point in local space.
// Example usage of Transform.PointToLocal Transform transform = new Transform(); Vector3 worldPoint = new Vector3(10, 20, 30); Vector3 localPoint = transform.PointToLocal(ref worldPoint); // localPoint now contains the coordinates of worldPoint in the local space of the transform.