Overview
Bezel provides a backend-agnostic interface for rigid bodies, colliders, joint constraints, and vehicle simulation. WhenBEZEL_NATIVE is not defined, this implementation is backed by Jolt Physics.
This is an alpha API and may change in future versions. Most users should use the high-level Atlas Physics API instead.
Core Types
PhysicsWorld
Physics world owning the backend simulation state.Methods
Initializes the backend physics system.
Advances the physics simulation by dt seconds.Parameters:
dt(float): Delta time in seconds
Adds a rigidbody to the simulation.Parameters:
body(std::shared_ptr<bezel::Rigidbody>): Rigidbody to add
Sets the global gravity vector.Parameters:
gravity(Position3d): Gravity acceleration vector
Performs a raycast query.Parameters:
origin(Position3d): Ray origindirection(Position3d): Ray directionmaxDistance(float): Maximum ray distanceignoreBodyId(uint32_t): Optional body ID to ignore
Performs a raycast returning all hits.Parameters: Same as
raycastTests if a collider overlaps with any bodies.Parameters:
world(std::shared_ptr<PhysicsWorld>): World referencecollider(std::shared_ptr<Collider>): Collider to testposition(Position3d): Test positionrotation(Rotation3d): Test rotationignoreBodyId(uint32_t): Optional body ID to ignore
Performs a sweep (moving cast) to predict movement.Parameters:
world(std::shared_ptr<PhysicsWorld>): World referencecollider(std::shared_ptr<Collider>): Collider to sweepstartPosition(Position3d): Start positionstartRotation(Rotation3d): Start rotationdirection(Position3d): Movement directionendPosition(Position3d&): End position outputignoreBodyId(uint32_t): Optional body ID to ignore
Performs a sweep returning all hits.Parameters: Same as
sweepRigidbody
Backend rigid body representation used by Atlas components.Properties
World-space position of the rigidbody.
World-space rotation (Euler angles).
World-space rotation (quaternion).
Mass in kilograms. Default: 0.0
Friction coefficient. Default: 0.5
Restitution (bounciness) coefficient. Default: 0.0
Whether this is a sensor (trigger). Default: false
Signal emitted by sensor on contact.
Linear velocity vector.
Angular velocity vector.
Maximum linear velocity cap.
Maximum angular velocity cap.
Linear damping coefficient. Default: 0.05
Angular damping coefficient. Default: 0.1
Collision shape attached to this rigidbody.
Motion type (Static, Dynamic, or Kinematic).
Tags for filtering and logic.
Methods
Creates the rigidbody in the physics world.Parameters:
world(std::shared_ptr<PhysicsWorld>): Physics world
Removes the rigidbody from the physics world.Parameters:
world(std::shared_ptr<PhysicsWorld>): Physics world
Sets the body’s world position and updates the backend.Parameters:
position(Position3d): New positionworld(std::shared_ptr<PhysicsWorld>): Physics world
Sets the body’s world rotation and updates the backend.Parameters:
rotation(Rotation3d): New rotationworld(std::shared_ptr<PhysicsWorld>): Physics world
Replaces the collider used by this rigidbody.Parameters:
collider(std::shared_ptr<Collider>): New collider
Sets maximum linear velocity.Parameters:
maxLinearVelocity(float): Maximum velocity
Sets maximum angular velocity.Parameters:
maxAngularVelocity(float): Maximum angular velocity
Gets the current linear velocity.Parameters:
world(std::shared_ptr<PhysicsWorld>): Physics world
Gets the current angular velocity.Parameters:
world(std::shared_ptr<PhysicsWorld>): Physics world
Gets the velocity at the rigidbody’s center.Parameters:
world(std::shared_ptr<PhysicsWorld>): Physics world
Applies all properties to the backend body.Parameters:
world(std::shared_ptr<PhysicsWorld>): Physics world
Refreshes the rigidbody state from the backend.Parameters:
world(std::shared_ptr<PhysicsWorld>): Physics world
Performs a raycast from this rigidbody.Parameters:
direction(Position3d): Ray directionmaxDistance(float): Maximum distanceworld(std::shared_ptr<PhysicsWorld>): Physics worldignoreBodyId(uint32_t): Optional body to ignore
Performs a raycast returning all hits.Parameters: Same as
raycastTests overlap with a collider.Parameters:
world(std::shared_ptr<PhysicsWorld>): Physics worldcollider(std::shared_ptr<Collider>): Collider to testposition(Position3d): Test positionrotation(Rotation3d): Test rotationignoreBodyId(uint32_t): Optional body to ignore
Performs a sweep to predict movement.Parameters:
world(std::shared_ptr<PhysicsWorld>): Physics worldcollider(std::shared_ptr<Collider>): Collider to sweepdirection(Position3d): Movement directionendPosition(Position3d&): End position outputignoreBodyId(uint32_t): Optional body to ignore
Performs a sweep returning all hits.Parameters: Same as
sweepColliders
Base Collider
Base interface for all collision shapes.Returns the smallest extent used for broad-phase heuristics.
BoxCollider
Axis-aligned box collider defined by half-extents.Creates a box collider.Parameters:
halfExtents(Position3d): Half-extents of the box (width/2, height/2, depth/2)
Half-extents of the box.
SphereCollider
Sphere collider defined by radius.Creates a sphere collider.Parameters:
radius(float): Sphere radius
Sphere radius.
CapsuleCollider
Capsule collider defined by radius and height.Creates a capsule collider.Parameters:
radius(float): Capsule radiusheight(float): Capsule height
Capsule radius.
Capsule height.
MeshCollider
Triangle mesh collider defined by indexed geometry.Creates a mesh collider.Parameters:
vertices(std::vector<Position3d>): Vertex positionsindices(std::vector<uint32_t>): Triangle indices
Vertex positions.
Triangle indices.
Joints
Base Joint
Base interface for constraint-style joints.Parent joint endpoint (Rigidbody* or WorldBody).
Child joint endpoint (Rigidbody* or WorldBody).
Whether anchor is in local or global space.
Joint anchor position.
Force threshold to break the joint. 0 = unbreakable.
Torque threshold to break the joint. 0 = unbreakable.
Creates the joint in the provided world.Parameters:
world(std::shared_ptr<PhysicsWorld>): Physics world
Breaks the joint by disabling its underlying constraint.
FixedJoint
Joint that locks relative translation and rotation.Creates the fixed joint in the provided world.Parameters:
world(std::shared_ptr<PhysicsWorld>): Physics world
HingeJoint
Joint that constrains rotation around a hinge axis.Hinge axis for parent body. Default: up vector
Hinge axis for child body. Default: up vector
Optional angular limits for the hinge.
Optional motor to drive the hinge.
Creates the hinge joint in the provided world.Parameters:
world(std::shared_ptr<PhysicsWorld>): Physics world
SpringJoint
Joint that behaves like a distance constraint with optional spring.Second anchor position.
Rest length of the spring. Default: 1.0
Whether to use min/max length limits. Default: false
Minimum distance constraint.
Maximum distance constraint.
Spring parameters for the joint.
Creates the spring joint in the provided world.Parameters:
world(std::shared_ptr<PhysicsWorld>): Physics world
Vehicle Simulation
Vehicle
High-level vehicle wrapper around Jolt’s VehicleConstraint.Pointer to the vehicle chassis rigidbody.
Vehicle configuration including wheels, engine, transmission.
Creates the vehicle constraint in the world.Parameters:
world(std::shared_ptr<PhysicsWorld>): Physics world
Destroys the vehicle constraint.Parameters:
world(std::shared_ptr<PhysicsWorld>): Physics world
Returns whether the vehicle has been created.
Sets driver input controls.Parameters:
forward(float): Forward/reverse [-1, 1]right(float): Steering [-1, 1]brake(float): Brake [0, 1]handBrake(float): Handbrake [0, 1]
VehicleSettings
Configuration structure for vehicle simulation.Up direction vector. Default: (0, 1, 0)
Forward direction vector. Default: (0, 0, 1)
Maximum pitch/roll angle in degrees. Default: 180.0
Array of wheel configurations.
Engine, transmission, and differential settings.
Maximum slope angle the vehicle can climb. Default: 80.0
VehicleWheelSettings
Configuration for individual vehicle wheels.Wheel position relative to chassis.
Suspension direction. Default: (0, -1, 0)
Steering axis. Default: (0, 1, 0)
Wheel up direction. Default: (0, 1, 0)
Wheel forward direction. Default: (0, 0, 1)
Minimum suspension length. Default: 0.3
Maximum suspension length. Default: 0.5
Suspension spring frequency. Default: 1.5
Suspension damping ratio. Default: 0.5
Wheel radius. Default: 0.3
Wheel width. Default: 0.1
Maximum steering angle in degrees. Default: 70.0
Maximum brake torque. Default: 1500.0
Maximum handbrake torque. Default: 4000.0
Enums and Helper Types
MotionType
Body never moves.
Body is affected by forces and gravity.
Body is moved programmatically, not by physics.
Space
Coordinates are in local space.
Coordinates are in world/global space.
SpringMode
Spring defined by frequency (Hz) and damping ratio.
Spring defined by stiffness and damping coefficients.