Expand description
Safe Rust API for Jolt Physics 5.6 over the
joltc raw layer in
oxijolt-sys.
A PhysicsWorld owns a Jolt physics system with its collision layers
(CollisionLayers), its job system and temp allocator. Bodies are created from a Shape
and BodySettings and named by a BodyId; one shape may serve many bodies in many worlds.
use oxijolt::prelude::math::*;
use oxijolt::prelude::*;
let mut world = PhysicsWorld::new(WorldSettings::default())?;
let floor_shape = Shape::new_box(Vec3::new(100.0, 1.0, 100.0))?;
let floor = BodySettings::new_static().position(RVec3::new(0.0, -1.0, 0.0));
world.create_body(&floor_shape, &floor)?;
let ball_shape = Shape::new_sphere(0.5)?;
let ball = world.create_body(
&ball_shape,
&BodySettings::new_dynamic().position(RVec3::new(0.0, 2.0, 0.0)),
)?;
for _ in 0..60 {
let report = world.step(1.0 / 60.0)?;
assert!(report.is_complete());
}
assert!(world.body(ball)?.position().y < 2.0);§What a world holds
- Rigid bodies of box, sphere, cylinder, capsule, tapered capsule and cylinder, convex hull,
triangle mesh, heightfield, compound and scaled
Shapes, withPhysicsMaterials that carry the caller’s user data.BodyMutadds impulses, kinematic moves, waking and sleeping, and shape and motion type changes;BodySettingsmakes sensors and sets user data and locked axes (body controls guide). - Scene queries on
&PhysicsWorld:PhysicsWorld::cast_ray,PhysicsWorld::cast_shapeandPhysicsWorld::collide_shape, filtered byQueryFilter. - Virtual characters:
PhysicsWorld::create_character, with a standing humanoid fromCharacterSettings::humanoid. - Wheeled and tracked vehicles and motorcycles on a chassis body:
PhysicsWorld::create_wheeled_vehicle,PhysicsWorld::create_tracked_vehicleandPhysicsWorld::create_motorcycle, with ready settings fromWheeledVehicleSettings::carandMotorcycleSettings::bikeand wheel poses for drawing fromVehicleRef::wheel_world_transform. - Ragdolls:
PhysicsWorld::create_ragdoll. - Constraints of twelve kinds between two bodies:
PhysicsWorld::create_constraint(constraints guide). - Soft bodies:
PhysicsWorld::create_soft_body(soft body guide). - Contact, activation and soft body contact events and a
ContactListener:PhysicsWorld::set_event_settings,PhysicsWorld::take_events(events guide). - Snapshots for rollback:
PhysicsWorld::save_state,PhysicsWorld::restore_state(state guide). - A floating origin:
PhysicsWorld::rebase. - With the
debug-rendererfeature, the colliders’ wireframe as line data (PhysicsWorld::debug_lines); nothing is drawn.
The guide builds a game scene with terrain, queries, a character, a vehicle and a ragdoll.
§Contract
- Errors. A call that returns
Errwas refused and changed nothing, unless its documentation says otherwise. A step that ran but dropped work returnsOk, and itsStepReportsays what was dropped. Code that calls several areas can returnerror::Result;?converts every area error intoerror::Error. - Magnitudes. Positions, extents, velocities, masses and the other inputs
limitsbounds are checked against it before they reach Jolt. Some inputs, such as damping and ray directions, are only checked to be finite. Some bounds are derived from Jolt’s arithmetic (limits doc), some are only tested at the bound, and some cases no bound excludes (coverage). - Threads. Changing a world,
PhysicsWorld::stepincluded, takes&mut PhysicsWorld; reading it takes&PhysicsWorld.PhysicsWorldisSendandSync: many threads may read one world while nobody steps it, and different worlds may step on different threads at the same time. A world runs Jolt’s jobs on Jolt’s thread pool (WorldSettings::worker_threads) or on the caller’s pool through aJobSystem(job system guide). - Determinism. The order of calls, including the order of body creation and removal, is
part of the state. The tests check bit-identical results with 1 and 4 worker threads and
with caller job systems on one machine; results agree across platforms and compilers only
with the
cross-platform-deterministicfeature (determinism).
§Global state
oxijolt calls JPH_Init once per process and never calls JPH_Shutdown. It installs
joltc’s process-global procs once and owns them: the object-layer, body and shape filters,
the contact, body activation and soft body contact listeners (the first time a world records
events), the debug renderer (with debug-renderer, which also serializes debug drawing) and
Jolt’s assertion handler (before JPH_Init). Code that also uses oxijolt-sys directly must
leave them alone; see the notes on the raw API in oxijolt-sys.
With the asserts feature, which compiles Jolt with its debug assertions, a failed assertion
prints its expression, message, file and line to stderr and aborts the process. The only
exception is the physics-update-error assertion, whose condition PhysicsWorld::step
returns in its StepReport.
§Features
Every feature adds to the API except double-precision, which changes Real in every
signature: only the final application enables it, and libraries built on oxijolt forward it.
bindgen is a build switch outside the semver promise.
double-precision: world positions (Real,RVec3) usef64.cross-platform-deterministic: Jolt’s cross-platform deterministic floating point settings.debug-renderer: collider wireframes as line data, see above.asserts: Jolt’s debug assertions, reported as above.bindgen: generates the raw bindings with libclang at build time.glam032:Fromconversions both ways betweenVec3,Quat,RVec3and glam 0.32’sVec3,Quatand vector ofReal(DVec3in double precision).mint:Fromconversions both ways betweenVec3,Quat,RVec3and mint’sVector3<f32>,Quaternion<f32>andVector3<Real>.
The conversions copy the fields: a value converted there and back has the same bits, and nothing is normalized or checked until a call takes the value.
use oxijolt::{BodySettings, PhysicsWorld, Shape, WorldSettings};
let mut world = PhysicsWorld::new(WorldSettings::default())?;
let ball = world.create_body(
&Shape::new_sphere(0.5)?,
&BodySettings::new_dynamic()
.rotation(glam::Quat::from_rotation_y(1.0).into())
.linear_velocity(glam::Vec3::new(1.0, 0.0, 0.0).into()),
)?;
let velocity: glam::Vec3 = world.body(ball)?.linear_velocity().into();
assert_eq!(velocity, glam::Vec3::X);Re-exports§
pub use error::BinaryStateError;pub use error::BodyError;pub use error::CharacterError;pub use error::CollisionGroupError;pub use error::ConstraintError;pub use error::ContactSettingsError;pub use error::ConvexHullError;pub use error::MeshError;pub use error::QueryError;pub use error::RagdollError;pub use error::ShapeError;pub use error::SoftBodyError;pub use error::StateError;pub use error::StepError;pub use error::ThinTrianglesError;pub use error::VehicleError;pub use error::WorldError;
Modules§
- error
- Error types. Every value Jolt only checks with debug assertions is validated before it
reaches Jolt and reported through these; magnitudes follow
crate::limits, which says which assertion paths are derived and which are covered by tests. - limits
- The magnitudes the safe API accepts.
- prelude
- The types most programs use, for
use oxijolt::prelude::*.
Structs§
- Allowed
Dofs - The degrees of freedom a body may move in: translation along and rotation about the world
axes (Jolt
EAllowedDOFs), set at creation withBodySettings::allowed_dofs. - AnyConstraint
Id - A constraint id of any kind, for listing and removing constraints.
- AnyVehicle
Id - A vehicle id of any kind, for listing and removing vehicles.
- BodyId
- Identifies a body in the world that created it.
- BodyMut
- Read and write access to one body, borrowed mutably from its world.
- Body
Pose - The pose of one awake body, as returned by
PhysicsWorld::active_body_poses. - BodyRef
- Read access to one body, borrowed from its world.
- Body
Settings - How to create a body. Build it from
new_dynamic,new_kinematicornew_staticand the setters. - Body
Velocity - The velocity of a body as a character sees it, in
CharacterContactListener::adjust_body_velocity. - Broad
Phase Layer - A broad-phase layer: one of the trees the broad phase sorts bodies into.
- Buoyancy
Settings - A fluid for
BodyMut::apply_buoyancy_impulse: its surface, how strongly it lifts and how it drags. The defaults are Jolt’s suggestions (Body.h): surface through the origin with normal +Y, buoyancy 1, linear drag 0.5, angular drag 0.01, still water. - Character
Contact - A contact of a character after its last update or contact refresh (Jolt
CharacterVirtual::Contact). - Character
Contact Key - What a removed character contact touched (Jolt
CharacterContactListener::OnContactRemovedandOnCharacterContactRemoved). - Character
Contact Settings - How a character and what it touches push each other (Jolt
CharacterContactSettings). - Character
Id - Identifies a character in the world that created it.
- Character
Mut - Write access to one character, borrowed mutably from its world.
- Character
Ref - Read access to one character, borrowed from its world.
- Character
Settings - How to create a character, for
PhysicsWorld::create_character. Build it withnewand the setters. - Character
State - The persistent state of a character, from
CharacterRef::save_state, to continue a run bit for bit withCharacterMut::restore_state. - Collide
Point Hit - One body whose shape contains the point of a
PhysicsWorld::collide_point. - Collide
Shape - A shape placed at a pose, for
PhysicsWorld::collide_shape. - Collide
Shape Hit - One obstacle a
PhysicsWorld::collide_shapefound. - Collision
Estimate - What Jolt estimates a new contact does to its two bodies, before the solver runs (Jolt
EstimateCollisionResponse), fromContactEvent::AddedwhenEventSettings::collision_estimatesis on. - Collision
Group - The collision group of a body (Jolt
CollisionGroup): a group id and a sub group of aGroupFilterTable. - Collision
Layers - The collision layer setup of a world: object layers, the broad-phase layer of each, and the pairs of object layers that collide.
- Compound
Child - One child of a compound shape, for
Shape::new_compound. - Compound
SubShape - The compound child a
SubShapeIdleads to, fromShape::compound_sub_shapeorPhysicsWorld::compound_sub_shape. - Cone
Constraint Settings - A cone constraint (Jolt
ConeConstraintSettings): a ball joint whose body 2 twist axis stays within a cone of half anglehalf_cone_anglearound body 1’s; the twist about it is free. - Constraint
Id - Identifies a constraint of kind
Kin the world that created it. - Constraint
Mut - Write access to one constraint, borrowed mutably from its world.
- Constraint
Ref - Read access to one constraint, borrowed from its world.
- Contact
Candidate - A hit Jolt asks a
ContactListenerto accept (JoltCollideShapeResultinOnContactValidate), before it becomes a contact. - Contact
Manifold - The contact between two sub-shapes in one step (Jolt
ContactManifold). - Contact
Point - One contact point, as a point on each body’s surface, in world space (metres).
- Contact
Settings - How Jolt resolves a contact (Jolt
ContactSettings), with its values for this contact. - Contact
Settings Rejection - Contact settings a
ContactListenerreturned that do not fit the contact it was called for, such as a value kept from another contact (seeContactSettings). Jolt resolved the contact with its own settings. - Debug
Line - One line segment of a collider’s wireframe, in world space.
- Debug
Line Settings - Which colliders
PhysicsWorld::debug_linesdraws and how many lines it keeps. - Debug
Lines - A buffer of debug lines, returned by
PhysicsWorld::debug_linesor refilled byPhysicsWorld::debug_lines_into. - Distance
Constraint Settings - A distance constraint (Jolt
DistanceConstraintSettings): keeps the distance between a point of body 1 and a point of body 2 within a range; the bodies rotate freely. - Driver
Input - What the driver asks of a wheeled vehicle or a motorcycle (Jolt
WheeledVehicleController::SetDriverInput). - Dropped
Triangles - The triangles
Shape::new_meshleft out because they are too small or too thin for Jolt to collide with reliably (degenerate triangles among them). - Event
Settings - Which events a
PhysicsWorldrecords. The default records nothing. - Extended
Update Settings - What an update does besides moving the character, for
PhysicsWorld::update_character(JoltCharacterVirtual::ExtendedUpdateSettings). The defaults are Jolt’s. - Fixed
Constraint Settings - A fixed constraint (Jolt
FixedConstraintSettings): body 2 keeps its position and rotation relative to body 1, as if the two were welded. - Gear
Constraint Settings - A gear (Jolt
GearConstraintSettings): body 1 turning about its hinge axis turns body 2 about its own:ω1 + ratio · ω2 = 0for the rotation rates about the two axes, so a ratio of 2 turns gear 2 half as fast, the other way. The bodies need their own hinges, which hold them in place, and both must be dynamic (ConstraintError::NotDynamic). - Group
Filter Table - Which sub groups of a collision group collide with each other (Jolt
GroupFilterTable), built with aGroupFilterTableBuilderand fixed from then on. Cloning shares the table. - Group
Filter Table Builder - Builds a
GroupFilterTable: which of its sub groups collide with each other. - Height
Field Settings - Settings of
Shape::new_height_fieldother than the samples. The defaults are Jolt’s (HeightFieldShapeSettings): no materials, no offset, unit scale, block size 2, 8 bits per sample and an active-edge threshold of 5 degrees. - Hermite
Path - A planar Hermite path (Jolt
PathConstraintPathHermite) for aPathConstraintSettings: cubic Hermite segments through the points, one plane normal for all of them. Fractioniis pointi; a looping path also joins the last point back to the first. - Hermite
Path Point - One point of a
HermitePath: a position and the curve’s tangent there, in path space. The tangent’s length is the speed of the curve parameter, not only its direction. - Hinge
Constraint Settings - A hinge (Jolt
HingeConstraintSettings), the usual elbow or knee joint: body 2 rotates about the hinge axis by an angle in[limits_min, limits_max], measured from the pose where both normal axes coincide. - Inner
Body - The optional kinematic body a character carries, so that bodies collide with it and queries
find it (Jolt
CharacterVirtualSettings::mInnerBodyShape). - Job
- One Jolt job handed to a
JobSystem. - Joint
Transform - The rigid transform of one skeleton joint. In a
SkeletonPoseit is the joint’s translation relative to the pose’s root offset and its world rotation; in a local pose (the animation poseSkeletonMapper::maptakes) it is relative to the parent joint. - Mapped
Skeleton - One skeleton of a
SkeletonMapperwith its neutral pose. - Mesh
Settings - Settings of
Shape::new_mesh_with_settingsother than the geometry. The defaults are Jolt’s (MeshShapeSettings): no materials, an active-edge threshold of 5 degrees, 8 triangles per leaf,MeshBuildQuality::FavorRuntimePerformance; and convex shapes up toMeshSettings::DEFAULT_MAX_CONVEX_EXTENT. - Motor
Settings - A constraint motor (Jolt
MotorSettings): the spring that drives it to its target and the force and torque it may use. The defaults are Jolt’s: frequency 2 Hz, damping 1, and unlimited (∓f32::MAX) force and torque. - Motorcycle
Lean - A motorcycle’s lean after the last step.
- Motorcycle
Settings - The settings of a motorcycle (Jolt
VehicleConstraintSettingswith aMotorcycleControllerSettings): a wheeled vehicle of exactly two wheels, front and rear along the vehicle’s forward, with a lean controller that tilts the chassis into turns. The defaults are Jolt’s. - Mutable
Compound - A compound shape edited at run time: children are added, removed, moved and replaced, and
to_shapepublishes the current children as a new, immutableShape. - Object
Layer - The object layer of a body: which other bodies it can collide with.
- Path
Constraint Settings - A path constraint (Jolt
PathConstraintSettings): body 2 slides along aHermitePathfixed to body 1, with friction, a position motor along the path and a choice of rotation constraint. - Physics
Material - A surface identity for shapes: a Jolt physics material that carries a
u64of the caller’s. - Physics
World - A Jolt physics system with its collision layers, its own job system and temp allocator.
- Point
Constraint Settings - A point constraint (Jolt
PointConstraintSettings): a ball joint that keeps a point of body 1 on a point of body 2 and leaves the rotation free. - Pulley
Constraint Settings - A pulley (Jolt
PulleyConstraintSettings): a rope from a point on body 1 over a fixed world point and a second fixed world point to a point on body 2, so thatlength1 + ratio · length2stays within the allowedPulleyLength. A ratio of 2 makes body 2 move half as far as body 1, a block and tackle. - Quat
- A rotation quaternion
(x, y, z, w)withwthe scalar part. Jolt expects unit length. - Query
Filter - Selects the bodies and compound children a scene query considers. The default accepts everything.
- RVec3
- A world-space position. Its components are
Real:f64with thedouble-precisionfeature,f32otherwise. - Rack
AndPinion Constraint Settings - A rack and pinion (Jolt
RackAndPinionConstraintSettings): body 1, the pinion, turning about its hinge axis moves body 2, the rack, along its slider axis withrotation = ratio · translation(radians per metre). The bodies need their own hinge and slider, and both must be dynamic (ConstraintError::NotDynamic). - Ragdoll
Id - Identifies a ragdoll in the world that created it.
- Ragdoll
Mut - Write access to one ragdoll, borrowed mutably from its world.
- Ragdoll
Part - One part of a ragdoll: a body for one skeleton joint and the joint to its parent part.
- Ragdoll
Ref - Read access to one ragdoll, borrowed from its world.
- Ragdoll
Settings - The settings of a ragdoll (Jolt
RagdollSettings): a skeleton, one body per joint and the constraints between them. - RayCast
- A ray from
originalongdirection(JoltRRayCast). The direction’s length is the ray’s length; hits report the fraction along it, in[0, 1]. - RayCast
Hit - The closest hit of a
PhysicsWorld::cast_ray. - Settle
Detector - Counts consecutive calm updates of a ragdoll and reports when it has settled.
- Shape
- A collision shape that bodies are created from.
- Shape
Cast - A shape moved from
positionalongdirection, forPhysicsWorld::cast_shape. - Shape
Cast Hit - The closest hit of a
PhysicsWorld::cast_shape. - SixDof
Constraint Settings - A six-degree-of-freedom constraint (Jolt
SixDOFConstraintSettings): each translation and rotation axis of the constraint frame is free, fixed or limited on its own. WithSwingType::Pyramidthe two swing ranges may be asymmetric, which suits hips. - Skeleton
- A skeleton (Jolt
Skeleton): named joints in a tree, parents before children, joint 0 the root. A ragdoll has one part per joint. - Skeleton
Joint - One joint of a
Skeleton: its name and the index of its parent joint. - Skeleton
Mapper - Jolt’s
SkeletonMapper: maps poses between a ragdoll skeleton and a more detailed animation skeleton of the same character. - Skeleton
Pose - A pose of every joint of a skeleton in model space, in joint order (Jolt
Ragdoll::SetPoseandGetPose, and the poses of aSkeletonMapper). - Slider
Constraint Settings - A slider (Jolt
SliderConstraintSettings): body 2 moves along the slider axis of body 1 and keeps its rotation relative to body 1. The position along the axis is 0 where both frame points coincide. - Soft
Body Contact Settings - How Jolt resolves the contacts between a soft body and another body (Jolt
SoftBodyContactSettings). - Soft
Body Contacts - The contacts of one soft body in one step (Jolt
OnSoftBodyContactAdded). - Soft
Body Dihedral Bend - A dihedral bend constraint the caller adds explicitly (Jolt
SoftBodySharedSettings::DihedralBend): keeps the angle between two triangles that share an edge at its rest angle. - Soft
Body Edge - An edge constraint the caller adds explicitly (Jolt
SoftBodySharedSettings::Edge): keeps two vertices at their rest distance, measured when the settings are built. - Soft
Body Mut - Read and write access to the vertices of one soft body, borrowed mutably from its world.
- Soft
Body Ref - Read access to the vertices of one soft body, borrowed from its world.
- Soft
Body Settings - How to create a soft body from
SoftBodySharedSettings. - Soft
Body Shared Settings - The particles of a soft body and the constraints between them (Jolt
SoftBodySharedSettings), built and checked bySoftBodySharedSettings::builder. - Soft
Body Shared Settings Builder - Collects the vertices, faces and constraints of
SoftBodySharedSettings; made bySoftBodySharedSettings::builder. - Soft
Body Validation - A soft body’s bounding box overlapped another body’s in a step (Jolt
OnSoftBodyContactValidate). It says nothing about whether a vertex touched the body. Jolt may report one pair twice in a step: once in the soft body’s own collision pass and once while the other body moves with continuous collision detection. - Soft
Body Vertex - One particle of a soft body as
SoftBodySharedSettingsdescribe it. - Soft
Body Vertex Attributes - How
SoftBodySharedSettingsBuilder::create_constraintsbuilds the constraints at a vertex (JoltSoftBodySharedSettings::VertexAttributes). - Soft
Body Vertex Contact - One vertex of a soft body touching another body in a step.
- Soft
Body Vertex State - One vertex of a soft body in the world, as
SoftBodyRef::verticesreads it. - Soft
Body Volume - A volume constraint the caller adds explicitly (Jolt
SoftBodySharedSettings::Volume): keeps the volume of a tetrahedron at its rest volume. - Step
Report - What a
PhysicsWorld::stepthat ran reports. The world has advanced either way. - SubShape
Id - Jolt’s
SubShapeID: the path from a body’s root shape to the leaf shape that was hit (a compound child, a heightfield triangle). - SubShape
IdPair - The two sides of a contact: each body with the sub-shape (compound child, heightfield
triangle) that touches. Jolt orders the sides so that
body1has the lower id (BodyId::to_raw). - Swing
Twist Constraint Settings - A swing-twist constraint (Jolt
SwingTwistConstraintSettings), the usual shoulder, neck or spine joint: body 2 twists about the twist axis within[twist_min, twist_max], and the twist axis swings away from body 1’s within a cone (or pyramid) of half anglesnormal(about the normal axis,twist × plane) andplane(about the plane axis). - Track
State - The state of a track after the last step.
- Tracked
Driver Input - What the driver asks of a tracked vehicle (Jolt
TrackedVehicleController::SetDriverInput). - Tracked
Vehicle Settings - The settings of a tracked vehicle such as a tank (Jolt
VehicleConstraintSettingswith aTrackedVehicleControllerSettings). - Tracked
Wheel Settings - One wheel of a tracked vehicle (Jolt
WheelSettingsandWheelSettingsTV). The wheel turns with its track; its suspension and size work as forWheelSettings, whose methods of the same names state the rules. Positions and directions are in the chassis body’s local space, lengths in metres. The defaults are Jolt’s. - Vec3
- A 3D vector of
f32, used for directions, velocities, forces and extents. - Vehicle
Anti Roll Bar - An anti-roll bar between two wheels (Jolt
VehicleAntiRollBar): pushes the less compressed suspension down when the other is compressed more. - Vehicle
Differential Settings - A differential: how engine torque reaches a pair of wheels (Jolt
VehicleDifferentialSettings). The defaults are Jolt’s. - Vehicle
Engine Settings - The engine of a vehicle (Jolt
VehicleEngineSettings). The defaults are Jolt’s wheeled vehicle defaults;TrackedVehicleSettings::default_enginegives the tracked ones. - Vehicle
Id - Identifies a vehicle of kind
Kin the world that created it. - Vehicle
Mut - Write access to one vehicle of kind
K, borrowed mutably from its world. - Vehicle
Ref - Read access to one vehicle of kind
K, borrowed from its world. - Vehicle
Track Settings - One track of a tracked vehicle (Jolt
VehicleTrackSettings): the wheels it runs over and how the drivetrain turns it. The defaults are Jolt’s. - Vehicle
Transmission Settings - The automatic transmission of a vehicle (Jolt
VehicleTransmissionSettingsinETransmissionMode::Auto; the manual mode is not offered). The defaults are Jolt’s wheeled vehicle defaults;TrackedVehicleSettings::default_transmissiongives the tracked ones. - Wheel
Contact - Where a wheel touches the ground.
- Wheel
Settings - One wheel of a wheeled vehicle or a motorcycle (Jolt
WheelSettingsandWheelSettingsWV). Positions and directions are in the chassis body’s local space, lengths in metres. The defaults are Jolt’s. - Wheel
State - The state of one wheel after the last step.
- Wheeled
Vehicle Settings - The settings of a wheeled vehicle (Jolt
VehicleConstraintSettingswith aWheeledVehicleControllerSettings). - World
Events - The events a world recorded, in recording order across steps; see
PhysicsWorld::take_events. - World
Settings - Settings for
PhysicsWorld::new. The defaults are Jolt’s and joltc’s. - World
State - A world’s simulation state at one moment, from
PhysicsWorld::save_state,PhysicsWorld::save_state_oforPhysicsWorld::save_state_into, to go back to withPhysicsWorld::restore_state.
Enums§
- Activation
- Whether an operation wakes the body.
- Activation
Event - A body woke up or fell asleep.
- Body
Selection - Which bodies
PhysicsWorld::save_state_ofandPhysicsWorld::save_state_intosave, and which bodiesPhysicsWorld::restore_state_ofrestores. - Cone
Constraint - A cone constraint (Jolt
ConeConstraint): a ball joint whose twist axis stays in a cone. - Constraint
Space - The space a constraint’s frames are given in (Jolt
EConstraintSpace). - Constraint
Type - The kinds of constraint a world can hold.
- Contact
Event - A change of a rigid body contact in a step.
- Distance
Constraint - A distance constraint (Jolt
DistanceConstraint): a rod or rope between two points. - Distance
Range - The allowed distance range of a
DistanceConstraintSettings. - Fixed
Constraint - A fixed constraint (Jolt
FixedConstraint): the bodies move as one. - Gear
Constraint - A gear (Jolt
GearConstraint): couples the rotation of two bodies. - Ground
State - How a character stands, from its last update (Jolt
CharacterBase::EGroundState). - Hinge
Constraint - A hinge (Jolt
HingeConstraint). - Joint
Reading - What a joint reads now, in its constraint space.
- Long
Range Attachment - Which long range attachment (LRA) constraint ties a movable vertex to the closest kinematic
vertex (Jolt
SoftBodySharedSettings::ELRAType). An LRA constraint keeps the vertex within its rest distance from that kinematic vertex times a multiplier, so a hanging cloth does not stretch under its own weight. The anchors are chosen when the settings are built. - Mesh
Build Quality - How Jolt builds a mesh’s bounding volume tree (Jolt
MeshShapeSettings::EBuildQuality). - Motion
Quality - How Jolt integrates a moving body.
- Motion
Type - How a body moves.
- Motor
State - The state of a constraint motor (Jolt
EMotorState). - Motorcycle
- A two-wheeled motorcycle that leans into turns.
- Path
Constraint - A path constraint (Jolt
PathConstraint): body 2 moves along a path fixed to body 1. - Path
Rotation Constraint - How a path constraint constrains the rotation of body 2 (Jolt
EPathRotationConstraintType). - Point
Constraint - A point constraint (Jolt
PointConstraint): a ball joint. - Pulley
Constraint - A pulley (Jolt
PulleyConstraint): a rope over two fixed points. - Pulley
Length - The allowed rope length of a
PulleyConstraintSettings: the length is|fixed_point1 - body_point1| + ratio · |fixed_point2 - body_point2|. - Rack
AndPinion Constraint - A rack and pinion (Jolt
RackAndPinionConstraint): couples a rotation and a translation. - Ragdoll
Joint - The constraint that joins a ragdoll part to its parent part.
- SixDof
Axis - How one axis of a six-degree-of-freedom constraint may move.
- SixDof
Constraint - A six-degree-of-freedom constraint (Jolt
SixDOFConstraint). - SixDof
Constraint Axis - One axis of a six-degree-of-freedom constraint (Jolt
SixDOFConstraintSettings::EAxis). Translations are along, rotations about, the axes of the constraint frame: X is the twist axis, Y and Z the swing axes. - Slider
Constraint - A slider (Jolt
SliderConstraint): translation along one axis. - Soft
Body Bend Type - Which bend constraints
SoftBodySharedSettingsBuilder::create_constraintscreates between two faces that share an edge (JoltSoftBodySharedSettings::EBendType). - Soft
Body Validate Result - Whether Jolt processes the contacts between a soft body and another body.
- Spring
Settings - A spring (Jolt
SpringSettings). A limit spring with frequency or stiffness 0 is rigid; a position motor whose spring has frequency or stiffness 0 does nothing (Jolt deactivates it). The default is rigid: frequency 0, damping 0. - Swing
Twist Constraint - A swing-twist constraint (Jolt
SwingTwistConstraint). - Swing
Type - How the two swing limits combine (Jolt
ESwingType). - Track
Side - One of a tracked vehicle’s two tracks.
- Tracked
Vehicle - A tracked vehicle such as a tank.
- Translation
Locks - Which animation joints
SkeletonMapper::mapkeeps at their neutral offset from their parent (JoltLockTranslations). Joint constraints stretch a little under load; a lock hides that stretch in the animation pose, which then differs from the simulated bodies. - Validate
Result - What a
ContactListeneranswers for aContactCandidate(JoltValidateResult). - Vehicle
Collision Tester - How the wheels find the ground (Jolt’s
VehicleCollisionTesterkinds). Each wheel casts along its suspension from its attachment point at the start of every step. - Vehicle
Type - The kinds of vehicle a world can hold.
- Wheeled
Vehicle - A wheeled vehicle, created with
PhysicsWorld::create_wheeled_vehicle.
Traits§
- Character
Contact Listener - Changes how characters touch bodies and each other (Jolt
CharacterContactListener); seePhysicsWorld::set_character_contact_listener. - Constraint
Kind - A kind of world constraint, named by the zero-sized markers such as
HingeConstraint. It selects the methods ofConstraintRefandConstraintMut. - Constraint
Settings - Settings a world constraint is created from with
PhysicsWorld::create_constraint. - Contact
Listener - Changes how Jolt resolves contacts while a world steps; see
PhysicsWorld::set_contact_listener. - JobSystem
- A thread pool that runs Jolt’s jobs for a world, set with
WorldSettings::job_system, for example Rayon or a game’s own pool. Without it a world runs its jobs on Jolt’s thread pool (WorldSettings::worker_threads). - Vehicle
Kind - A kind of vehicle, named by the markers
WheeledVehicle,TrackedVehicleandMotorcycle. It selects the methods ofVehicleRefandVehicleMut.
Type Aliases§
- Real
- Scalar type of world positions:
f64with thedouble-precisionfeature,f32otherwise. Scalar type of world positions:f64with thedouble-precisionfeature,f32otherwise.