Collision Shapes¶
A body is a physical object or articulation link whose motion is simulated. Collision shapes define the geometry used to detect its contacts. Multiple shapes attached to one body move together, while each shape retains its own local pose relative to that body.
For example, a cup is one rigid body. Its main cup section and handle can be represented by separate collision shapes, with several shapes used for either part when needed to approximate its geometry. These shapes move together as one cup; they are not separate simulated bodies.
This page explains how to read shape world poses and map them back to the authored geometry.
For an offset box collider, the body’s position and the collider’s center are different. Use the shape pose when placing a collision-debug overlay. For creating bodies and their geometry, see Rigid Bodies or Articulations.
Read world poses¶
The snippet uses an existing world with rigid bodies registered under
obj_id=0, as in Rigid Bodies.
Apply queued resets before querying.
import kangengine as ke
rigids: ke.sim.SimRigidBatch = world.get_rigid_batch(obj_id=0)
shape_poses = rigids.get_collision_shape_pose() # [N, S, 7]
rigid: ke.sim.SimRigid = rigids.first
one_pose = rigid.get_collision_shape_pose() # [S, 7]
For an articulation, obtain the batch with
world.get_articulation_batch(obj_id=0); the shape query interface is the same.
Each pose contains world position XYZ in meters followed by quaternion XYZW.
N is the number of selected environments and S is num_collision_shapes.
Query |
Return shape |
|---|---|
Batch |
|
Single record, |
|
Single record, explicit |
|
By default, batch rows follow the view’s environment order. Explicit CPU
env_ids select and reorder rows; an empty selection returns [0, S, 7].
Rigid num_bodies is always 1. Its body pose, mass, force, and contact state
refer to the actor, regardless of the number of attached shapes. For example,
rigids.data.body_pos and rigids.data.body_quat_xyzw describe the body pose,
not the shape poses. Articulation body state refers to physical links.
Coordinate frames and devices¶
Queries combine current actor/link poses with the runtime shape-local frames. CPU simulation returns tensors on the state device. GPU dynamic rigid/articulation queries fetch current poses and return CUDA tensors without downloading them; static-only rigid queries use the state device. Apply queued resets before querying. Static actors support these pose queries, but are not part of dynamic body state or contact sensor batches.
Note
Capsule poses use the PhysX shape frame, whose local X axis runs along the capsule. The returned rotation includes the conversion from the authored capsule axis; do not apply it directly to a Z-axis capsule mesh without accounting for that axis difference.
Contact sensors select physical bodies; per-shape contact filtering is not currently available. For older code that treated rigid body slots as colliders, see the 0.2.0 migration note.
See Multi-Environment Simulation for the fixed body/shape counts required within one object batch.