Worlds, Solvers & Physics State

World vs. VecWorld

  • World(config=SolverConfig(), num_threads=1): Single JPH::PhysicsSystem supporting rigid bodies, articulations, soft bodies, runtime constraints, proximity queries, IK/Jacobians/RNEA, and binary/keyframe snapshots.

  • VecWorld(num_envs, num_threads=0, config=SolverConfig()): Holds num_envs isolated World instances sharing identical scene topology, stepped in parallel across a persistent C++ std::thread pool with the GIL released.

Solver Configuration (SolverConfig)

Configure velocity/position solver iterations, Baumgarte stabilization, speculative contacts, and preallocated capacities before or after construction (set_solver_config / get_solver_config):

cfg = joltsim.SolverConfig()
cfg.num_velocity_steps = 16
cfg.num_position_steps = 4
cfg.max_bodies = 2048
cfg.max_contacts = 2048

w = joltsim.World(cfg)

Snapshots, Keyframes & Mocap Bodies

  • Binary Snapshots (save_state() / load_state(data)): Serialize full Jolt PhysicsSystem state + articulation joint unwrapping state into bytes and restore deterministically.

  • Named Keyframes (save_keyframe(name), load_keyframe(name), list_keyframes()): Store named in-memory snapshots on World or across all environments in VecWorld.

  • Kinematic Mocap Bodies: Set BodyDesc.is_kinematic = True (or <body mocap="true"> in MJCF) and call set_mocap_pose(body_idx, pos, quat, dt) (or set_mocap_pose(env_idx, ...) on VecWorld) to move the body kinematically while imparting velocity to dynamic contacts.

Runtime Material & Collision Overrides

  • change_dynamics(...) updates mass, friction, restitution, linear_damping, and angular_damping at runtime without rebuilding the world.

  • set_contact_pair_properties(body1, body2, friction=-1.0, restitution=-1.0) and clear_contact_pair_properties(body1, body2) override contact friction/restitution for specific body pairs in OnContactAdded / OnContactPersisted.

  • set_collision_filter_pair(body1, body2, enable) and set_collision_filter_group_mask(body_idx, group, mask) control collision filtering at runtime.