The ToLocal
method of the Ray
struct transforms the ray from world space to local space using the provided Transform
reference. This is useful when you need to work with rays in the context of a specific object's local coordinate system.
The ToLocal
method of the Ray
struct transforms the ray from world space to local space using the provided Transform
reference. This is useful when you need to work with rays in the context of a specific object's local coordinate system.
To use the ToLocal
method, you need to have a Ray
instance and a Transform
reference. The method will return a new Ray
that represents the original ray in the local space of the provided transform.
Parameters:
tx
(Transform&): A reference to the transform that defines the local space to which the ray will be converted.Returns: A Ray
in the local space of the specified transform.
// Assume 'ray' is a Ray instance and 'transform' is a Transform instance Ray localRay = ray.ToLocal(ref transform); // Now 'localRay' is the representation of 'ray' in the local space of 'transform'.