Struggling to get colliding body's pointer/index

Post Reply
jimjamjack
Posts: 39
Joined: Tue Jan 31, 2017 8:07 pm

Struggling to get colliding body's pointer/index

Post 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.
Last edited by jimjamjack on Mon May 01, 2017 9:54 pm, edited 1 time in total.
User avatar
drleviathan
Posts: 849
Joined: Tue Sep 30, 2014 6:03 pm
Location: San Francisco

Re: Struggling to get colliding body's pointer/index

Post 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.
jimjamjack
Posts: 39
Joined: Tue Jan 31, 2017 8:07 pm

Re: Struggling to get colliding body's pointer/index

Post 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...
Post Reply