Utility to perform intersection tests of rays against colliders. It is a static singleton, no need to instantiate. Just use: SQR.Intersection.rayTest(...)

- Source:

### Methods

#### (static) rayBox(r, t)

Performs an intersection test of a ray against a transform that has a box collider.

##### Parameters:

Name | Type | Description |
---|---|---|

`r` |
J3D.Ray | an instance of J3D.Ray |

`t` |
J3D.Transform | a transform to test against. |

- Source:

##### Returns:

True if ray intersects with the collider, false otherwise. If the transform doesn't have a box collider the method returns false.

#### (static) rayMesh(r, t)

Performs an intersection test of a ray against a transform that has a mesh collider.
WARNING. For meshes that have lots of polys, the ray/mesh intersection test can be very slow! It's better to wrap it into a box or sphere collider or have a simpler version of the mesh to make intersection tests against.

##### Parameters:

Name | Type | Description |
---|---|---|

`r` |
J3D.Ray | an instance of J3D.Ray |

`t` |
J3D.Transform | a transform to test against. |

- Source:

##### Returns:

True if ray intersects with the collider, false otherwise. If the transform doesn't have a geometry the method returns false.

#### (static) raySphere(r, t)

Performs an intersection test of a ray against a transform that has a sphere collider.

##### Parameters:

Name | Type | Description |
---|---|---|

`r` |
J3D.Ray | an instance of J3D.Ray |

`t` |
J3D.Transform | a transform to test against. |

- Source:

##### Returns:

True if ray intersects with the collider, false otherwise. If the transform doesn't have a sphere collider the method returns false.

#### (static) rayTest(r, t)

Performs an intersection test of a ray against a transform that has a collider. J3D supports three types of colliders: sphere, box and mesh. This method will check what type of collider the transform has and call the apropriate method to make the intersection tests.
WARNING. For meshes that have lots of polys, the ray/mesh intersection test can be very slow! It's better to wrap it into a box or sphere collider or have a simpler version of the mesh to make intersection tests against.

##### Parameters:

Name | Type | Description |
---|---|---|

`r` |
SQR.Ray | an instance of J3D.Ray |

`t` |
SQR.Transform | a transform to test against. |

- Source:

##### Returns:

True if ray intersects with the collider, false otherwise. If the transform doesn't have a collider the method returns false.

#### (static) rayTriangle()

Performs an intersection test of a ray against a single triangle.
You should not have to call this method directly, unless you have specific needs, like ex. doing intersection tests for particles.

- Source: