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
Adding a reference to a non-bullet rigidbody
-
- Posts: 29
- Joined: Sat Sep 23, 2006 1:35 pm
- Location: Northern Ireland
-
- Site Admin
- Posts: 4221
- Joined: Sun Jun 26, 2005 6:43 pm
- Location: California, USA
Re: Adding a reference to a non-bullet rigidbody
Did you try to create a CollisionObject, and then pointing itsAshMcConnell 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
Code: Select all
m_userObjectPointer
Hope this helps,
Erwin
-
- Posts: 29
- Joined: Sat Sep 23, 2006 1:35 pm
- Location: Northern Ireland
Oops, missed that one
So I just get the CollisionObject from the manifold like this: -
and get my own rigidbody by doing a simple: -
Thanks!
All the best,
Ash
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());
Code: Select all
MyRigidBody *rb = (MyRigidBody *)obA->m_userObjectPointer;
All the best,
Ash