class PhysicsScene

Inherits: IScriptExportable

Physical representation of a scene, allowing creation of new physical objects in the scene and queries against those objects.

Objects created in different scenes cannot physically interact with eachother.

Public

Methods

FixedUpdate

virtual void FixedUpdate(float step) = 0

Updates the physics simulation.

In order to maintain stability of the physics calculations this method should be called at fixed intervals (e.g. 60 times a second).

step
Time delta to advance the physics simulation by, in seconds.

Update

virtual void Update()

Performs any physics operations that arent tied to the fixed update interval.

Should be called once per frame.

SetPaused

virtual void SetPaused(bool paused) = 0

Pauses or resumes the physics simulation.

IsUpdateInProgress

bool IsUpdateInProgress() const

Checks is the physics simulation update currently in progress.

RayCast

virtual bool RayCast(const Ray &ray, PhysicsQueryHit &hit, u64 layer = 18446744073709551615ULL, float max = 3.40282347E+38F) const

Casts a ray into the scene and returns the closest found hit, if any.

ray
Ray to cast into the scene.
hit
Information recorded about a hit. Only valid if method returns true.
layer
Layers to consider for the query. This allows you to ignore certain groups of objects.
max
Maximum distance at which to perform the query. Hits past this distance will not be detected.

Returns: True if something was hit, false otherwise.

RayCast

virtual bool RayCast(const Vector3 &origin, const Vector3 &unitDir, PhysicsQueryHit &hit, u64 layer = 18446744073709551615ULL, float max = 3.40282347E+38F) const = 0

Casts a ray into the scene and returns the closest found hit, if any.

origin
Origin of the ray to cast into the scene.
unitDir
Unit direction of the ray to cast into the scene.
hit
Information recorded about a hit. Only valid if method returns true.
layer
Layers to consider for the query. This allows you to ignore certain groups of objects.
max
Maximum distance at which to perform the query. Hits past this distance will not be detected.

Returns: True if something was hit, false otherwise.

BoxCast

virtual bool BoxCast(const AABox &box, const Quaternion &rotation, const Vector3 &unitDir, PhysicsQueryHit &hit, u64 layer = 18446744073709551615ULL, float max = 3.40282347E+38F) const = 0

Performs a sweep into the scene using a box and returns the closest found hit, if any.

box
Box to sweep through the scene.
rotation
Orientation of the box.
unitDir
Unit direction towards which to perform the sweep.
hit
Information recorded about a hit. Only valid if method returns true.
layer
Layers to consider for the query. This allows you to ignore certain groups of objects.
max
Maximum distance at which to perform the query. Hits past this distance will not be detected.

Returns: True if something was hit, false otherwise.

SphereCast

virtual bool SphereCast(const Sphere &sphere, const Vector3 &unitDir, PhysicsQueryHit &hit, u64 layer = 18446744073709551615ULL, float max = 3.40282347E+38F) const = 0

Performs a sweep into the scene using a sphere and returns the closest found hit, if any.

sphere
Sphere to sweep through the scene.
unitDir
Unit direction towards which to perform the sweep.
hit
Information recorded about a hit. Only valid if method returns true.
layer
Layers to consider for the query. This allows you to ignore certain groups of objects.
max
Maximum distance at which to perform the query. Hits past this distance will not be detected.

Returns: True if something was hit, false otherwise.

CapsuleCast

virtual bool CapsuleCast(const Capsule &capsule, const Quaternion &rotation, const Vector3 &unitDir, PhysicsQueryHit &hit, u64 layer = 18446744073709551615ULL, float max = 3.40282347E+38F) const = 0

Performs a sweep into the scene using a capsule and returns the closest found hit, if any.

capsule
Capsule to sweep through the scene.
rotation
Orientation of the capsule.
unitDir
Unit direction towards which to perform the sweep.
hit
Information recorded about a hit. Only valid if method returns true.
layer
Layers to consider for the query. This allows you to ignore certain groups of objects.
max
Maximum distance at which to perform the query. Hits past this distance will not be detected.

Returns: True if something was hit, false otherwise.

ConvexCast

