Class PhysicsScene
Physical simulation scene.
Inherited Members
Assembly: FlaxEngine.dll
File: Engine/Physics/PhysicsScene.h
Syntax
public class PhysicsScene : public ScriptingObject
Constructors
~PhysicsScene()
Declaration
public ~PhysicsScene()
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 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 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 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 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 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 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 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 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 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 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 to collect physic simulation results and apply them as well as fire collision events.
Declaration
public 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 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 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 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. |
GetAutoSimulation()
Gets the automatic simulation feature that perform physics simulation after on fixed update by auto, otherwise user should do it.
Declaration
public bool GetAutoSimulation() const
Returns
bool
|
GetBounceThresholdVelocity()
Gets the minimum relative velocity required for an object to bounce.
Declaration
public float GetBounceThresholdVelocity()
Returns
float
|
GetEnableCCD()
Gets the CCD feature enable flag.
Declaration
public bool GetEnableCCD() const
Returns
bool
|
GetGravity()
Gets the current gravity force.
Declaration
public Vector3 GetGravity() const
Returns
Vector3
|
GetName()
GetOrigin()
Gets the current scene origin that defines the center of the simulation (in world). Can be used to run physics simulation relative to the camera.
Declaration
public Vector3 GetOrigin() const
Returns
Vector3
|
GetPhysicsScene()
Gets the native physics system scene object.
Declaration
public void* GetPhysicsScene() const
Returns
void
|
GetStatistics()
Gets the physics simulation statistics for the scene.
Declaration
public PhysicsStatistics GetStatistics() const
Returns
PhysicsStatistics
|
Init(const StringView& name, const PhysicsSettings& settings)
Initializes the scene.
Declaration
public bool Init(const StringView& name, const PhysicsSettings& settings)
Parameters
StringView
name
The name. |
PhysicsSettings
settings
The physics settings. |
Returns
bool
True if failed, otherwise false. |
IsDuringSimulation()
Checks if physical simulation is running.
Declaration
public bool IsDuringSimulation() const
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 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 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 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 normalized direction of the ray. |
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 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 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 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 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 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 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 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 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 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 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 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. |
SetAutoSimulation(bool value)
Sets the automatic simulation feature that perform physics simulation after on fixed update by auto, otherwise user should do it.
Declaration
public void SetAutoSimulation(bool value)
Parameters
bool
value
|
SetBounceThresholdVelocity(float value)
Sets the minimum relative velocity required for an object to bounce.
Declaration
public void SetBounceThresholdVelocity(float value)
Parameters
float
value
|
SetEnableCCD(bool value)
Sets the CCD feature enable flag.
Declaration
public void SetEnableCCD(bool value)
Parameters
bool
value
|
SetGravity(const Vector3& value)
Sets the current gravity force.
Declaration
public void SetGravity(const Vector3& value)
Parameters
Vector3
value
|
SetOrigin(const Vector3& value)
Sets the current scene origin that defines the center of the simulation (in world). Can be used to run physics simulation relative to the camera.
Declaration
public void SetOrigin(const Vector3& value)
Parameters
Vector3
value
|
Simulate(float dt)
Called during main engine loop to start physic simulation. Use CollectResults after.
Declaration
public 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 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 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 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. |