Casts a ray against the Shape and returns the first intersection.
This takes into account the pose of the Shape's collider (if any), as well as its local offset set with Shape:setOffset.
Arguments
| Name | Type | Description |
| x1 | number |
The x coordinate of the origin of the ray.
|
| y1 | number |
The y coordinate of the origin of the ray.
|
| z1 | number |
The z coordinate of the origin of the ray.
|
| x2 | number |
The x coordinate of the endpoint of the ray.
|
| y2 | number |
The y coordinate of the endpoint of the ray.
|
| z2 | number |
The z coordinate of the endpoint of the ray.
|
Returns
| Name | Type | Description |
| x | number |
The x coordinate of the impact point.
|
| y | number |
The y coordinate of the impact point.
|
| z | number |
The z coordinate of the impact point.
|
| nx | number |
The x component of the normal vector.
|
| ny | number |
The y component of the normal vector.
|
| nz | number |
The z component of the normal vector.
|
| triangle | number | nil |
The index of the triangle that was hit, or nil if this is not a MeshShape.
|
Arguments
| Name | Type | Description |
| origin | vector |
The origin of the ray.
|
| endpoint | vector |
The endpoint of the ray.
|
Returns
| Name | Type | Description |
| x | number |
The x coordinate of the impact point.
|
| y | number |
The y coordinate of the impact point.
|
| z | number |
The z coordinate of the impact point.
|
| nx | number |
The x component of the normal vector.
|
| ny | number |
The y component of the normal vector.
|
| nz | number |
The z component of the normal vector.
|
| triangle | number | nil |
The index of the triangle that was hit, or nil if this is not a MeshShape.
|
See also