Animating a custom mesh

2 questions i could not find answers for on my own…


  1. how would i create and apply animations to a custom mesh?

    furthermore,
  2. would it be possible to apply a (poly-accurate) physics collision shape that would update itself to match the actual animation?

I can answer #1: you can create a mesh in blender and animate it there, and then export it. That is probably the easiest. (or import an animated mesh into blender then export it from there). I do this all the time with the Ogre exporter in Blender.

  1. if by Custom mesh you mean made by code in the engine the answer is yes. But that’s kinda a hassle.you have to create a bone structure, and then had a boneIndex and boneWeight buffer to the mesh and fill them to suit your needs. @Sploreg suggestion would be a lot easier.



    2)Not really, you can use a hull collision shape that would fit the mesh exactly, but it wouldn’t update upon animation.

    A way to do this is to split the mesh in several hull collision shapes that would animate with the bones.



    Look what is done in the KinematicRagdollControl, we create a hull collision shape for each bone according to boneIndex and boneWeight data and it gives very satisfying results.

    Here is an old video demonstrating it

    http://hub.jmonkeyengine.org/groups/development-discussion-jme3/forum/topic/ragdollcontrol-progress/?topic_page=2&num=15#post-126033

thank you guys, the kinematic ragdoll control video displays almost exactly what i was looking for, (collision shape for each bone, thats perfect! i will check that out!) …and it seems i should listen to good advice and finally learn how to use blender instead of trying to assign animations to custom meshes created by code in the engine.