virtual bool ConvexCast(const HPhysicsMesh &mesh, const Vector3 &position, const Quaternion &rotation, const Vector3 &unitDir, PhysicsQueryHit &hit, u64 layer = 18446744073709551615ULL, float max = 3.40282347E+38F) const = 0

Performs a sweep into the scene using a convex mesh and returns the closest found hit, if any.

mesh
Mesh to sweep through the scene. Must be convex.
position
Starting position of the mesh.
rotation
Orientation of the mesh.
unitDir
Unit direction towards which to perform the sweep.
hit
Information recorded about a hit. Only valid if method returns true.
layer
Layers to consider for the query. This allows you to ignore certain groups of objects.
max
Maximum distance at which to perform the query. Hits past this distance will not be detected.

Returns: True if something was hit, false otherwise.

RayCastAll

virtual Vector<PhysicsQueryHit> RayCastAll(const Ray &ray, u64 layer = 18446744073709551615ULL, float max = 3.40282347E+38F) const

Casts a ray into the scene and returns all found hits.

ray
Ray to cast into the scene.
layer
Layers to consider for the query. This allows you to ignore certain groups of objects.
max
Maximum distance at which to perform the query. Hits past this distance will not be detected.

Returns: List of all detected hits.

RayCastAll

virtual Vector<PhysicsQueryHit> RayCastAll(const Vector3 &origin, const Vector3 &unitDir, u64 layer = 18446744073709551615ULL, float max = 3.40282347E+38F) const = 0

Casts a ray into the scene and returns all found hits.

origin
Origin of the ray to cast into the scene.
unitDir
Unit direction of the ray to cast into the scene.
layer
Layers to consider for the query. This allows you to ignore certain groups of objects.
max
Maximum distance at which to perform the query. Hits past this distance will not be detected.

Returns: List of all detected hits.

BoxCastAll

virtual Vector<PhysicsQueryHit> BoxCastAll(const AABox &box, const Quaternion &rotation, const Vector3 &unitDir, u64 layer = 18446744073709551615ULL, float max = 3.40282347E+38F) const = 0

Performs a sweep into the scene using a box and returns all found hits.

box
Box to sweep through the scene.
rotation
Orientation of the box.
unitDir
Unit direction towards which to perform the sweep.
layer
Layers to consider for the query. This allows you to ignore certain groups of objects.
max
Maximum distance at which to perform the query. Hits past this distance will not be detected.

Returns: List of all detected hits.

SphereCastAll

virtual Vector<PhysicsQueryHit> SphereCastAll(const Sphere &sphere, const Vector3 &unitDir, u64 layer = 18446744073709551615ULL, float max = 3.40282347E+38F) const = 0

Performs a sweep into the scene using a sphere and returns all found hits.

sphere
Sphere to sweep through the scene.
unitDir
Unit direction towards which to perform the sweep.
layer
Layers to consider for the query. This allows you to ignore certain groups of objects.
max
Maximum distance at which to perform the query. Hits past this distance will not be detected.

Returns: List of all detected hits.

CapsuleCastAll

virtual Vector<PhysicsQueryHit> CapsuleCastAll(const Capsule &capsule, const Quaternion &rotation, const Vector3 &unitDir, u64 layer = 18446744073709551615ULL, float max = 3.40282347E+38F) const = 0

Performs a sweep into the scene using a capsule and returns all found hits.

capsule
Capsule to sweep through the scene.
rotation
Orientation of the capsule.
unitDir
Unit direction towards which to perform the sweep.
layer
Layers to consider for the query. This allows you to ignore certain groups of objects.
max
Maximum distance at which to perform the query. Hits past this distance will not be detected.

Returns: List of all detected hits.

ConvexCastAll

virtual Vector<PhysicsQueryHit> ConvexCastAll(const HPhysicsMesh &mesh, const Vector3 &position, const Quaternion &rotation, const Vector3 &unitDir, u64 layer = 18446744073709551615ULL, float max = 3.40282347E+38F) const = 0

Performs a sweep into the scene using a convex mesh and returns all found hits.

mesh
Mesh to sweep through the scene. Must be convex.
position
Starting position of the mesh.
rotation
Orientation of the mesh.
unitDir
Unit direction towards which to perform the sweep.
layer
Layers to consider for the query. This allows you to ignore certain groups of objects.
max
Maximum distance at which to perform the query. Hits past this distance will not be detected.

