Skip to main content

Physics

A toolbox for anything Physics related.

To get the Physics class, you must get its handler.

let Physics = instance.GetHandler("Physics")

You can then use the Physics property to access the Physics class.

Methods

Method NameReturn TypeParametersDescription
CheckBoxboolfloat3, float3, float4¹Check whether the given box overlaps with other colliders or not
CheckCapsuleboolfloat3, float3, floatChecks if any colliders overlap a capsule-shaped volume in world space
CheckSphereboolfloat3, floatReturns true if there are any colliders overlapping the sphere defined by position and radius in world coordinates
ClosestPointfloat3float3, Collider, float3, float4Returns a point on the given collider that is closest to the specified location
ComputePenetrationPenetrationResultCollider, float3, float4, Collider, float3. float4Computes the minimal translation required to separate the given colliders apart at specified poses.
SetCollisionIgnorevoidCollider, Collider, boolSets ability to collide between two colliders
Linecastboolfloat3, float3Returns true if there is any collider intersecting the line between start and end
OverlapBoxCollider[]float3, float3, float4¹Finds all colliders touching inside of the given box
OverlapCapsuleCollider[]float3, float3, floatChecks the given capsule against the physics world and returns all overlapping colliders
OverlapSphereCollider[]float3, floatComputes colliders touching or that are inside the sphere
RaycastRaycastHit[]Ray, float²Casts a ray through the Scene and returns all hits
RaycastAllRaycastHit[]Ray, float²Casts a ray through the Scene and returns all hits
SphereCastRaycastHit[]float3, float, float3, float²Casts a sphere along the direction and returns all hits
SphereCastAllRaycastHit[]float3, float, float3, float²Casts a sphere along the direction and returns all hits

Properties

Property NameTypeDescription
gravityfloat3The current gravity in a world

¹ Optional Parameter

² MathF.Infinity