Class Physics
Physics simulation system.
Inheritance
Assembly: FlaxEngine.dll
File: Engine/Physics/Physics.h
Syntax
public class Physics
Fields
LayerMasks
The collision layers masks. Used to define layer-based collision detection.
Declaration
public static uint32 LayerMasks[32]
Field Value
uint32
|
Methods
BoxCast(const Vector3& center, const Vector3& halfExtents, const Vector3& direction, const Quaternion& rotation=Quaternion::Identity, float maxDistance=MAX_float, uint32 layerMask=MAX_uint32, bool hitTriggers=true)
Performs a sweep test against objects in the scene using a box geometry.
Declaration
public static bool BoxCast(const Vector3& center, const Vector3& halfExtents, const Vector3& direction, const Quaternion& rotation=Quaternion::Identity, float maxDistance=MAX_float, uint32 layerMask=MAX_uint32, bool hitTriggers=true)
Parameters
Vector3
center
The box center. |
Vector3
halfExtents
The half size of the box in each direction. |
Vector3
direction
The normalized direction in which cast a box. |
Quaternion
rotation
The box rotation. |
float
maxDistance
The maximum distance the ray should check for collisions. |
uint32
layerMask
The layer mask used to filter the results. |
bool
hitTriggers
If set to |
Returns
bool
True if box hits an matching object, otherwise false. |
BoxCast(const Vector3& center, const Vector3& halfExtents, const Vector3& direction, RayCastHit& hitInfo, const Quaternion& rotation=Quaternion::Identity, float maxDistance=MAX_float, uint32 layerMask=MAX_uint32, bool hitTriggers=true)
Performs a sweep test against objects in the scene using a box geometry.
Declaration
public static bool BoxCast(const Vector3& center, const Vector3& halfExtents, const Vector3& direction, RayCastHit& hitInfo, const Quaternion& rotation=Quaternion::Identity, float maxDistance=MAX_float, uint32 layerMask=MAX_uint32, bool hitTriggers=true)
Parameters
Vector3
center
The box center. |
Vector3
halfExtents
The half size of the box in each direction. |
Vector3
direction
The normalized direction in which cast a box. |
RayCastHit
hitInfo
The result hit information. Valid only when method returns true. |
Quaternion
rotation
The box rotation. |
float
maxDistance
The maximum distance the ray should check for collisions. |
uint32
layerMask
The layer mask used to filter the results. |
bool
hitTriggers
If set to |
Returns
bool
True if box hits an matching object, otherwise false. |
BoxCastAll(const Vector3& center, const Vector3& halfExtents, const Vector3& direction, Array<RayCastHit, HeapAllocation>& results, const Quaternion& rotation=Quaternion::Identity, float maxDistance=MAX_float, uint32 layerMask=MAX_uint32, bool hitTriggers=true)
Performs a sweep test against objects in the scene using a box geometry.
Declaration
public static bool BoxCastAll(const Vector3& center, const Vector3& halfExtents, const Vector3& direction, Array<RayCastHit, HeapAllocation>& results, const Quaternion& rotation=Quaternion::Identity, float maxDistance=MAX_float, uint32 layerMask=MAX_uint32, bool hitTriggers=true)
Parameters
Vector3
center
The box center. |
Vector3
halfExtents
The half size of the box in each direction. |
Vector3
direction
The normalized direction in which cast a box. |
Array<RayCastHit, HeapAllocation>
results
The result hits. Valid only when method returns true. |
Quaternion
rotation
The box rotation. |
float
maxDistance
The maximum distance the ray should check for collisions. |
uint32
layerMask
The layer mask used to filter the results. |
bool
hitTriggers
If set to |
Returns
bool
True if box hits an matching object, otherwise false. |
CapsuleCast(const Vector3& center, float radius, float height, const Vector3& direction, const Quaternion& rotation=Quaternion::Identity, float maxDistance=MAX_float, uint32 layerMask=MAX_uint32, bool hitTriggers=true)
Performs a sweep test against objects in the scene using a capsule geometry.
Declaration
public static bool CapsuleCast(const Vector3& center, float radius, float height, const Vector3& direction, const Quaternion& rotation=Quaternion::Identity, float maxDistance=MAX_float, uint32 layerMask=MAX_uint32, bool hitTriggers=true)
Parameters
Vector3
center
The capsule center. |
float
radius
The radius of the capsule. |
float
height
The height of the capsule, excluding the top and bottom spheres. |
Vector3
direction
The normalized direction in which cast a capsule. |
Quaternion
rotation
The capsule rotation. |
float
maxDistance
The maximum distance the ray should check for collisions. |
uint32
layerMask
The layer mask used to filter the results. |
bool
hitTriggers
If set to |
Returns
bool
True if capsule hits an matching object, otherwise false. |
CapsuleCast(const Vector3& center, float radius, float height, const Vector3& direction, RayCastHit& hitInfo, const Quaternion& rotation=Quaternion::Identity, float maxDistance=MAX_float, uint32 layerMask=MAX_uint32, bool hitTriggers=true)
Performs a sweep test against objects in the scene using a capsule geometry.
Declaration
public static bool CapsuleCast(const Vector3& center, float radius, float height, const Vector3& direction, RayCastHit& hitInfo, const Quaternion& rotation=Quaternion::Identity, float maxDistance=MAX_float, uint32 layerMask=MAX_uint32, bool hitTriggers=true)
Parameters
Vector3
center
The capsule center. |
float
radius
The radius of the capsule. |
float
height
The height of the capsule, excluding the top and bottom spheres. |
Vector3
direction
The normalized direction in which cast a capsule. |
RayCastHit
hitInfo
The result hit information. Valid only when method returns true. |
Quaternion
rotation
The capsule rotation. |
float
maxDistance
The maximum distance the ray should check for collisions. |
uint32
layerMask
The layer mask used to filter the results. |
bool
hitTriggers
If set to |
Returns
bool
True if capsule hits an matching object, otherwise false. |
CapsuleCastAll(const Vector3& center, float radius, float height, const Vector3& direction, Array<RayCastHit, HeapAllocation>& results, const Quaternion& rotation=Quaternion::Identity, float maxDistance=MAX_float, uint32 layerMask=MAX_uint32, bool hitTriggers=true)
Performs a sweep test against objects in the scene using a capsule geometry.
Declaration
public static bool CapsuleCastAll(const Vector3& center, float radius, float height, const Vector3& direction, Array<RayCastHit, HeapAllocation>& results, const Quaternion& rotation=Quaternion::Identity, float maxDistance=MAX_float, uint32 layerMask=MAX_uint32, bool hitTriggers=true)
Parameters
Vector3
center
The capsule center. |
float
radius
The radius of the capsule. |
float
height
The height of the capsule, excluding the top and bottom spheres. |
Vector3
direction
The normalized direction in which cast a capsule. |
Array<RayCastHit, HeapAllocation>
results
The result hits. Valid only when method returns true. |
Quaternion
rotation
The capsule rotation. |
float
maxDistance
The maximum distance the ray should check for collisions. |
uint32
layerMask
The layer mask used to filter the results. |
bool
hitTriggers
If set to |
Returns
bool
True if capsule hits an matching object, otherwise false. |
CheckBox(const Vector3& center, const Vector3& halfExtents, const Quaternion& rotation=Quaternion::Identity, uint32 layerMask=MAX_uint32, bool hitTriggers=true)
Checks whether the given box overlaps with other colliders or not.
Declaration
public static bool CheckBox(const Vector3& center, const Vector3& halfExtents, const Quaternion& rotation=Quaternion::Identity, uint32 layerMask=MAX_uint32, bool hitTriggers=true)
Parameters
Vector3
center
The box center. |
Vector3
halfExtents
The half size of the box in each direction. |
Quaternion
rotation
The box rotation. |
uint32
layerMask
The layer mask used to filter the results. |
bool
hitTriggers
If set to |
Returns
bool
True if box overlaps any matching object, otherwise false. |
CheckCapsule(const Vector3& center, float radius, float height, const Quaternion& rotation=Quaternion::Identity, uint32 layerMask=MAX_uint32, bool hitTriggers=true)
Checks whether the given capsule overlaps with other colliders or not.
Declaration
public static bool CheckCapsule(const Vector3& center, float radius, float height, const Quaternion& rotation=Quaternion::Identity, uint32 layerMask=MAX_uint32, bool hitTriggers=true)
Parameters
Vector3
center
The capsule center. |
float
radius
The radius of the capsule. |
float
height
The height of the capsule, excluding the top and bottom spheres. |
Quaternion
rotation
The capsule rotation. |
uint32
layerMask
The layer mask used to filter the results. |
bool
hitTriggers
If set to |
Returns
bool
True if capsule overlaps any matching object, otherwise false. |
CheckConvex(const Vector3& center, const CollisionData* convexMesh, const Vector3& scale, const Quaternion& rotation=Quaternion::Identity, uint32 layerMask=MAX_uint32, bool hitTriggers=true)
Checks whether the given convex mesh overlaps with other colliders or not.
Declaration
public static bool CheckConvex(const Vector3& center, const CollisionData* convexMesh, const Vector3& scale, const Quaternion& rotation=Quaternion::Identity, uint32 layerMask=MAX_uint32, bool hitTriggers=true)
Parameters
Vector3
center
The convex mesh center. |
CollisionData
convexMesh
Collision data of the convex mesh. |
Vector3
scale
The scale of the convex mesh. |
Quaternion
rotation
The convex mesh rotation. |
uint32
layerMask
The layer mask used to filter the results. |
bool
hitTriggers
If set to |
Returns
bool
True if convex mesh overlaps any matching object, otherwise false. |
CheckSphere(const Vector3& center, float radius, uint32 layerMask=MAX_uint32, bool hitTriggers=true)
Checks whether the given sphere overlaps with other colliders or not.
Declaration
public static bool CheckSphere(const Vector3& center, float radius, uint32 layerMask=MAX_uint32, bool hitTriggers=true)
Parameters
Vector3
center
The sphere center. |
float
radius
The radius of the sphere. |
uint32
layerMask
The layer mask used to filter the results. |
bool
hitTriggers
If set to |
Returns
bool
True if sphere overlaps any matching object, otherwise false. |
CollectResults()
Called during main engine loop to collect physic simulation results and apply them as well as fire collision events.
Declaration
public static void CollectResults()
ConvexCast(const Vector3& center, const CollisionData* convexMesh, const Vector3& scale, const Vector3& direction, const Quaternion& rotation=Quaternion::Identity, float maxDistance=MAX_float, uint32 layerMask=MAX_uint32, bool hitTriggers=true)
Performs a sweep test against objects in the scene using a convex mesh.
Declaration
public static bool ConvexCast(const Vector3& center, const CollisionData* convexMesh, const Vector3& scale, const Vector3& direction, const Quaternion& rotation=Quaternion::Identity, float maxDistance=MAX_float, uint32 layerMask=MAX_uint32, bool hitTriggers=true)
Parameters
Vector3
center
The convex mesh center. |
CollisionData
convexMesh
Collision data of the convex mesh. |
Vector3
scale
The scale of the convex mesh. |
Vector3
direction
The normalized direction in which cast a convex mesh. |
Quaternion
rotation
The convex mesh rotation. |
float
maxDistance
The maximum distance the ray should check for collisions. |
uint32
layerMask
The layer mask used to filter the results. |
bool
hitTriggers
If set to |
Returns
bool
True if convex mesh hits an matching object, otherwise false. |
ConvexCast(const Vector3& center, const CollisionData* convexMesh, const Vector3& scale, const Vector3& direction, RayCastHit& hitInfo, const Quaternion& rotation=Quaternion::Identity, float maxDistance=MAX_float, uint32 layerMask=MAX_uint32, bool hitTriggers=true)
Performs a sweep test against objects in the scene using a convex mesh.
Declaration
public static bool ConvexCast(const Vector3& center, const CollisionData* convexMesh, const Vector3& scale, const Vector3& direction, RayCastHit& hitInfo, const Quaternion& rotation=Quaternion::Identity, float maxDistance=MAX_float, uint32 layerMask=MAX_uint32, bool hitTriggers=true)
Parameters
Vector3
center
The convex mesh center. |
CollisionData
convexMesh
Collision data of the convex mesh. |
Vector3
scale
The scale of the convex mesh. |
Vector3
direction
The normalized direction in which cast a convex mesh. |
RayCastHit
hitInfo
The result hit information. Valid only when method returns true. |
Quaternion
rotation
The convex mesh rotation. |
float
maxDistance
The maximum distance the ray should check for collisions. |
uint32
layerMask
The layer mask used to filter the results. |
bool
hitTriggers
If set to |
Returns
bool
True if convex mesh hits an matching object, otherwise false. |
ConvexCastAll(const Vector3& center, const CollisionData* convexMesh, const Vector3& scale, const Vector3& direction, Array<RayCastHit, HeapAllocation>& results, const Quaternion& rotation=Quaternion::Identity, float maxDistance=MAX_float, uint32 layerMask=MAX_uint32, bool hitTriggers=true)
Performs a sweep test against objects in the scene using a convex mesh.
Declaration
public static bool ConvexCastAll(const Vector3& center, const CollisionData* convexMesh, const Vector3& scale, const Vector3& direction, Array<RayCastHit, HeapAllocation>& results, const Quaternion& rotation=Quaternion::Identity, float maxDistance=MAX_float, uint32 layerMask=MAX_uint32, bool hitTriggers=true)
Parameters
Vector3
center
The convex mesh center. |
CollisionData
convexMesh
Collision data of the convex mesh. |
Vector3
scale
The scale of the convex mesh. |
Vector3
direction
The normalized direction in which cast a convex mesh. |
Array<RayCastHit, HeapAllocation>
results
The result hits. Valid only when method returns true. |
Quaternion
rotation
The convex mesh rotation. |
float
maxDistance
The maximum distance the ray should check for collisions. |
uint32
layerMask
The layer mask used to filter the results. |
bool
hitTriggers
If set to |
Returns
bool
True if convex mesh hits an matching object, otherwise false. |
FlushRequests()
Flushes any latent physics actions (eg. object destroy, actor add/remove to the scene, etc.).
Declaration
public static void FlushRequests()
GetAutoSimulation()
The automatic simulation feature. True if perform physics simulation after on fixed update by auto, otherwise user should do it.
Declaration
public static bool GetAutoSimulation()
Returns
bool
|
GetBounceThresholdVelocity()
Gets the minimum relative velocity required for an object to bounce.
Declaration
public static float GetBounceThresholdVelocity()
Returns
float
|
GetEnableCCD()
Gets the CCD feature enable flag.
Declaration
public static bool GetEnableCCD()
Returns
bool
|
GetGravity()
Gets the current gravity force.
Declaration
public static Vector3 GetGravity()
Returns
Vector3
|
IsDuringSimulation()
Checks if physical simulation is running.
Declaration
public static bool IsDuringSimulation()
Returns
bool
|
LineCast(const Vector3& start, const Vector3& end, RayCastHit& hitInfo, uint32 layerMask=MAX_uint32, bool hitTriggers=true)
Performs a line between two points in the scene.
Declaration
public static bool LineCast(const Vector3& start, const Vector3& end, RayCastHit& hitInfo, uint32 layerMask=MAX_uint32, bool hitTriggers=true)
Parameters
Vector3
start
The start position of the line. |
Vector3
end
The end position of the line. |
RayCastHit
hitInfo
The result hit information. Valid only when method returns true. |
uint32
layerMask
The layer mask used to filter the results. |
bool
hitTriggers
If set to |
Returns
bool
True if ray hits an matching object, otherwise false. |
LineCast(const Vector3& start, const Vector3& end, uint32 layerMask=MAX_uint32, bool hitTriggers=true)
Performs a line between two points in the scene.
Declaration
public static bool LineCast(const Vector3& start, const Vector3& end, uint32 layerMask=MAX_uint32, bool hitTriggers=true)
Parameters
Vector3
start
The start position of the line. |
Vector3
end
The end position of the line. |
uint32
layerMask
The layer mask used to filter the results. |
bool
hitTriggers
If set to |
Returns
bool
True if ray hits an matching object, otherwise false. |
LineCastAll(const Vector3& start, const Vector3& end, Array<RayCastHit, HeapAllocation>& results, uint32 layerMask=MAX_uint32, bool hitTriggers=true)
Performs a line between two points in the scene, returns all hitpoints infos.
Declaration
public static bool LineCastAll(const Vector3& start, const Vector3& end, Array<RayCastHit, HeapAllocation>& results, uint32 layerMask=MAX_uint32, bool hitTriggers=true)
Parameters
Vector3
start
The origin of the ray. |
Vector3
end
The end position of the line. |
Array<RayCastHit, HeapAllocation>
results
The result hits. Valid only when method returns true. |
uint32
layerMask
The layer mask used to filter the results. |
bool
hitTriggers
If set to |
Returns
bool
True if ray hits an matching object, otherwise false. |
OverlapBox(const Vector3& center, const Vector3& halfExtents, Array<Collider* , HeapAllocation>& results, const Quaternion& rotation=Quaternion::Identity, uint32 layerMask=MAX_uint32, bool hitTriggers=true)
Finds all colliders touching or inside of the given box.
Declaration
public static bool OverlapBox(const Vector3& center, const Vector3& halfExtents, Array<Collider* , HeapAllocation>& results, const Quaternion& rotation=Quaternion::Identity, uint32 layerMask=MAX_uint32, bool hitTriggers=true)
Parameters
Vector3
center
The box center. |
Vector3
halfExtents
The half size of the box in each direction. |
Array<Collider , HeapAllocation>
results
The result colliders that overlap with the given box. Valid only when method returns true. |
Quaternion
rotation
The box rotation. |
uint32
layerMask
The layer mask used to filter the results. |
bool
hitTriggers
If set to |
Returns
bool
True if box overlaps any matching object, otherwise false. |
OverlapBox(const Vector3& center, const Vector3& halfExtents, Array<PhysicsColliderActor* , HeapAllocation>& results, const Quaternion& rotation=Quaternion::Identity, uint32 layerMask=MAX_uint32, bool hitTriggers=true)
Finds all colliders touching or inside of the given box.
Declaration
public static bool OverlapBox(const Vector3& center, const Vector3& halfExtents, Array<PhysicsColliderActor* , HeapAllocation>& results, const Quaternion& rotation=Quaternion::Identity, uint32 layerMask=MAX_uint32, bool hitTriggers=true)
Parameters
Vector3
center
The box center. |
Vector3
halfExtents
The half size of the box in each direction. |
Array<PhysicsColliderActor , HeapAllocation>
results
The result colliders that overlap with the given box. Valid only when method returns true. |
Quaternion
rotation
The box rotation. |
uint32
layerMask
The layer mask used to filter the results. |
bool
hitTriggers
If set to |
Returns
bool
True if box overlaps any matching object, otherwise false. |
OverlapCapsule(const Vector3& center, float radius, float height, Array<Collider* , HeapAllocation>& results, const Quaternion& rotation=Quaternion::Identity, uint32 layerMask=MAX_uint32, bool hitTriggers=true)
Finds all colliders touching or inside of the given capsule.
Declaration
public static bool OverlapCapsule(const Vector3& center, float radius, float height, Array<Collider* , HeapAllocation>& results, const Quaternion& rotation=Quaternion::Identity, uint32 layerMask=MAX_uint32, bool hitTriggers=true)
Parameters
Vector3
center
The capsule center. |
float
radius
The radius of the capsule. |
float
height
The height of the capsule, excluding the top and bottom spheres. |
Array<Collider , HeapAllocation>
results
The result colliders that overlap with the given capsule. Valid only when method returns true. |
Quaternion
rotation
The capsule rotation. |
uint32
layerMask
The layer mask used to filter the results. |
bool
hitTriggers
If set to |
Returns
bool
True if capsule overlaps any matching object, otherwise false. |
OverlapCapsule(const Vector3& center, float radius, float height, Array<PhysicsColliderActor* , HeapAllocation>& results, const Quaternion& rotation=Quaternion::Identity, uint32 layerMask=MAX_uint32, bool hitTriggers=true)
Finds all colliders touching or inside of the given capsule.
Declaration
public static bool OverlapCapsule(const Vector3& center, float radius, float height, Array<PhysicsColliderActor* , HeapAllocation>& results, const Quaternion& rotation=Quaternion::Identity, uint32 layerMask=MAX_uint32, bool hitTriggers=true)
Parameters
Vector3
center
The capsule center. |
float
radius
The radius of the capsule. |
float
height
The height of the capsule, excluding the top and bottom spheres. |
Array<PhysicsColliderActor , HeapAllocation>
results
The result colliders that overlap with the given capsule. Valid only when method returns true. |
Quaternion
rotation
The capsule rotation. |
uint32
layerMask
The layer mask used to filter the results. |
bool
hitTriggers
If set to |
Returns
bool
True if capsule overlaps any matching object, otherwise false. |
OverlapConvex(const Vector3& center, const CollisionData* convexMesh, const Vector3& scale, Array<Collider* , HeapAllocation>& results, const Quaternion& rotation=Quaternion::Identity, uint32 layerMask=MAX_uint32, bool hitTriggers=true)
Finds all colliders touching or inside of the given convex mesh.
Declaration
public static bool OverlapConvex(const Vector3& center, const CollisionData* convexMesh, const Vector3& scale, Array<Collider* , HeapAllocation>& results, const Quaternion& rotation=Quaternion::Identity, uint32 layerMask=MAX_uint32, bool hitTriggers=true)
Parameters
Vector3
center
The convex mesh center. |
CollisionData
convexMesh
Collision data of the convex mesh. |
Vector3
scale
The scale of the convex mesh. |
Array<Collider , HeapAllocation>
results
The result colliders that overlap with the given convex mesh. Valid only when method returns true. |
Quaternion
rotation
The convex mesh rotation. |
uint32
layerMask
The layer mask used to filter the results. |
bool
hitTriggers
If set to |
Returns
bool
True if convex mesh overlaps any matching object, otherwise false. |
OverlapConvex(const Vector3& center, const CollisionData* convexMesh, const Vector3& scale, Array<PhysicsColliderActor* , HeapAllocation>& results, const Quaternion& rotation=Quaternion::Identity, uint32 layerMask=MAX_uint32, bool hitTriggers=true)
Finds all colliders touching or inside of the given convex mesh.
Declaration
public static bool OverlapConvex(const Vector3& center, const CollisionData* convexMesh, const Vector3& scale, Array<PhysicsColliderActor* , HeapAllocation>& results, const Quaternion& rotation=Quaternion::Identity, uint32 layerMask=MAX_uint32, bool hitTriggers=true)
Parameters
Vector3
center
The convex mesh center. |
CollisionData
convexMesh
Collision data of the convex mesh. |
Vector3
scale
The scale of the convex mesh. |
Array<PhysicsColliderActor , HeapAllocation>
results
The result colliders that overlap with the given convex mesh. Valid only when method returns true. |
Quaternion
rotation
The convex mesh rotation. |
uint32
layerMask
The layer mask used to filter the results. |
bool
hitTriggers
If set to |
Returns
bool
True if convex mesh overlaps any matching object, otherwise false. |
OverlapSphere(const Vector3& center, float radius, Array<Collider* , HeapAllocation>& results, uint32 layerMask=MAX_uint32, bool hitTriggers=true)
Finds all colliders touching or inside of the given sphere.
Declaration
public static bool OverlapSphere(const Vector3& center, float radius, Array<Collider* , HeapAllocation>& results, uint32 layerMask=MAX_uint32, bool hitTriggers=true)
Parameters
Vector3
center
The sphere center. |
float
radius
The radius of the sphere. |
Array<Collider , HeapAllocation>
results
The result colliders that overlap with the given sphere. Valid only when method returns true. |
uint32
layerMask
The layer mask used to filter the results. |
bool
hitTriggers
If set to |
Returns
bool
True if sphere overlaps any matching object, otherwise false. |
OverlapSphere(const Vector3& center, float radius, Array<PhysicsColliderActor* , HeapAllocation>& results, uint32 layerMask=MAX_uint32, bool hitTriggers=true)
Finds all colliders touching or inside of the given sphere.
Declaration
public static bool OverlapSphere(const Vector3& center, float radius, Array<PhysicsColliderActor* , HeapAllocation>& results, uint32 layerMask=MAX_uint32, bool hitTriggers=true)
Parameters
Vector3
center
The sphere center. |
float
radius
The radius of the sphere. |
Array<PhysicsColliderActor , HeapAllocation>
results
The result colliders that overlap with the given sphere. Valid only when method returns true. |
uint32
layerMask
The layer mask used to filter the results. |
bool
hitTriggers
If set to |
Returns
bool
True if sphere overlaps any matching object, otherwise false. |
RayCast(const Vector3& origin, const Vector3& direction, float maxDistance=MAX_float, uint32 layerMask=MAX_uint32, bool hitTriggers=true)
Performs a raycast against objects in the scene.
Declaration
public static bool RayCast(const Vector3& origin, const Vector3& direction, float maxDistance=MAX_float, uint32 layerMask=MAX_uint32, bool hitTriggers=true)
Parameters
Vector3
origin
The origin of the ray. |
Vector3
direction
The normalized direction of the ray. |
float
maxDistance
The maximum distance the ray should check for collisions. |
uint32
layerMask
The layer mask used to filter the results. |
bool
hitTriggers
If set to |
Returns
bool
True if ray hits an matching object, otherwise false. |
RayCast(const Vector3& origin, const Vector3& direction, RayCastHit& hitInfo, float maxDistance=MAX_float, uint32 layerMask=MAX_uint32, bool hitTriggers=true)
Performs a raycast against objects in the scene, returns results in a RayCastHit structure.
Declaration
public static bool RayCast(const Vector3& origin, const Vector3& direction, RayCastHit& hitInfo, float maxDistance=MAX_float, uint32 layerMask=MAX_uint32, bool hitTriggers=true)
Parameters
Vector3
origin
The origin of the ray. |
Vector3
direction
The normalized direction of the ray. |
RayCastHit
hitInfo
The result hit information. Valid only when method returns true. |
float
maxDistance
The maximum distance the ray should check for collisions. |
uint32
layerMask
The layer mask used to filter the results. |
bool
hitTriggers
If set to |
Returns
bool
True if ray hits an matching object, otherwise false. |
RayCastAll(const Vector3& origin, const Vector3& direction, Array<RayCastHit, HeapAllocation>& results, float maxDistance=MAX_float, uint32 layerMask=MAX_uint32, bool hitTriggers=true)
Performs a raycast against objects in the scene, returns results in a RayCastHit structure.
Declaration
public static bool RayCastAll(const Vector3& origin, const Vector3& direction, Array<RayCastHit, HeapAllocation>& results, float maxDistance=MAX_float, uint32 layerMask=MAX_uint32, bool hitTriggers=true)
Parameters
Vector3
origin
The origin of the ray. |
Vector3
direction
The normalized direction of the ray. |
Array<RayCastHit, HeapAllocation>
results
The result hits. Valid only when method returns true. |
float
maxDistance
The maximum distance the ray should check for collisions. |
uint32
layerMask
The layer mask used to filter the results. |
bool
hitTriggers
If set to |
Returns
bool
True if ray hits an matching object, otherwise false. |
SetBounceThresholdVelocity(float value)
Sets the minimum relative velocity required for an object to bounce.
Declaration
public static void SetBounceThresholdVelocity(float value)
Parameters
float
value
|
SetEnableCCD(bool value)
Sets the CCD feature enable flag.
Declaration
public static void SetEnableCCD(bool value)
Parameters
bool
value
|
SetGravity(const Vector3& value)
Sets the current gravity force.
Declaration
public static void SetGravity(const Vector3& value)
Parameters
Vector3
value
|
Simulate(float dt)
Called during main engine loop to start physic simulation. Use CollectResults after.
Declaration
public static void Simulate(float dt)
Parameters
float
dt
The delta time (in seconds). |
SphereCast(const Vector3& center, float radius, const Vector3& direction, float maxDistance=MAX_float, uint32 layerMask=MAX_uint32, bool hitTriggers=true)
Performs a sweep test against objects in the scene using a sphere geometry.
Declaration
public static bool SphereCast(const Vector3& center, float radius, const Vector3& direction, float maxDistance=MAX_float, uint32 layerMask=MAX_uint32, bool hitTriggers=true)
Parameters
Vector3
center
The sphere center. |
float
radius
The radius of the sphere. |
Vector3
direction
The normalized direction in which cast a sphere. |
float
maxDistance
The maximum distance the ray should check for collisions. |
uint32
layerMask
The layer mask used to filter the results. |
bool
hitTriggers
If set to |
Returns
bool
True if sphere hits an matching object, otherwise false. |
SphereCast(const Vector3& center, float radius, const Vector3& direction, RayCastHit& hitInfo, float maxDistance=MAX_float, uint32 layerMask=MAX_uint32, bool hitTriggers=true)
Performs a sweep test against objects in the scene using a sphere geometry.
Declaration
public static bool SphereCast(const Vector3& center, float radius, const Vector3& direction, RayCastHit& hitInfo, float maxDistance=MAX_float, uint32 layerMask=MAX_uint32, bool hitTriggers=true)
Parameters
Vector3
center
The sphere center. |
float
radius
The radius of the sphere. |
Vector3
direction
The normalized direction in which cast a sphere. |
RayCastHit
hitInfo
The result hit information. Valid only when method returns true. |
float
maxDistance
The maximum distance the ray should check for collisions. |
uint32
layerMask
The layer mask used to filter the results. |
bool
hitTriggers
If set to |
Returns
bool
True if sphere hits an matching object, otherwise false. |
SphereCastAll(const Vector3& center, float radius, const Vector3& direction, Array<RayCastHit, HeapAllocation>& results, float maxDistance=MAX_float, uint32 layerMask=MAX_uint32, bool hitTriggers=true)
Performs a sweep test against objects in the scene using a sphere geometry.
Declaration
public static bool SphereCastAll(const Vector3& center, float radius, const Vector3& direction, Array<RayCastHit, HeapAllocation>& results, float maxDistance=MAX_float, uint32 layerMask=MAX_uint32, bool hitTriggers=true)
Parameters
Vector3
center
The sphere center. |
float
radius
The radius of the sphere. |
Vector3
direction
The normalized direction in which cast a sphere. |
Array<RayCastHit, HeapAllocation>
results
The result hits. Valid only when method returns true. |
float
maxDistance
The maximum distance the ray should check for collisions. |
uint32
layerMask
The layer mask used to filter the results. |
bool
hitTriggers
If set to |
Returns
bool
True if sphere hits an matching object, otherwise false. |