Class Leap::PhysicalHands::PhysExts

class Leap.PhysicalHands.PhysExts

Public Static Functions

static int OverlapBoxNonAlloc (BoxCollider box, Collider[] results, int layerMask = Physics.DefaultRaycastLayers, QueryTriggerInteraction queryTriggerInteraction = QueryTriggerInteraction.UseGlobal)

Computes and stores colliders touching or inside the box into the provided buffer. Does not attempt to grow the buffer if it runs out of space.

Param box

Which box should be checked

Param results

Array of colliders which are inside this box

Param layerMask

Which layermask should be used

Param queryTriggerInteraction

Overrides global Physics.queriesHitTriggers

Return

Returns the amount of colliders stored into the results buffer.

static int OverlapBoxNonAllocOffset (BoxCollider box, Vector3 offset, Collider[] results, int layerMask = Physics.DefaultRaycastLayers, QueryTriggerInteraction queryTriggerInteraction = QueryTriggerInteraction.UseGlobal, float extraRadius = 0)

Computes and stores colliders touching or inside the offset box into the provided buffer. Does not attempt to grow the buffer if it runs out of space.

Param box

Which box should be checked

Param offset

Offset to move the box by.

Param results

Array of colliders which are inside this box

Param layerMask

Which layermask should be used

Param queryTriggerInteraction

Overrides global Physics.queriesHitTriggers

Return

Returns the amount of colliders stored into the results buffer.

static void ToWorldSpaceBox (this BoxCollider box, out Vector3 center, out Vector3 halfExtents, out Quaternion orientation)

Computes where the box is in world space.

Param box

Which box should be checked.

Param center

Where is the centre of the box in world space.

Param halfExtents

Half extents of the box in world space.

Param orientation

Which way does the box face in world space.

static void ToWorldSpaceBoxOffset (this BoxCollider box, Vector3 offset, out Vector3 center, out Vector3 halfExtents, out Quaternion orientation, float extraRadius = 0)

Computes where the box is in world space with an offset.

Param box

Which box should be checked.

Param offset

Offset at which the box should be calculated.

Param center

Where is the centre of the box in world space.

Param halfExtents

Half extents of the box in world space.

Param orientation

Which way does the box face in world space.

static int OverlapSphereNonAlloc (SphereCollider sphere, Collider[] results, int layerMask = Physics.DefaultRaycastLayers, QueryTriggerInteraction queryTriggerInteraction = QueryTriggerInteraction.UseGlobal)

Computes and stores colliders touching or inside the sphere into the provided buffer. Does not attempt to grow the buffer if it runs out of space.The length of the buffer is returned when the buffer is full.

Param sphere

Which sphere collider should be checked

Param results

Array of colliders which are inside this sphere

Param layerMask

Which layermask should be used

Param queryTriggerInteraction

Overrides global Physics.queriesHitTriggers

static void ToWorldSpaceSphere (this SphereCollider sphere, out Vector3 center, out float radius)

Computes where the sphere is in world space.

Param sphere

Which box should be checked.

Param center

Where is the centre of the box in world space.

Param radius

The radius of the calculated sphere.

static int OverlapCapsuleNonAlloc (CapsuleCollider capsule, Collider[] results, int layerMask = Physics.DefaultRaycastLayers, QueryTriggerInteraction queryTriggerInteraction = QueryTriggerInteraction.UseGlobal)

Computes and stores colliders touching or inside the capsule into the provided buffer. Does not attempt to grow the buffer if it runs out of space. The length of the buffer is returned when the buffer is full.

Param capsule

Which capsule collider should be checked

Param results

Array of colliders which are inside this capsule

Param layerMask

Which layermask should be used

Param queryTriggerInteraction

Overrides global Physics.queriesHitTriggers

static int OverlapCapsuleNonAllocOffset (CapsuleCollider capsule, Vector3 offset, Collider[] results, int layerMask = Physics.DefaultRaycastLayers, QueryTriggerInteraction queryTriggerInteraction = QueryTriggerInteraction.UseGlobal, float extraRadius = 0)

Computes and stores colliders touching or inside the capsule into the provided buffer. Does not attempt to grow the buffer if it runs out of space. The length of the buffer is returned when the buffer is full.

Param capsule

Which capsule collider should be checked

Param offset

Offset at which the capsule should be calculated.

Param results

Array of colliders which are inside this capsule

Param layerMask

Which layermask should be used

Param queryTriggerInteraction

Overrides global Physics.queriesHitTriggers

static void ToWorldSpaceCapsule (this CapsuleCollider capsule, out Vector3 point0, out Vector3 point1, out float radius)

Computes where the sphere is in world space.

Param capsule

Which capsule should be checked.

Param point0

Point at the centre of one of the end spheres

Param point1

Point at the centre of the other end sphere

Param radius

Radius of the capsule.

static void ToWorldSpaceCapsuleOffset (this CapsuleCollider capsule, Vector3 offset, out Vector3 point0, out Vector3 point1, out float radius)

Computes where the sphere is in world space.

Param capsule

Which capsule should be checked.

Param offset

Offset to move the capsule by..

Param point0

Point at the centre of one of the end spheres of the capsule

Param point1

Point at the centre of the other end sphere of the capsule

Param radius

Radius of the capsule.

static Vector3 AbsVec3 (Vector3 v)

Get the absolute values of x, y or z in this vector3.

Param v

Vector3 to check

Return

Returns the absolute value of each element in a new Vector3

static float MaxVec3 (Vector3 v)

Get the highest value: x, y or z in this vector3.

Param v

Vector3 to check

Return

Highest value

static bool ContainsRange<T> (this T[] arr, T value, int maxIndex)

Does this array contain the value.

Param arr

Array to check

Param value

Value to search for in the array

Param maxIndex

How far through the array should we search

Return

bool

static bool IsPointWithinCollider (this Collider collider, Vector3 point)

Checks if a point is within a collider

Param collider

The collider to check

Param point

The point to check

Return

static bool IsSphereWithinCollider (this Collider collider, Vector3 centre, float radius)

Checks if a sphere intersects with a collider

Param collider

The collider to check

Param centre

The centre of the sphere

Param radius

The radius of the sphere, in meters

Return