C4 integration

tjloughl
Posts: 23
Joined: Wed Oct 03, 2007 4:03 am

C4 integration

Post by tjloughl »

Hello,
I am trying to get my game integrated with Bullet, but I am having weird problems. I am using the Demo integration code from 129.
I am using the BulletPhysicsMgr, which has a btDiscreteDynamicsWorld. When my game loads, it calls Init of the manager,which I assume goes through the world file, finding every geometry node and gives it physics if it should have it. But I needed to have physics at a code level, not a world level, so I added a function "AddObject", which will take an entity and create a rigid body out of the entity's geometry data.
So, it loads up ok, and gets added ok. The problem is that when I start the game up, my entity starts going UP and rotating strangely. I have tried resetting the gravity but that didn't work. I don't know where to begin fixing this problem...
Another thing is that the Preprocess and Move functions aren't called every frame. Is this how it is supposed to be or am I forgetting something?
Thank you VERY MUCH for any help
tjloughl
Posts: 23
Joined: Wed Oct 03, 2007 4:03 am

Re: C4 integration

Post by tjloughl »

So, I have been testing and testing and nothign seems to work. I shut gravity off (turn it to 0,0,0) and it still does crazy things, floats up into their air, starts rotating. I cannot find anythign I am doing wrong. Maybe my time step or something? Maybe my dispatchers, solvers, or something else? I am just stuck.
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: C4 integration

Post by Erwin Coumans »

which version of C4 are you using? And which version of Bullet?

Does the 'standard' world initialized version work fine?

I'll try to get an updated BulletC4 integration released.
thanks,
Erwin
tjloughl
Posts: 23
Joined: Wed Oct 03, 2007 4:03 am

Re: C4 integration

Post by tjloughl »

I am using C4 build 140. I have 2 projects going, one with bullet 2.55 and one with bullet 2.62. The 2.55 has given me the best results. I have found my main problems of chaos. I think the positions of all my entities were off, the transforms were never set. This caused c4 and bullet to be out of sync so I saw crazy things.
However, now that I have things working "normally", meaning, my model falls with gravity the way it should, I am still getting problems.
I am loading a world, and then spawning a player entity in the world (with a submarine model)
I am using BuildCollisionMesh to go through the world and all the nodes and to just find all the geometry nodes, not the entities in the world. Right now, the only geometry placed in the world editor is a sphere placed directly underneath the spawn location of the player. The sphere body has a mass of 0 (if i try to give it a mass > 0, it crashes because the btBvhTriangleMeshShape created for it says its concave?), and has no gravity. BuildCollisionMesh is creating a btBvhTriangleMeshShape for the sphere and adding it to the world.
Then, AddObjects is called, which finds all the entities in the world, gets their geometry, and creates a sphere collision shape out of them and adds it to the world. The sub has a mass of 10 and has -10 gravity.
When I run the game, the sub entity falls correctly. However, when it comes near to the sphere, nothing happens. I assume the sub would bounce off of the sphere and start going upwards.

Any ideas what could be causing this?


A NEW INTEGRATION WOULD BE PERFECT AND GREATLY APPRECIATED!
Irix
Posts: 1
Joined: Wed Oct 17, 2007 1:27 am

Re: C4 integration

Post by Irix »

Hi there,

I´ve managed to integrate Bullet 2.62 with C4 141, but just the basics, nothing fancy. Objects fall, bounce and collide like they should, I´m only having problems with a constraint I´m using for some "hold object" code. Maybe we should pool our resources to get the C4 integration code updated?


regards,
tjloughl
Posts: 23
Joined: Wed Oct 03, 2007 4:03 am

Re: C4 integration

Post by tjloughl »

Hello
I have finally managed to integrate C4 and bullet with the most updated of each. Thanks for the help though. Maybe I can help you with your problem? I'm not sure what a "hold object" constraint is haha, but I'm sure we can figure something out