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. Call the method with a Vector3
representing the world space point you want to convert. The method will return a Vector3
that represents the point in local space.
// Assume 'transform' is an instance of Transform Vector3 worldPoint = new Vector3(10, 20, 30); Vector3 localPoint = transform.PointToLocal(worldPoint); // 'localPoint' now contains the coordinates of 'worldPoint' in the local space of 'transform'.