Returns: List of all detected hits.

RayCastAny

virtual bool RayCastAny(const Ray &ray, u64 layer = 18446744073709551615ULL, float max = 3.40282347E+38F) const

Casts a ray into the scene and checks if it has hit anything.

This can be significantly more efficient than other types of cast* calls.

ray
Ray to cast into the scene.
layer
Layers to consider for the query. This allows you to ignore certain groups of objects.
max
Maximum distance at which to perform the query. Hits past this distance will not be detected.

Returns: True if something was hit, false otherwise.

RayCastAny

virtual bool RayCastAny(const Vector3 &origin, const Vector3 &unitDir, u64 layer = 18446744073709551615ULL, float max = 3.40282347E+38F) const = 0

Casts a ray into the scene and checks if it has hit anything.

This can be significantly more efficient than other types of cast* calls.

origin
Origin of the ray to cast into the scene.
unitDir
Unit direction of the ray to cast into the scene.
layer
Layers to consider for the query. This allows you to ignore certain groups of objects.
max
Maximum distance at which to perform the query. Hits past this distance will not be detected.

Returns: True if something was hit, false otherwise.

BoxCastAny

virtual bool BoxCastAny(const AABox &box, const Quaternion &rotation, const Vector3 &unitDir, u64 layer = 18446744073709551615ULL, float max = 3.40282347E+38F) const = 0

Performs a sweep into the scene using a box and checks if it has hit anything.

This can be significantly more efficient than other types of cast* calls.

box
Box to sweep through the scene.
rotation
Orientation of the box.
unitDir
Unit direction towards which to perform the sweep.
layer
Layers to consider for the query. This allows you to ignore certain groups of objects.
max
Maximum distance at which to perform the query. Hits past this distance will not be detected.

Returns: True if something was hit, false otherwise.

SphereCastAny

virtual bool SphereCastAny(const Sphere &sphere, const Vector3 &unitDir, u64 layer = 18446744073709551615ULL, float max = 3.40282347E+38F) const = 0

Performs a sweep into the scene using a sphere and checks if it has hit anything.

This can be significantly more efficient than other types of cast* calls.

sphere
Sphere to sweep through the scene.
unitDir
Unit direction towards which to perform the sweep.
layer
Layers to consider for the query. This allows you to ignore certain groups of objects.
max
Maximum distance at which to perform the query. Hits past this distance will not be detected.

Returns: True if something was hit, false otherwise.

CapsuleCastAny

virtual bool CapsuleCastAny(const Capsule &capsule, const Quaternion &rotation, const Vector3 &unitDir, u64 layer = 18446744073709551615ULL, float max = 3.40282347E+38F) const = 0

Performs a sweep into the scene using a capsule and checks if it has hit anything.

This can be significantly more efficient than other types of cast* calls.

capsule
Capsule to sweep through the scene.
rotation
Orientation of the capsule.
unitDir
Unit direction towards which to perform the sweep.
layer
Layers to consider for the query. This allows you to ignore certain groups of objects.
max
Maximum distance at which to perform the query. Hits past this distance will not be detected.

Returns: True if something was hit, false otherwise.

ConvexCastAny

virtual bool ConvexCastAny(const HPhysicsMesh &mesh, const Vector3 &position, const Quaternion &rotation, const Vector3 &unitDir, u64 layer = 18446744073709551615ULL, float max = 3.40282347E+38F) const = 0

Performs a sweep into the scene using a convex mesh and checks if it has hit anything.

This can be significantly more efficient than other types of cast* calls.

mesh
Mesh to sweep through the scene. Must be convex.
position
Starting position of the mesh.
rotation
Orientation of the mesh.
unitDir
Unit direction towards which to perform the sweep.
layer
Layers to consider for the query. This allows you to ignore certain groups of objects.
max
Maximum distance at which to perform the query. Hits past this distance will not be detected.

Returns: True if something was hit, false otherwise.

BoxOverlap

virtual Vector<HCollider> BoxOverlap(const AABox &box, const Quaternion &rotation, u64 layer = 18446744073709551615ULL) const

