Code: Select all
https://github.com/OGRECave/btogre
Is there any way to convert the python object to Entity/SceneNode or better advices?
Code: Select all
Entity------------------>btCollsionShape----+
+------------>btRigidBody---------->add to phyworld
SceneNode------------>RigidBodyState--------+
These are the key part of dealing with Entity and SceneNode, you can see more in https://github.com/OGRECave/btogre
Code: Select all
// main.cpp of bgOgre
BtOgre::StaticMeshToShapeConverter converter(mNinjaEntity);
//...
//this is the defination of StaticMeshToShapeConverter
//StaticMeshToShapeConverter(Ogre::Entity *entity, const Ogre::Matrix4 &transform = Ogre::Matrix4::IDENTITY);
//...
StaticMeshToShapeConverter::StaticMeshToShapeConverter(Entity *entity, const Matrix4 &transform) :
VertexIndexToShape(transform),
mEntity (0),
mNode (0)
{
addEntity(entity, transform);
}
Code: Select all
// main.cpp of bgOgre
//Create BtOgre MotionState (connects Ogre and Bullet).
BtOgre::RigidBodyState *ninjaState = new BtOgre::RigidBodyState(mNinjaBtNode);
//...
//this is the defination of RigidBodyState
RigidBodyState(Ogre::SceneNode *node)
: mTransform(((node != NULL) ? BtOgre::Convert::toBullet(node->getOrientation()) : btQuaternion(0,0,0,1)),
((node != NULL) ? BtOgre::Convert::toBullet(node->getPosition()) : btVector3(0,0,0))),
mCenterOfMassOffset(btTransform::getIdentity()),
mNode(node)
{
}