Hi,
I am loading my physics object from a collada file using class ColladaConverte.
I am now facing the problem of connecting those physics object to my graphics objects.
I already derive the class ColladaConverte to MyColladaConverter in order to override "createRigidBody".
I also derive btMotionState to MyMotionState following the Ogre3d motion state example from Bullet SDK manual. (Although I am not using Ogre3d).
I understand that it is in my class MyMotionState that I can connect the graphics and physics objects of the scene. As in the Ogre3d example (again I am not using Ogre3d), I can add a member which is a node to one of my graphics objects.
My problem is the following:
I don't know how to retrieve the correct graphics object.
I was hopping to use the rigid_body's attribute name from my collada *.dae file since it is also with that name that my graphics objects are labelled.
What I have in my collada file is such as:
<rigid_body sid="Actor0-RigidBody" name="Boîte01">
How can I retrieve that "name" information inside the method "createRigidBody" that I override?
My question could be reformulate to, while using ColladaConveter and the Ogre3d motion state example, how to specify the correct ogre::scenenode that linked a physics object defined in the collada file and a graphics object (which have a similar name).
Cheers,
Thank you
Connecting graphics & physics objects with motionstate
-
damiench
- Posts: 14
- Joined: Thu Feb 18, 2010 4:10 pm
-
Erwin Coumans
- Site Admin
- Posts: 4221
- Joined: Sun Jun 26, 2005 6:43 pm
- Location: California, USA
Re: Connecting graphics & physics objects with motionstate
ColladaDemo, BulletColladaConverter, COLLADA_DOM and the Maya Dynamica plugin has been moved to http://dynamica.googlecode.com
The updated BulletColladaConverter has a new virtual method that passes on the target node name. Can you check it?
What modeler are you using to export the COLLADA file? Perhaps you want to switch to the new .bullet format?
Thanks,
Erwin
The updated BulletColladaConverter has a new virtual method that passes on the target node name. Can you check it?
Code: Select all
///createNamedRigidBody default implementation will call createRigidBody
///bodyName is the name of the target node (graphics object/node) for example "Cube_015" in
///<instance_physics_model url="#Cube_015-PhysicsModel">
///<instance_rigid_body body="Cube_015-RigidBody" target="#Cube_015"/>
virtual btRigidBody* createNamedRigidBody(bool isDynamic,
float mass,
const btTransform& startTransform,
btCollisionShape* shape, const char* targetNodeName);
Thanks,
Erwin
-
damiench
- Posts: 14
- Joined: Thu Feb 18, 2010 4:10 pm
Re: Connecting graphics & physics objects with motionstate
Hum... I not sure it will help.The updated BulletColladaConverter has a new virtual method that passes on the target node name. Can you check it?
First, I don't have Maya, so the Cmake don't execute as it (which is normal!).
Second, my collada file is different than:
The problem I guess comes from the modeler/exporter I am using.Code: Select all
///bodyName is the name of the target node (graphics object/node) for example "Cube_015" in ///<instance_physics_model url="#Cube_015-PhysicsModel"> ///<instance_rigid_body body="Cube_015-RigidBody" target="#Cube_015"/>
I am using 3dsmax and using the PhysX exporter.
http://supportcenteronline.com/ics/supp ... erID=24981
I know Bullet only support Blender & Maya, but I would expect it support also PhysX because Collada is a standard.
In fact the exporter works, I can load and display the physics geometry.
The hard problem is to connect my graphical nodes to the physical object with motionstate.
I am not sure PhysX exporter really follow the standard (it should).
Anyway, what I need is to be able to acces the attribute "name" of the physical model (not the physical instance):
Code: Select all
<physics_model id="Scene0-PhysicsModel">
<rigid_body sid="Actor0-RigidBody" name="Boîte01">
<instance_geometry url="#ConvexMesh_0-Mesh"/>
I guess, I am assuming that there is one and only one physical instance of that physical model (which is not really good, but fit my case).
I succeed to some results by changing the class ColladaConverter to fit my needs.
Before calling "PreparePhysicsObject(", I force "input.m_bodyName" to another name.
It works so far.