Returns a list of all colliders in the scene that overlap the provided box.

box
Box to check for overlap.
rotation
Orientation of the box.
layer
Layers to consider for the query. This allows you to ignore certain groups of objects.

Returns: List of all colliders that overlap the box.

SphereOverlap

virtual Vector<HCollider> SphereOverlap(const Sphere &sphere, u64 layer = 18446744073709551615ULL) const

Returns a list of all colliders in the scene that overlap the provided sphere.

sphere
Sphere to check for overlap.
layer
Layers to consider for the query. This allows you to ignore certain groups of objects.

Returns: List of all colliders that overlap the sphere.

CapsuleOverlap

virtual Vector<HCollider> CapsuleOverlap(const Capsule &capsule, const Quaternion &rotation, u64 layer = 18446744073709551615ULL) const

Returns a list of all colliders in the scene that overlap the provided capsule.

capsule
Capsule to check for overlap.
rotation
Orientation of the capsule.
layer
Layers to consider for the query. This allows you to ignore certain groups of objects.

Returns: List of all colliders that overlap the capsule.

ConvexOverlap

virtual Vector<HCollider> ConvexOverlap(const HPhysicsMesh &mesh, const Vector3 &position, const Quaternion &rotation, u64 layer = 18446744073709551615ULL) const

Returns a list of all colliders in the scene that overlap the provided convex mesh.

mesh
Mesh to check for overlap. Must be convex.
position
Position of the mesh.
rotation
Orientation of the mesh.
layer
Layers to consider for the query. This allows you to ignore certain groups of objects.

Returns: List of all colliders that overlap the mesh.

BoxOverlapAny

virtual bool BoxOverlapAny(const AABox &box, const Quaternion &rotation, u64 layer = 18446744073709551615ULL) const = 0

Checks if the provided box overlaps any other collider in the scene.

box
Box to check for overlap.
rotation
Orientation of the box.
layer
Layers to consider for the query. This allows you to ignore certain groups of objects.

Returns: True if there is overlap with another object, false otherwise.

SphereOverlapAny

virtual bool SphereOverlapAny(const Sphere &sphere, u64 layer = 18446744073709551615ULL) const = 0

Checks if the provided sphere overlaps any other collider in the scene.

sphere
Sphere to check for overlap.
layer
Layers to consider for the query. This allows you to ignore certain groups of objects.

Returns: True if there is overlap with another object, false otherwise.

CapsuleOverlapAny

virtual bool CapsuleOverlapAny(const Capsule &capsule, const Quaternion &rotation, u64 layer = 18446744073709551615ULL) const = 0

Checks if the provided capsule overlaps any other collider in the scene.

capsule
Capsule to check for overlap.
rotation
Orientation of the capsule.
layer
Layers to consider for the query. This allows you to ignore certain groups of objects.

Returns: True if there is overlap with another object, false otherwise.

ConvexOverlapAny

virtual bool ConvexOverlapAny(const HPhysicsMesh &mesh, const Vector3 &position, const Quaternion &rotation, u64 layer = 18446744073709551615ULL) const = 0

Checks if the provided convex mesh overlaps any other collider in the scene.

mesh
Mesh to check for overlap. Must be convex.
position
Position of the mesh.
rotation
Orientation of the mesh.
layer
Layers to consider for the query. This allows you to ignore certain groups of objects.

Returns: True if there is overlap with another object, false otherwise.

HasFlag

virtual bool HasFlag(PhysicsFlags flag) const

Checks is a specific physics option enabled.

SetFlag

virtual void SetFlag(PhysicsFlags flag, bool enabled)

Enables or disabled a specific physics option.

GetMaxTesselationEdgeLength

virtual float GetMaxTesselationEdgeLength() const = 0

Returns a maximum edge length before a triangle is tesselated.

SetMaxTesselationEdgeLength

virtual void SetMaxTesselationEdgeLength(float length) = 0

Sets a maximum edge length before a triangle is tesselated.

GetGravity

virtual Vector3 GetGravity() const = 0

SetGravity

virtual void SetGravity(const Vector3 &gravity) = 0

