Page 1 of 1
Struggling to get colliding body's pointer/index
Posted: Mon Apr 10, 2017 10:43 pm
by jimjamjack
I'm trying to find when two specific bodies collide in my scene (a bullet and a target), but when using the "iterating through the manifold" method, I can't seem to get the colliding bodies' pointer or index (they're always either a null pointer or a new index).
I've been struggling with this for days now, I can't seem to correctly find the colliding bodies' types. Any help would be appreciated.
Re: Struggling to get colliding body's pointer/index
Posted: Wed Apr 12, 2017 4:16 pm
by drleviathan
It looks to me like you're getting the pointers to the objects just fine:
Code: Select all
const btCollisionObject *objA = contactManifold->getBody0();
const btCollisionObject *objB = contactManifold->getBody1();
Interestingly, I've never seen the btCollisionObject::getUserIndex() method. I don't find it mentioned in the Bullet docs I've been using:
http://www.continuousphysics.com/Bullet ... bject.html
But I do see it in the code. The git Blame tool says getUserIndex() was added in June 2013, and getUserIndex2() was added in September 2016. Ok, good to know.
Re: Struggling to get colliding body's pointer/index
Posted: Wed Apr 12, 2017 10:16 pm
by jimjamjack
Yeah it seems getUserIndex() was a somewhat recent addition. It works fine elsewhere in the code, like with ray casting, but I'm having issues with it here...