Using Blender to export physics

molma100
Posts: 11
Joined: Sat Apr 09, 2011 8:12 pm

Using Blender to export physics

Post by molma100 »

Hi, i had this priblem before, and im still having a problem in this area...

right now im trying to setup physics in blender to export to bullet.

I managed to get the file to export, but when i load in into my game, none of the rigid bodies are read...

here is the important code:

Code: Select all

btBulletWorldImporter* fileLoader = new btBulletWorldImporter(PhysicsWorld));
fileLoader->loadFile("CarperonColv2.bullet");
cout << "Rigid Bodies: " << fileLoader->getNumRigidBodies() << endl;//i used this to read how many rigidbodies are in the file, the result was always 0...
also in blender this is the python script code im using to export the bullet file:

Code: Select all

import PhysicsConstraints;
PhysicsConstraints.exportBulletFile("CarperonColv2.bullet")


im wondering if im forgetting code that is needed to get the rigidbodies loaded...

I also have my .blend and .bullet files included if those are necessary
You do not have the required permissions to view the files attached to this post.
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: Using Blender to export physics

Post by Erwin Coumans »

Your file loads just fine in Bullet/Demos/SerializeDemo and reports 3 rigid bodies. Make sure to use Bullet 2.78.

Just rename the file 'testFile.bullet', copy it in Bullet/Demos/SerializeDemo and rebuild the SerializeDemo and run it. Here is the screenshot:
shot.png
Thanks,
Erwin
You do not have the required permissions to view the files attached to this post.
molma100
Posts: 11
Joined: Sat Apr 09, 2011 8:12 pm

Re: Using Blender to export physics

Post by molma100 »

hmm....then this means that im probably forgetting something in my code...

im going to check out the demo, to see what i shouldve done or what i have missed..

thanks for informing me that it works


is there any code that i am missing??




EDIT: I just found out why nothing is working! its because my file is not being loaded at all! ._.


i bet im missing an include or something because i do have bullet 2.78


heres my code:

http://pastebin.com/a2yCfNq3


EDIT: WOW im slow! i was calling to the wrong directory all this time!! how could i not see that!?!


sorry for your time ._.'
entropyExplorer
Posts: 4
Joined: Wed Dec 28, 2011 12:11 pm

Re: Using Blender to export physics

Post by entropyExplorer »

Dear Sir Erwin Coumans,

Thank you for the common sense approach to testing .bullet files: using the demo. You made a random game coder a very happy person.

keep doing how you do.