Determines the global gravity value for all objects in the scene.

AddBroadPhaseRegion

virtual u32 AddBroadPhaseRegion(const AABox &region) = 0

Adds a new physics region.

Certain physics options require you to set up regions in which physics objects are allowed to be in, and objects outside of these regions will not be handled by physics. You do not need to set up these regions by default.

RemoveBroadPhaseRegion

virtual void RemoveBroadPhaseRegion(u32 handle) = 0

Removes a physics region.

ClearBroadPhaseRegions

virtual void ClearBroadPhaseRegions() = 0

Removes all physics regions.

Internal

Methods

CreateFixedJoint

virtual UPtr<IFixedJointImplementation> CreateFixedJoint(Joint &owner, const FixedJointCreateInformation &createInformation) = 0

Creates a new fixed joint.

CreateDistanceJoint

virtual UPtr<IDistanceJointImplementation> CreateDistanceJoint(Joint &owner, const DistanceJointCreateInformation &createInformation) = 0

Creates a new distance joint.

CreateHingeJoint

virtual UPtr<IHingeJointImplementation> CreateHingeJoint(Joint &owner, const HingeJointCreateInformation &createInformation) = 0

Creates a new hinge joint.

CreateSphericalJoint

virtual UPtr<ISphericalJointImplementation> CreateSphericalJoint(Joint &owner, const SphericalJointCreateInformation &createInformation) = 0

Creates a new spherical joint.

CreateSliderJoint

virtual UPtr<ISliderJointImplementation> CreateSliderJoint(Joint &owner, const SliderJointCreateInformation &createInformation) = 0

Creates a new spherical joint.

CreateD6Joint

virtual UPtr<ID6JointImplementation> CreateD6Joint(Joint &owner, const D6JointCreateInformation &createInformation) = 0

Creates a new D6 joint.

CreateCharacterController

virtual UPtr<ICharacterControllerImplementation> CreateCharacterController(CharacterController &owner, const CharacterControllerCreateInformation &createInformation) = 0

Creates a new character controller.

BoxOverlapInternal

virtual Vector<ColliderShape *> BoxOverlapInternal(const AABox &box, const Quaternion &rotation, u64 layer = 18446744073709551615ULL) const = 0

Returns a list of all colliders in the scene that overlap the provided box.

box
Box to check for overlap.
rotation
Orientation of the box.
layer
Layers to consider for the query. This allows you to ignore certain groups of objects.

Returns: List of all colliders that overlap the box.

SphereOverlapInternal

virtual Vector<ColliderShape *> SphereOverlapInternal(const Sphere &sphere, u64 layer = 18446744073709551615ULL) const = 0

Returns a list of all colliders in the scene that overlap the provided sphere.

sphere
Sphere to check for overlap.
layer
Layers to consider for the query. This allows you to ignore certain groups of objects.

Returns: List of all colliders that overlap the sphere.

CapsuleOverlapInternal

virtual Vector<ColliderShape *> CapsuleOverlapInternal(const Capsule &capsule, const Quaternion &rotation, u64 layer = 18446744073709551615ULL) const = 0

Returns a list of all colliders in the scene that overlap the provided capsule.

capsule
Capsule to check for overlap.
rotation
Orientation of the capsule.
layer
Layers to consider for the query. This allows you to ignore certain groups of objects.

Returns: List of all colliders that overlap the capsule.

ConvexOverlapInternal

virtual Vector<ColliderShape *> ConvexOverlapInternal(const HPhysicsMesh &mesh, const Vector3 &position, const Quaternion &rotation, u64 layer = 18446744073709551615ULL) const = 0

Returns a list of all colliders in the scene that overlap the provided convex mesh.

mesh
Mesh to check for overlap. Must be convex.
position
Position of the mesh.
rotation
Orientation of the mesh.
layer
Layers to consider for the query. This allows you to ignore certain groups of objects.

Returns: List of all colliders that overlap the mesh.

Protected

Constructors

PhysicsScene

PhysicsScene() = default

Methods

~PhysicsScene

virtual ~PhysicsScene() noexcept = default

Fields

mUpdateInProgress

bool mUpdateInProgress

mFlags

PhysicsFlags mFlags