Optional
rawIntegrationParameters: RawIntegrationParametersOptional
rawIslands: RawIslandManagerOptional
rawBroadPhase: RawBroadPhaseOptional
rawNarrowPhase: RawNarrowPhaseOptional
rawBodies: RawRigidBodySetOptional
rawColliders: RawColliderSetOptional
rawImpulseJoints: RawImpulseJointSetOptional
rawMultibodyJoints: RawMultibodyJointSetOptional
rawCCDSolver: RawCCDSolverOptional
rawQueryPipeline: RawQueryPipelineOptional
rawPhysicsPipeline: RawPhysicsPipelineOptional
rawSerializationPipeline: RawSerializationPipelineOptional
rawDebugRenderPipeline: RawDebugRenderPipelineThe approximate size of most dynamic objects in the scene.
See the documentation of the World.lengthUnit
setter for further details.
The approximate size of most dynamic objects in the scene.
This value is used internally to estimate some length-based tolerance. In particular, the
values IntegrationParameters.allowedLinearError
,
IntegrationParameters.maxPenetrationCorrection
,
IntegrationParameters.predictionDistance
, RigidBodyActivation.linearThreshold
are scaled by this value implicitly.
This value can be understood as the number of units-per-meter in your physical world compared
to a human-sized world in meter. For example, in a 2d game, if your typical object size is 100
pixels, set the [
Self::length_unit]
parameter to 100.0. The physics engine will interpret
it as if 100 pixels is equivalent to 1 meter in its various internal threshold.
(default 1.0
).
Number of addition friction resolution iteration run during the last solver sub-step (default: 4
).
Sets the number of addition friction resolution iteration run during the last solver sub-step (default: 4
).
The greater this value is, the most realistic friction will be. However a greater number of iterations is more computationally intensive.
The new number of additional friction iterations.
Number of internal Project Gauss Seidel (PGS) iterations run at each solver iteration (default: 1
).
Sets the Number of internal Project Gauss Seidel (PGS) iterations run at each solver iteration (default: 1
).
Increasing this parameter will improve stability of the simulation. It will have a lesser effect than
increasing numSolverIterations
but is also less computationally expensive.
The new number of internal PGS iterations.
The number of solver iterations run by the constraints solver for calculating forces (default: 4
).
Sets the number of solver iterations run by the constraints solver for calculating forces (default: 4
).
The greater this value is, the most rigid and realistic the physics simulation will be. However a greater number of iterations is more computationally intensive.
The new number of solver iterations.
The current simulation timestep.
Sets the new simulation timestep.
The simulation timestep governs by how much the physics state of the world will be integrated. A simulation timestep should:
The timestep length, in seconds.
Find the closest intersection between a ray and the physics world.
The ray to cast.
The maximum time-of-impact that can be reported by this cast. This effectively
limits the length of the ray to ray.dir.norm() * maxToi
.
If false
then the ray will attempt to hit the boundary of a shape, even if its
origin already lies inside of a shape. In other terms, true
implies that all shapes are plain,
whereas false
implies that all shapes are hollow for this ray-cast.
Optional
filterFlags: QueryFilterFlagsOptional
filterGroups: numberOptional
filterExcludeCollider: ColliderOptional
filterExcludeRigidBody: RigidBodyOptional
filterPredicate: ((collider: Collider) => boolean)Find the closest intersection between a ray and the physics world.
This also computes the normal at the hit point.
The ray to cast.
The maximum time-of-impact that can be reported by this cast. This effectively
limits the length of the ray to ray.dir.norm() * maxToi
.
If false
then the ray will attempt to hit the boundary of a shape, even if its
origin already lies inside of a shape. In other terms, true
implies that all shapes are plain,
whereas false
implies that all shapes are hollow for this ray-cast.
Optional
filterFlags: QueryFilterFlagsOptional
filterGroups: numberOptional
filterExcludeCollider: ColliderOptional
filterExcludeRigidBody: RigidBodyOptional
filterPredicate: ((collider: Collider) => boolean)Casts a shape at a constant linear velocity and retrieve the first collider it hits. This is similar to ray-casting except that we are casting a whole shape instead of just a point (the ray origin).
The initial position of the shape to cast.
The initial rotation of the shape to cast.
The constant velocity of the shape to cast (i.e. the cast direction).
The shape to cast.
− If the shape moves closer to this distance from a collider, a hit will be returned.
The maximum time-of-impact that can be reported by this cast. This effectively
limits the distance traveled by the shape to shapeVel.norm() * maxToi
.
If set to false
, the linear shape-cast won’t immediately stop if
the shape is penetrating another shape at its starting point and its trajectory is such
that it’s on a path to exist that penetration state.
Optional
filterFlags: QueryFilterFlagsOptional
filterGroups: numberOptional
filterExcludeCollider: ColliderOptional
filterExcludeRigidBody: RigidBodyOptional
filterPredicate: ((collider: Collider) => boolean)Finds the handles of all the colliders with an AABB intersecting the given AABB.
Iterates through all the contact manifolds between the given pair of colliders.
The first collider involved in the contact.
The second collider involved in the contact.
Closure that will be called on each contact manifold between the two colliders. If the second argument
passed to this closure is true
, then the contact manifold data is flipped, i.e., methods like localNormal1
actually apply to the collider2
and fields like localNormal2
apply to the collider1
.
Creates a new character controller.
The artificial gap added between the character’s chape and its environment.
Creates a new collider.
The description of the collider.
Optional
parent: RigidBodyThe rigid-body this collider is attached to.
Creates a new impulse joint from the given joint descriptor.
Creates a new multibody joint from the given joint descriptor.
Creates a new rigid-body from the given rigid-body descriptor.
The description of the rigid-body to create.
Computes all the lines (and their colors) needed to render the scene.
Applies the given closure to each active rigid-body managed by this physics world.
After a short time of inactivity, a rigid-body is automatically deactivated ("asleep") by the physics engine in order to save computational power. A sleeping rigid-body never moves unless it is moved manually by the user.
Retrieves an impulse joint from its handle.
The integer handle of the impulse joint to retrieve.
Retrieves an multibody joint from its handle.
The integer handle of the multibody joint to retrieve.
Gets the handle of up to one collider intersecting the given shape.
The position of the shape used for the intersection test.
The orientation of the shape used for the intersection test.
The shape used for the intersection test.
Optional
filterFlags: QueryFilterFlagsOptional
filterGroups: numberOptional
filterExcludeCollider: ColliderOptional
filterExcludeRigidBody: RigidBodyOptional
filterPredicate: ((collider: Collider) => boolean)Find all the colliders containing the given point.
The point used for the containment test.
A function called with the handles of each collider with a shape
containing the point
.
Optional
filterFlags: QueryFilterFlagsOptional
filterGroups: numberOptional
filterExcludeCollider: ColliderOptional
filterExcludeRigidBody: RigidBodyOptional
filterPredicate: ((collider: Collider) => boolean)Cast a ray and collects all the intersections between a ray and the scene.
The ray to cast.
The maximum time-of-impact that can be reported by this cast. This effectively
limits the length of the ray to ray.dir.norm() * maxToi
.
If false
then the ray will attempt to hit the boundary of a shape, even if its
origin already lies inside of a shape. In other terms, true
implies that all shapes are plain,
whereas false
implies that all shapes are hollow for this ray-cast.
The callback called once per hit (in no particular order) between a ray and a collider.
If this callback returns false
, then the cast will stop and no further hits will be detected/reported.
Optional
filterFlags: QueryFilterFlagsOptional
filterGroups: numberOptional
filterExcludeCollider: ColliderOptional
filterExcludeRigidBody: RigidBodyOptional
filterPredicate: ((collider: Collider) => boolean)Retrieve all the colliders intersecting the given shape.
The position of the shape to test.
The orientation of the shape to test.
The shape to test.
A function called with the handles of each collider intersecting the shape
.
Optional
filterFlags: QueryFilterFlagsOptional
filterGroups: numberOptional
filterExcludeCollider: ColliderOptional
filterExcludeRigidBody: RigidBodyOptional
filterPredicate: ((collider: Collider) => boolean)Find the projection of a point on the closest collider.
The point to project.
If this is set to true
then the collider shapes are considered to
be plain (if the point is located inside of a plain shape, its projection is the point
itself). If it is set to false
the collider shapes are considered to be hollow
(if the point is located inside of an hollow shape, it is projected on the shape's
boundary).
Optional
filterFlags: QueryFilterFlagsOptional
filterGroups: numberOptional
filterExcludeCollider: ColliderOptional
filterExcludeRigidBody: RigidBodyOptional
filterPredicate: ((collider: Collider) => boolean)Find the projection of a point on the closest collider.
The point to project.
Optional
filterFlags: QueryFilterFlagsOptional
filterGroups: numberOptional
filterExcludeCollider: ColliderOptional
filterExcludeRigidBody: RigidBodyOptional
filterPredicate: ((collider: Collider) => boolean)Update colliders positions after rigid-bodies moved.
When a rigid-body moves, the positions of the colliders attached to it need to be updated. This update is generally automatically done at the beginning and the end of each simulation step with World.step. If the positions need to be updated without running a simulation step this method can be called manually.
Removes a character controller from this world.
The character controller to remove.
Removes the given impulse joint from this physics world.
The impulse joint to remove.
If set to true
, the rigid-bodies attached by this joint will be awaken.
Removes the given multibody joint from this physics world.
The multibody joint to remove.
If set to true
, the rigid-bodies attached by this joint will be awaken.
Removes the given rigid-body from this physics world.
This will remove this rigid-body as well as all its attached colliders and joints. Every other bodies touching or attached by joints to this rigid-body will be woken-up.
The rigid-body to remove.
Advance the simulation by one time step.
All events generated by the physics engine are ignored.
Optional
eventQueue: EventQueueOptional
hooks: PhysicsHooksStatic
fromStatic
restoreGenerated using TypeDoc
The physics world.
This contains all the data-structures necessary for creating and simulating bodies with contacts, joints, and external forces.