I'm working on a small multiplayer game which has a single skinned player mesh with many players using it. Some Background: I've tried loading via maya and blender collada export. Both seem to reference some form of animation data but I couldn't get it working. I've tried the maya JSON exporter, which spat out tiny 1k files with only a material line. Finally the blender JSON exporter worked. To those also trying to load skinned meshes, I found this very helpful: Model with bones animation (blender export) animating incorrectly in three.js
So now I have a geometry
object and a materials
array from the JSON loader.
I can set skinning=true
on the materials, create a THREE.SkinnedMesh
, add it to the scene, add animations via THREE.AnimationHandler.add
(I'm quite unclear on what the AnimationHandler
actually does), create a THREE.Animation
, call play()
and update(dt)
. Finally I have a single mesh and an animation playing in my scene.
Now what I want are these...
Many instances - I want more than one player model running around in my scene.
- I don't want the same mesh and animation data loaded many times.
- Animation time should be per-instance (so they don't all animate in sync).
Should I be creating many
THREE.SkinnedMesh
andTHREE.Animation
for the same model? Where doesTHREE.AnimationHandler
come in?Many animations - I want idle/run cycles able to be played individually.
AFAIK there's only a single timeline of animation keyframes. How does Three.js partition this up for me, or do I have to do it manually?
Animation Blending - When a character stops running and stands still with the idle animation, I don't want an instant snap from one to the other. I'd like to pause the run animation and blend that state back into the idle animation.
Is this currently possible with skinned meshes (not morph targets)? Are there examples or docs about this?
Any information would be greatly appreciated, even just a nudge in the right direction. I'm not after a full tutorial, I would like some higher level information about these features.
I could happily implement 2 and 3, but I'd like some information/descriptive docs about the threejs skinning and animation framework to get me started. For example, this isn't much to go on.
[EDIT]
Thanks, @NishchitDhanani, this page is quite good but doesn't mention multiple animations or blending skeletal animations: http://chimera.labs.oreilly.com/books/1234000000802/ch05.html#animating_characters_with_skinning
This page says multiple animations are still a current issue but not much more (discussed a little in the comments): http://devmatrix.wordpress.com/2013/02/27/creating-skeletal-animation-in-blender-and-exporting-it-to-three-js/
The current answers are...
- Use many
THREE.SkinnedMesh
and still not sure aboutTHREE.AnimationHandler
. - Don't know. Perhaps there's a way to modify the start/end keyframes manually in the
THREE.Animation
. - Not implemented AFAIK. I might try creating a custom shader that can take two
THREE.Animation
s and interpolate between them.
.scene
. You can add the whole thing or pick and choose from its children. – jozxyqk