Page 1 of 1

Adding a reference to a non-bullet rigidbody

Posted: Sat Sep 23, 2006 1:45 pm
by AshMcConnell
Hi Folks,

I am hoping to use bullet to do only collision detection. Appolgies of this is a silly question, but I couldnt find the answer when I searched.

I have written a few tests using the collisionObject + collisionWorld objects using collisionWorld->AddCollisionObject(collisionObject) and all seems to work as i'd expect (hurah!) :)

I am hoping to add a reference to my rigidbody object. I see that the AddCollisionObject creates a broadphase proxy with the reference as the collisionObject that was passed in.

I was hoping to add another AddCollisionObject method with an extra void* parameter which will be passed on to the CreateProxy method.

Is this a sensible thing to do? Does anyone see any problem with doing it that way?

Thanks for your help and thanks for giving us Bullet!

All the best,
Ash

Re: Adding a reference to a non-bullet rigidbody

Posted: Sat Sep 23, 2006 3:15 pm
by Erwin Coumans
AshMcConnell wrote:Hi Folks,

I am hoping to use bullet to do only collision detection. Appolgies of this is a silly question, but I couldnt find the answer when I searched.

I have written a few tests using the collisionObject + collisionWorld objects using collisionWorld->AddCollisionObject(collisionObject) and all seems to work as i'd expect (hurah!) :)

I am hoping to add a reference to my rigidbody object. I see that the AddCollisionObject creates a broadphase proxy with the reference as the collisionObject that was passed in.

I was hoping to add another AddCollisionObject method with an extra void* parameter which will be passed on to the CreateProxy method.

Is this a sensible thing to do? Does anyone see any problem with doing it that way?

Thanks for your help and thanks for giving us Bullet!

All the best,
Ash
Did you try to create a CollisionObject, and then pointing its

Code: Select all

m_userObjectPointer
to your rigidbody?

Hope this helps,
Erwin

Posted: Sat Sep 23, 2006 5:37 pm
by AshMcConnell
Oops, missed that one :oops:

So I just get the CollisionObject from the manifold like this: -

Code: Select all

CollisionObject* obA = static_cast<CollisionObject*>(contactManifold->GetBody0());
CollisionObject* obB = static_cast<CollisionObject*>(contactManifold->GetBody1());
and get my own rigidbody by doing a simple: -

Code: Select all

MyRigidBody *rb = (MyRigidBody *)obA->m_userObjectPointer;
Thanks!
All the best,
Ash