Page 1 of 1

[Bepu2] IPoseInegratorCallbacks-IntegrateVelocity-bodyIndex

Posted: Wed Jun 19, 2019 8:23 pm
by Darkon76
Hello,

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.

Re: [Bepu2] IPoseInegratorCallbacks-IntegrateVelocity-bodyIndex

Posted: Wed Jun 19, 2019 9:30 pm
by Norbo
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.