I am currently developing a small multiplayer game that features a single skinned player mesh utilized by multiple players. Some Background: I have experimented with loading via Maya and Blender Collada export, both of which seem to reference some sort of animation data, although I encountered difficulties in getting it to work. After trying the Maya JSON exporter (which only generated tiny 1k files with a material line), I eventually found success with the Blender JSON exporter. For those also struggling with loading skinned meshes, I came across this helpful resource: Model with bones animation (Blender export) animating incorrectly in three.js
As a result, I now possess a geometry
object and a materials
array from the JSON loader.
I can enable skinning=true
on the materials, create a THREE.SkinnedMesh
, add it to the scene, incorporate animations through THREE.AnimationHandler.add
(I'm uncertain about the role of the AnimationHandler
), create a THREE.Animation
, invoke play()
and update(dt)
. Consequently, I have a singular mesh with an animation playing within my scene.
Now, here are my objectives...
Multiple instances - I desire to have more than one player model moving around in my scene.
- I do not wish to load the same mesh and animation data repeatedly.
- The animation time should be specific to each instance (thus preventing them from all animating simultaneously).
Should I create numerous
THREE.SkinnedMesh
andTHREE.Animation
for the same model? How doesTHREE.AnimationHandler
factor into this?Multiple animations - I want idle/run cycles that can be independently played.
To my knowledge, there exists only a single timeline of animation keyframes. How does Three.js handle partitioning this for me, or is manual intervention required?
Animation Blending - To avoid abrupt transitions when a character halts running and shifts into the idle animation, I aim to pause the run animation and blend that state back into the idle animation.
Is this functionality achievable with skinned meshes (excluding morph targets)? Are there any examples or documentation available on this topic?
Any insights would be highly appreciated, even if just directing me towards the right path. I do not seek a comprehensive tutorial; rather, I desire some overarching information regarding these functionalities.
I could potentially implement 2 and 3, but I require informative/descriptive documents pertaining to the Three.js skinning and animation framework to initiate the process. For instance, this offers limited guidance.
[EDIT]
Thanks to @NishchitDhanani, while the provided link proves beneficial, it lacks details on multiple animations or blending skeletal animations:
This page suggests that handling multiple animations remains a current challenge but provides limited insight (discussed briefly in the comments):
The current responses include...
- Utilize many
THREE.SkinnedMesh
, still uncertain aboutTHREE.AnimationHandler
. - Unknown. Potentially adjust the start/end keyframes manually in the
THREE.Animation
. - Not presently implemented to my knowledge. Possible exploration involves creating a custom shader capable of handling two
THREE.Animation
s and interpolating between them.