[Bepu2] IPoseInegratorCallbacks-IntegrateVelocity-bodyIndex

Post and discuss features you'd like to see in the BEPUphysics library.
Post Reply
Posts: 23
Joined: Mon Mar 27, 2017 12:33 pm

[Bepu2] IPoseInegratorCallbacks-IntegrateVelocity-bodyIndex

Post by Darkon76 » Wed Jun 19, 2019 8:23 pm


Adding damping per object I notice that IPoseIntegratorCallbacks -> IntegrateVelocity -> bodyIndex isn't the index of the affected body it is the index inside the ActiveSet.

The variable name is confusing.

Site Admin
Posts: 4887
Joined: Tue Jul 04, 2006 4:45 am

Re: [Bepu2] IPoseInegratorCallbacks-IntegrateVelocity-bodyIndex

Post by Norbo » Wed Jun 19, 2019 9:30 pm

Across v2, the term "index" refers to the current location in memory within whatever buffer is relevant. So in this case, index is the correct term. The pose integrator iterates over all bodies in the contiguous active set, so the index is the most directly useful value.

"Handle" refers to the identity of an object. At the moment, both are int types, which I don't like because it leads to confusion like this. I considered using a dedicated type for handles to avoid the issue, but at the time there was no zero overhead way to do it. I'll probably revisit this in the future since this class of confusion (and potentially bug) is going to be so common. Even if there is a slight overhead, a type-level distinction for handles is probably worth it.

Post Reply