Class Leap::Interaction::Internal::InteractionEngineUtility::ColliderUtil

class Leap.Interaction.Internal.InteractionEngineUtility.ColliderUtil

Public Static Functions

static bool WithinDistance (Vector3 point, Vector3 center, float radius)

Returns whether or not a given vector is within a given radius to a center point

static Vector3 GetPointAtDistance (Vector3 point, Vector3 center, float distance)

Given a point and a center, return a new point that is along the axis created by the two vectors, and is a given distance from the center

static bool IsPointInside (this Collider collider, Vector3 localPosition, float extrude = 0.0f)

Given a collider and a position relative to the colliders transform, return whether or not the position lies within the collider. Can also optionally extrude the collider.

Warning: MeshColliders are not fully supported; this will only support testing against a MeshCollider’s bounding box, with no extrusion.

static Vector3 ClosestPointOnSurface (this Collider collider, Vector3 localPosition, float extrude = 0.0f)

Given a collider and a position relative to the colliders transform, return the point on the surface of the collider closest to the position. Can also optionally extrude the collider.

Warning: If you are using a version of Unity pre-5.6, MeshColliders are not fully supported; this will only find the closest point on a MeshCollider’s bounding box, with no extrusion.

static bool IsPointInside (List<Collider> colliders, Vector3 globalPosition, float extrude = 0.0f)

Given a list of colliders and a position in global space, return whether or not the position lies within any of the colliders. Can also optionally extrude the collider.

static Vector3 ClosestPointOnSurfaces (List<Collider> colliders, Vector3 globalPosition, float extrude = 0.0f)

Given a list of colliders and a position in global space, return the point on the surface of any of the colliders that is closest to the given position. NOTE that this point might be inside of a collider! Can also optionally extrude the colliders.

static void GetSegmentInfo (this CapsuleCollider collider, out Vector3 localV0, out Vector3 localV1, out float length)

A capsule is defined as a line segment with a radius. This method returns the two endpoints of that segment, as well as it’s length, in local space.