narwhals
23-02-2011 03:56:28
Looked around as much as I could, I couldn't find an explanation on how to do this.
I have a mesh that is animated using bones. Right now it just has 1 bone and the animation makes the bone rotate.
Now, when playing the animation in OGRE, the animation plays just as expected, but, as shown by the debug drawer and how it interacts with other objects, the animation does not update the position / orientation of the physics body.
I can tell, since the movement is handled by bullet, that I somehow need to also tell bullet how the animation is progressing in order for it to move the body - but how?
tl;dr: How do I make OGRE animations affect bullet bodies?
stuff so far:
Y U NO MOVE?
I have a mesh that is animated using bones. Right now it just has 1 bone and the animation makes the bone rotate.
Now, when playing the animation in OGRE, the animation plays just as expected, but, as shown by the debug drawer and how it interacts with other objects, the animation does not update the position / orientation of the physics body.
I can tell, since the movement is handled by bullet, that I somehow need to also tell bullet how the animation is progressing in order for it to move the body - but how?
tl;dr: How do I make OGRE animations affect bullet bodies?
stuff so far:
OgreBulletCollisions::AnimatedMeshToShapeConverter conv(m_entity);
m_shape = (OgreBulletCollisions::CollisionShape*)conv.createConvex();
m_body->setStaticShape(m_sceneNode, m_shape, m_restitution, m_friction, m_position, m_orientation);
m_body->setKinematicObject(true);
m_entity->getAnimationState("Wobble")->setEnabled(true);
//--and later on, in an update loop:
m_entity->getAnimationState("Wobble")->addTime(tDiff);
Y U NO MOVE?