Physics Simulation Forum

 

All times are UTC




Post new topic Reply to topic  [ 5 posts ] 
Author Message
PostPosted: Sat Feb 11, 2012 3:23 pm 
Offline
User avatar

Joined: Sun Jul 24, 2011 5:07 pm
Posts: 22
Using bullet 2.79.

I have two objects: my character is the btCapsuleShape, and a 2D terrain (my game is a platformer) is a btBvhTriangleMeshShape.

The above collision works fine in Debug, however on Release the character just falls right through the terrain. Collisions get detected, my handler for collision points added gets called and outputs to my debug window informing me of the collisions. It's just that the forces are not there?

I can see the collision meshes in my game, I've implemented the btIDebugDraw. It's just that I have no idea where to start with the debugging.

Is collision between these two shapes not officially supported or something? Any suggestions as to how this might be debugged?


Top
 Profile  
 
PostPosted: Sat Feb 11, 2012 5:26 pm 
Offline

Joined: Sun Jan 01, 2012 7:37 pm
Posts: 55
That doesn't seem right, Have you checked to ensure that the collision flags are the same between debug and release?


Top
 Profile  
 
PostPosted: Sat Feb 11, 2012 8:13 pm 
Offline
User avatar

Joined: Sun Jul 24, 2011 5:07 pm
Posts: 22
Thanks!

Your suspicions might be correct. I printed to my debug output the values of getCollisionFlags for each rigid body. My character's body printed 0 and the terrain rigid body printed 1. But that's also true on Debug, not only Release, yet they still collide correctly. Nonetheless I used mRigidBody->setCollisionFlags(0); on my terrain object and still no change. Also, the terrain rigid body gets created with a collision flag of 1 from the start, not sure why. The char's body gets a 0 flag though. This is causing me such a headache :x


Top
 Profile  
 
PostPosted: Sun Feb 12, 2012 8:06 am 
Offline
User avatar

Joined: Sun Jul 24, 2011 5:07 pm
Posts: 22
Is there anything else that might cause this peculiar behavior?


Top
 Profile  
 
PostPosted: Sun Feb 12, 2012 8:23 am 
Offline
User avatar

Joined: Sun Jul 24, 2011 5:07 pm
Posts: 22
I found the cause. I didn't calculate the local inertia for the terrain.
Code:
mCollisionShape->calculateLocalInertia(mass, fallInertia);

I probably don't understand local inertia right. What is it and why is it needed for static objects? Can't find anything in the documentation explaining it.

Also, it's very weird that on debug I can get away with not calculating it.

Can anyone point me to proper documentation, or at least explain in a few words what was happening?

Thank you!

LATER EDIT:
It wasn't needed. The debug had an assert preventing calls of calculateLocalInertia on concave shapes. I shouldn't have passed any inertia to btRigidBodyConstructionInfo at all when constructing the terrain.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC


Who is online

Users browsing this forum: Bing [Bot] and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group