Overview
The Physics API provides engine-facing physics components for rigid body dynamics, collision detection, joints, and vehicle simulation. It wraps the Bezel physics backend with a high-level component-based interface.This is an alpha API and may change in future versions.
Core Components
PhysicsWorld
The physics world manages the backend simulation state and owns all physics objects.Methods
Initializes the backend physics system. Must be called before using any physics features.
Advances the physics simulation by
dt seconds.Parameters:dt(float): Delta time in seconds
Sets the global gravity vector for the simulation.Parameters:
gravity(Position3d): Gravity acceleration vector
Adds a rigidbody to the simulation.Parameters:
body(std::shared_ptr<bezel::Rigidbody>): Rigidbody to add
Performs a raycast query from origin in direction.Parameters:
origin(Position3d): Starting point of the raydirection(Position3d): Direction vectormaxDistance(float): Maximum ray distance (default: 1000.0)ignoreBodyId(uint32_t): Optional body ID to ignore
Performs a raycast that returns all hits along the ray.Parameters:
origin(Position3d): Starting point of the raydirection(Position3d): Direction vectormaxDistance(float): Maximum ray distanceignoreBodyId(uint32_t): Optional body ID to ignore
Tests if a collider overlaps with any bodies in the world.Parameters:
world(std::shared_ptr<PhysicsWorld>): Physics 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>): Physics 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 that returns all hits along the path.Parameters: Same as
sweepReturns: SweepResult with all hitsRigidbody Component
TheRigidbody component binds a Bezel rigidbody to a GameObject, enabling physics simulation.
Properties
Underlying Bezel rigidbody instance.
Signal string sent by sensors on overlap/contact events.
Whether this rigidbody behaves as a sensor (trigger). Default: false
Collider Methods
Adds a box collider to the rigidbody.Parameters:
extents(Position3d): Half-extents of the box
Adds a sphere collider to the rigidbody.Parameters:
radius(float): Sphere radius
Adds a capsule collider to the rigidbody.Parameters:
radius(float): Capsule radiusheight(float): Capsule height
Adds a mesh collider from the owning object’s mesh (if any).
Physics Properties
Sets the mass in kilograms.Parameters:
mass(float): Mass in kg
Sets friction coefficient for contact resolution.Parameters:
friction(float): Friction coefficient (0.0 - 1.0)
Sets restitution (bounciness) coefficient.Parameters:
restitution(float): Bounciness (0.0 = no bounce, 1.0 = perfect bounce)
Sets the rigidbody’s motion type.Parameters:
motionType(MotionType): Motion type enum
Static: Never movesDynamic: Affected by forces and gravityKinematic: Moved programmatically, not by physics
Sets linear and angular damping coefficients.Parameters:
linearDamping(float): Linear damping coefficientangularDamping(float): Angular damping coefficient
Force and Velocity Methods
Applies a continuous force in world space.Parameters:
force(Position3d): Force vector
Applies a continuous force at a world-space point.Parameters:
force(Position3d): Force vectorpoint(Position3d): Application point in world space
Applies an instantaneous impulse in world space.Parameters:
impulse(Position3d): Impulse vector
Sets the rigidbody’s linear velocity.Parameters:
velocity(Position3d): Velocity vector
Adds to the rigidbody’s linear velocity.Parameters:
velocity(Position3d): Velocity to add
Sets the rigidbody’s angular velocity.Parameters:
velocity(Position3d): Angular velocity vector
Adds to the rigidbody’s angular velocity.Parameters:
velocity(Position3d): Angular velocity to add
Sets the maximum linear velocity.Parameters:
maxLinearVelocity(float): Maximum velocity
Sets the maximum angular velocity.Parameters:
maxAngularVelocity(float): Maximum angular velocity
Returns the current linear velocity.
Returns the current angular velocity.
Returns the velocity at the rigidbody’s center.
Query Methods
Query methods are async-style: the request is queued and results are reported via
Component::onQueryReceive(QueryResult&).Performs a raycast from the rigidbody’s position.Parameters:
direction(Position3d): Ray directionmaxDistance(float): Maximum ray distance (default: 1000.0)
Performs a raycast that returns all hits.Parameters:
direction(Position3d): Ray directionmaxDistance(float): Maximum ray distance (default: 100.0)
Performs a raycast from a custom origin.Parameters:
origin(Position3d): Ray origindirection(Position3d): Ray directionmaxDistance(float): Maximum ray distance (default: 1000.0)
Performs a raycast from a custom origin returning all hits.Parameters:
origin(Position3d): Ray origindirection(Position3d): Ray directionmaxDistance(float): Maximum ray distance
Performs a raycast that only hits bodies with specified tags.Parameters:
tags(std::vector<std::string>): Tags to filter bydirection(Position3d): Ray directionmaxDistance(float): Maximum ray distance (default: 1000.0)
Performs a tagged raycast returning all hits.Parameters:
tags(std::vector<std::string>): Tags to filter bydirection(Position3d): Ray directionmaxDistance(float): Maximum ray distance
Tests if the existing collider overlaps with any bodies.
Tests sphere overlap at rigidbody’s position.Parameters:
radius(float): Sphere radius
Tests box overlap at rigidbody’s position.Parameters:
extents(Position3d): Box half-extents
Tests capsule overlap at rigidbody’s position.Parameters:
radius(float): Capsule radiusheight(float): Capsule height
Tests sphere overlap at a custom position.Parameters:
position(Position3d): Test positionradius(float): Sphere radius
Tests box overlap at a custom position.Parameters:
position(Position3d): Test positionextents(Position3d): Box half-extents
Tests capsule overlap at a custom position.Parameters:
position(Position3d): Test positionradius(float): Capsule radiusheight(float): Capsule height
Predicts movement using the existing collider.Parameters:
endPosition(Position3d): Target position
Predicts movement using a sphere collider.Parameters:
endPosition(Position3d): Target positionradius(float): Sphere radius
Predicts movement using a box collider.Parameters:
endPosition(Position3d): Target positionextents(Position3d): Box half-extents
Predicts movement using a capsule collider.Parameters:
endPosition(Position3d): Target positionradius(float): Capsule radiusheight(float): Capsule height
Tagging Methods
Returns true if the rigidbody has the provided tag.Parameters:
tag(std::string): Tag to check
Adds a tag for filtering and game logic.Parameters:
tag(std::string): Tag to add
Removes a previously added tag.Parameters:
tag(std::string): Tag to remove
Sensor Component
Convenience sensor rigidbody that defaultsisSensor to true. Inherits all methods from Rigidbody.
Sets the signal string emitted when the sensor is triggered.Parameters:
signal(std::string): Signal identifier
Vehicle Component
Vehicle component backed by Bezel’s vehicle implementation with full suspension and drivetrain simulation.Properties
Vehicle configuration including wheels, engine, transmission, and differentials.
Forward/reverse input in range [-1, 1]. Positive = forward, negative = reverse.
Steering input in range [-1, 1]. Positive = right, negative = left.
Brake input in range [0, 1]. 0 = no brake, 1 = full brake.
Hand brake input in range [0, 1]. 0 = no handbrake, 1 = full handbrake.
Methods
Requests a full rebuild of the internal vehicle constraint. Use after modifying settings.
Query Result Types
RaycastHit
World-space impact position.
Surface normal at the impact point.
Distance from ray origin to the hit point.
Atlas-side object that owns the rigidbody, when known.
Underlying Bezel rigidbody pointer, when known.
Whether the query produced a valid hit.
RaycastResult
All hits (for
RaycastAll variants).Primary hit (for
Raycast variants).Convenience distance for the nearest impact.
OverlapHit
World-space contact point.
Axis along which penetration occurs.
Signed penetration depth.
Atlas-side owner object, when known.
Underlying Bezel rigidbody pointer, when known.
OverlapResult
All overlap hits.
Whether any overlap occurred.
SweepHit
World-space impact position.
Surface normal at the impact point.
Distance traveled before impact.
Impact fraction along the sweep in [0, 1].
Atlas-side owner object, when known.
Underlying Bezel rigidbody pointer, when known.
SweepResult
All sweep hits (for “All” variants).
Closest hit for convenience.
Whether any hit occurred.
End position of the sweep when no hit blocks the movement.