|
GearBlocks
The GearBlocks Lua scripting API
|
Some useful physics functions. More...
Static Public Member Functions | |
| static bool | CheckSphere (Vector3Proxy centre, float radius) |
| Checks if anything in the scene is inside a spherical region. | |
| static bool | CheckCapsule (Vector3Proxy centre, Vector3Proxy offsetToEnd, float radius) |
| Checks if anything in the scene is inside a capsule region. | |
| static bool | CheckBox (Vector3Proxy centre, QuaternionProxy orientation, Vector3Proxy extents) |
| Checks if anything in the scene is inside a box region. | |
| static bool | RayCast (Vector3Proxy origin, Vector3Proxy direction, float maxDistance) |
| Casts a ray into the scene, finding the first hit point (i.e. the one closest to the ray origin). | |
| static int | RayCastAll (Vector3Proxy origin, Vector3Proxy direction, float maxDistance) |
| Casts a ray into the scene, finding all hit points. | |
| static bool | SphereCast (Vector3Proxy centre, float radius, Vector3Proxy direction, float maxDistance) |
| Casts a sphere into the scene, finding the first hit point (i.e. the one closest to the sphere origin). | |
| static int | SphereCastAll (Vector3Proxy centre, float radius, Vector3Proxy direction, float maxDistance) |
| Casts a sphere into the scene, finding all hit points. | |
| static bool | CapsuleCast (Vector3Proxy centre, Vector3Proxy offsetToEnd, float radius, Vector3Proxy direction, float maxDistance) |
| Casts a capsule into the scene, finding the first hit point (i.e. the one closest to the capsule origin). | |
| static int | CapsuleCastAll (Vector3Proxy centre, Vector3Proxy offsetToEnd, float radius, Vector3Proxy direction, float maxDistance) |
| Casts a capsule into the scene, finding all hit points. | |
| static bool | BoxCast (Vector3Proxy centre, QuaternionProxy orientation, Vector3Proxy extents, Vector3Proxy direction, float maxDistance) |
| Casts a box into the scene, finding the first hit point (i.e. the one closest to the box origin). | |
| static int | BoxCastAll (Vector3Proxy centre, QuaternionProxy orientation, Vector3Proxy extents, Vector3Proxy direction, float maxDistance) |
| Casts a box into the scene, finding all hit points. | |
| static float | QueryCastHit (int index, out Vector3Proxy position, out Vector3Proxy normal, out int colliderInstanceID) |
| Retrieves hit point data from the most recent cast. | |
Some useful physics functions.
Available in Lua via the "Physics" global, for example:
|
static |
Checks if anything in the scene is inside a spherical region.
| centre | The centre point of the sphere, in world coordinates. |
| radius | The radius of the sphere. |
true if anything is inside the sphere; otherwise, false.
|
static |
Checks if anything in the scene is inside a capsule region.
| centre | The centre point of the capsule, in world coordinates. |
| offsetToEnd | A vector from the capsule centre to the centre of one of its end "spheres" (the other end will be offset by -offsetToEnd from the centre), in world coordinates. |
| radius | The radius of the capsule. |
true if anything is inside the capsule; otherwise, false.
|
static |
Checks if anything in the scene is inside a box region.
| centre | The centre point of the box, in world coordinates. |
| orientation | The orientation of the box, in world coordinates. |
| extents | Half the size of the box in each dimension. |
true if anything is inside the box; otherwise, false.
|
static |
Casts a ray into the scene, finding the first hit point (i.e. the one closest to the ray origin).
| origin | The starting point of the ray, in world coordinates. |
| direction | The direction of the ray, in world coordinates. |
| maxDistance | The maximum distance the ray will "travel". |
true if the ray hits something; otherwise, false.For information on the hit point, call QueryCastHit, for example:
|
static |
Casts a ray into the scene, finding all hit points.
| origin | The starting point of the ray, in world coordinates. |
| direction | The direction of the ray, in world coordinates. |
| maxDistance | The maximum distance the ray will "travel". |
For information on the hit point, call QueryCastHit, for example:
|
static |
Casts a sphere into the scene, finding the first hit point (i.e. the one closest to the sphere origin).
| centre | The starting centre point of the sphere, in world coordinates. |
| radius | The radius of the sphere. |
| direction | The cast direction, in world coordinates. |
| maxDistance | The maximum distance the sphere will "travel". |
true if the sphere hits something; otherwise, false.For information on the hit point, call QueryCastHit, for example:
|
static |
Casts a sphere into the scene, finding all hit points.
| centre | The starting centre point of the sphere, in world coordinates. |
| radius | The radius of the sphere. |
| direction | The cast direction, in world coordinates. |
| maxDistance | The maximum distance the sphere will "travel". |
For information on the hit point, call QueryCastHit, for example:
|
static |
Casts a capsule into the scene, finding the first hit point (i.e. the one closest to the capsule origin).
| centre | The starting centre point of the capsule, in world coordinates. |
| offsetToEnd | A vector from the capsule centre to the centre of one of its end "spheres" (the other end will be offset by -offsetToEnd from the centre), in world coordinates. |
| radius | The radius of the capsule. |
| direction | The cast direction, in world coordinates. |
| maxDistance | The maximum distance the capsule will "travel". |
true if the capsule hits something; otherwise, false.For information on the hit point, call QueryCastHit, for example:
|
static |
Casts a capsule into the scene, finding all hit points.
| centre | The starting centre point of the capsule, in world coordinates. |
| offsetToEnd | A vector from the capsule centre to the centre of one of its end "spheres" (the other end will be offset by -offsetToEnd from the centre), in world coordinates. |
| radius | The radius of the capsule. |
| direction | The cast direction, in world coordinates. |
| maxDistance | The maximum distance the capsule will "travel". |
For information on the hit point, call QueryCastHit, for example:
|
static |
Casts a box into the scene, finding the first hit point (i.e. the one closest to the box origin).
| centre | The starting centre point of the box, in world coordinates. |
| orientation | The orientation of the box, in world coordinates. |
| extents | Half the size of the box in each dimension. |
| direction | The cast direction, in world coordinates. |
| maxDistance | The maximum distance the box will "travel". |
true if the box hits something; otherwise, false.For information on the hit point, call QueryCastHit, for example:
|
static |
Casts a box into the scene, finding all hit points.
| centre | The starting centre point of the box, in world coordinates. |
| orientation | The orientation of the box, in world coordinates. |
| extents | Half the size of the box in each dimension. |
| direction | The cast direction, in world coordinates. |
| maxDistance | The maximum distance the box will "travel". |
For information on the hit point, call QueryCastHit, for example:
|
static |
Retrieves hit point data from the most recent cast.
| index | Index of the hit point to query. |
| position | Returns the hit point position, in world coordinates. |
| normal | Returns the hit point normal, in world coordinates. |
| colliderInstanceID | Returns an ID for the collider that was hit. |
Using the collider instance ID, if a part was hit it can be retrieved from the PartColliderRegistry, for example: