Documentation Index
Fetch the complete documentation index at: https://mintlify.com/ryanhcode/sable/llms.txt
Use this file to discover all available pages before exploring further.
PhysicsPipeline is the abstraction layer between Sable’s sub-level system and the underlying physics engine (Rapier). It manages rigid bodies, physics ticking, force application, and constraints. All physics operations on sub-levels go through this interface, which you obtain from SubLevelPhysicsSystem.getPipeline().
Initialization
init
The gravity vector applied to all dynamic bodies each tick.
A drag coefficient applied uniformly to every body in the simulation.
dispose
Physics tick lifecycle
These methods are called by Sable’s tick scheduler in a fixed order every game tick. You do not call them directly unless you are implementing a custom pipeline.prePhysicsTicks
1.0 / 20.0 seconds total. Called once before any substeps run.
physicsTick
Duration of this substep in seconds:
1.0 / 20.0 / substeps.postPhysicsTicks
tick
Body management
add(ServerSubLevel, Pose3dc)
The sub-level to add as a dynamic rigid body.
The initial world-space pose for the body.
remove(ServerSubLevel)
add(KinematicContraption)
remove(KinematicContraption)
Pose reading
readPose
dest.
This method is annotated
@ApiStatus.OverrideOnly. Call ServerSubLevel.logicalPose() in normal game code rather than calling this directly.The sub-level to query.
The destination pose object to write into.
dest with the current pose written in.
Force application
teleport
The body to teleport.
New world-space position.
New world-space orientation.
applyImpulse
The target body.
World-space application point, assumed to be inside the body’s plot [m].
Force to apply [N].
applyLinearAndAngularImpulse
The target body.
Local linear impulse [N].
Local angular impulse [Nm].
If
true, wakes the body from sleep before applying the impulse.addLinearAndAngularVelocity
Velocity to add [m/s].
Angular velocity to add [rad/s].
resetVelocity
addLinearAndAngularVelocity.
Velocity queries
getLinearVelocity
dest.
Returns dest [m/s]. Returns a zero vector if not implemented.
getAngularVelocity
dest.
Returns dest [rad/s]. Returns a zero vector if not implemented.
Wake and sleep
wakeUp
Constraints
addConstraint
The first body. Pass
null to attach sublevelB to the world.The second body. Pass
null to attach sublevelA to the world.A typed configuration record that determines the joint type and returns a matching handle.
T that you must retain to remove or modify the constraint later.
See Physics constraints and joints for all configuration types.
World geometry
handleChunkSectionAddition
handleChunkSectionRemoval
handleBlockChange
onStatsChanged
updateConfigFrom
PhysicsConfigData object (gravity, substep count, drag, etc.).
Misc
getNextRuntimeID
Physics objects
addRope
RopePhysicsObject with the physics engine and returns a RopeHandle for controlling it.
This method is
@ApiStatus.OverrideOnly. Use RopePhysicsObject.onAddition() instead of calling this directly.addBox
BoxPhysicsObject with the physics engine and returns a BoxHandle.
PhysicsPipelineBody
PhysicsPipelineBody represents any rigid body tracked by a PhysicsPipeline — including sub-levels and standalone objects like boxes.
Sentinel value (
-1) indicating the body has no valid runtime ID.Returns the runtime integer ID assigned by the pipeline. Returns
NULL_RUNTIME_ID if not yet registered.Returns the mass/inertia data for this body. See Force groups and mass tracking.
Returns
true if this body has been removed from the pipeline.RigidBodyHandle
RigidBodyHandle is a convenience wrapper around a PhysicsPipelineBody that exposes commonly used force and velocity operations without needing a direct PhysicsPipeline reference.
Obtain one via RigidBodyHandle.of(ServerSubLevel) or SubLevelPhysicsSystem.getPhysicsHandle(ServerSubLevel).
Factory methods
null if the level has no SubLevelContainer (e.g. the level is not physics-enabled).
Force methods
| Method | Description |
|---|---|
applyImpulseAtPoint(Vector3dc position, Vector3dc force) | Force [N] at world position [m] |
applyImpulseAtPoint(Vec3 position, Vec3 force) | Minecraft Vec3 overload |
applyLinearAndAngularImpulse(Vector3dc impulse, Vector3dc torque) | Local force + torque, wakes body |
applyLinearAndAngularImpulse(Vector3dc impulse, Vector3dc torque, boolean wakeUp) | Explicit wake control |
applyLinearImpulse(Vector3dc impulse) | Linear only [N] |
applyAngularImpulse(Vector3dc impulse) | Angular only [N] |
applyTorqueImpulse(Vector3dc torque) | Torque alias [Nm] |
applyForcesAndReset(ForceTotal forceTotal) | Drains a ForceTotal accumulator into this body |
addLinearAndAngularVelocity(Vector3dc linear, Vector3dc angular) | Velocity delta [m/s, rad/s] |
teleport(Vector3dc position, Quaterniondc orientation) | Instant teleport |
Velocity methods
| Method | Returns | Unit |
|---|---|---|
getLinearVelocity(Vector3d dest) | Vector3d | m/s |
getAngularVelocity(Vector3d dest) | Vector3d | rad/s |
The zero-argument overloads
getLinearVelocity() and getAngularVelocity() are deprecated. Use the dest-accepting overloads to avoid allocation.isValid
true if the underlying body has not been removed from the pipeline.