New to bullet, some questions

B_old
Posts: 79
Joined: Tue Sep 26, 2006 1:10 pm

New to bullet, some questions

Post by B_old »

Hello,

I do have some questions about things from the demos that I can't find explained anywhere. It is just minor stuff and I hope I don't get on your nerves.
Anyway.
The LocalCreatePhysicsObject() function provides some mysteries for me.
What does PHY_ShapeProps shapeProps do? It looks like a temporary variable that has more stuff assigned to it than is ever used. Am I missing something?
PHY_MaterialProps materialProps does not seem to get used at all.
ccdObjectCi.m_gravity = SimdVector3(0,-9.8,0); Why does every object have it's own gravity?

CollisionDispatcher* dispatcher = new CollisionDispatcher();
Do I have to delete this myself (the demo does not seem to do it) or will the physicsEnviroment do it for me?

It would be cool if you could help me out with this.

I am really looking forward to using this library, thanks!
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: New to bullet, some questions

Post by Erwin Coumans »

B_old wrote:Hello,
The LocalCreatePhysicsObject() function provides some mysteries for me.
What does PHY_ShapeProps shapeProps do? It looks like a temporary variable that has more stuff assigned to it than is ever used. Am I missing something?
PHY_MaterialProps materialProps does not seem to get used at all.
ccdObjectCi.m_gravity = SimdVector3(0,-9.8,0); Why does every object have it's own gravity?

CollisionDispatcher* dispatcher = new CollisionDispatcher();
Do I have to delete this myself (the demo does not seem to do it) or will the physicsEnviroment do it for me?

It would be cool if you could help me out with this.

I am really looking forward to using this library, thanks!
Please ignore PHY_MaterialProps and PHY_ShapeProps, they are obsolete and will be removed. Each object having its own gravity, allows to switch if off for certain objects. In games, sometimes you want to change gravity for certain objects to enhance gameplay. For example the recent Tombraider Legends uses different gravity for Lara then for environment rigid bodies.

At the moment, you delete what you create in general. There might be some violations (motion state is destructed by the controller), but those have to be fixed, as they are bugs.

Thanks a lot for the comments/feedback. I will take them into account during our cleanup/refactoring for the new version 2.

Your issues have been added to the list:
http://code.google.com/p/bullet/issues/list


Thanks,
Erwin
B_old
Posts: 79
Joined: Tue Sep 26, 2006 1:10 pm

Post by B_old »

Thanks for the answers!

About the gravity thing, which gravity is going to be used?

I am having a problem with deleting the CcdPhysicsControllers at the end of the program, can you think of any obvious mistake I could be making?
I delete the CcdPhysicsEnvironment first. I believe the problem has to do with bullet, or at least with the way I use it, but I don't see how.
(I did create/free som bogus resources at the same time, and they did not cause trouble)

Thanks again.
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Post by Erwin Coumans »

B_old wrote:Thanks for the answers!

About the gravity thing, which gravity is going to be used?

I am having a problem with deleting the CcdPhysicsControllers at the end of the program, can you think of any obvious mistake I could be making?
I delete the CcdPhysicsEnvironment first. I believe the problem has to do with bullet, or at least with the way I use it, but I don't see how.
(I did create/free som bogus resources at the same time, and they did not cause trouble)

Thanks again.
When you add a CcdPhysicsController/rigidbody to the CcdPhysicsEnvironment, it will get the global gravity applied. Also when you call CcdPhysicsEnvironment::setGravity, all physics controller get this new gravity. You can override this by setting the gravity on the rigidbody afterwards.

Can you compile and run a debug version and provide a call stack?
Perhaps the crash is related to deletion of the motionstate? At the moment the CcdPhysicsController deletes it, that is a bug, reported in http://code.google.com/p/bullet/issues/list

Thanks,
Erwin
B_old
Posts: 79
Joined: Tue Sep 26, 2006 1:10 pm

Post by B_old »

Ah, now I understand.
It is OK if I let the PhysicsController have its way and allocate a new MotionState which it later can delete.

Thanks for the help!
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Post by Erwin Coumans »

B_old wrote:Ah, now I understand.
It is OK if I let the PhysicsController have its way and allocate a new MotionState which it later can delete.

Thanks for the help!
We are currently refactoring Bullet, for a better cleaner version 2.1. The interface will improve and I will take all feedback into consideration.