On the mapping between motions and dynamics

context: I’m using Unity.Physics without Entities

Hi, I’m wondering if the mapping between Motion and dynamic-body is always by index or if there is something I’ve missed.

In the code fro BuildPhysicsWorld I saw this comment:

// Dynamic bodies.
// Create these separately from static bodies to maintain a 1:1 mapping
// between dynamic bodies and their motions.

And I wasn’t sure if this is always the case or if this was just their choice in this case.

I’ve been assuming the former as I haven’t yet found any other index between motions and bodies.

Cheers.

Yeah, dynamic bodies are always the first N bodies in the bodies buffer, so their indices (0 to N-1) map to the index in the MotionDatas and MotionVelocities buffer. That is always the case.

1 Like

Perfect. Thanks again for the help

1 Like