Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support three JSON model with Skeletal Animation #87

Closed
fuleinist opened this issue Sep 12, 2016 · 4 comments
Closed

support three JSON model with Skeletal Animation #87

fuleinist opened this issue Sep 12, 2016 · 4 comments

Comments

@fuleinist
Copy link

fuleinist commented Sep 12, 2016

After updating current json loader in dc4d360 I managed to load the knight model with bones.

However the animation can not be triggered.

playAnimation fired without any error while animation didn't start.

I am looking at how this function has been setup but could not find out why it's not started yet.

` playAnimation: function () {
var clip,
data = this.data,
animations = this.model.animations || this.model.geometry.animations || [];

if (!animations.length) return;

clip = data.animation === DEFAULT_ANIMATION
  ? animations[0]
  : THREE.AnimationClip.findByName(animations, data.animation);

if (!clip) {
  console.error('[three-model] Animation "%s" not found.', data.animation);
  return;
}

this.model.activeAction = this.mixer.clipAction(clip, this.model);
if (data.animationDuration) {
  this.model.activeAction.setDuration(data.animationDuration);
}
this.model.activeAction.play();

},`

Source code for http://threejs.org/examples/webgl_animation_skinning_morph.html

`mesh = new THREE.SkinnedMesh( geometry, new THREE.MultiMaterial( materials ) );
...
mixer = new THREE.AnimationMixer( mesh );
bonesClip = geometry.animations[0];
...
root = rootObjects[ 0 ],

action = null,

API = {
'play()': function play() {
action = mixer.clipAction( clip, root );
action.play();

},
....
`

Any thoughts anyone?

msj121 added a commit to msj121/aframe-extras that referenced this issue Sep 14, 2016
It was necessary to make sure each material has "skinning" set to true. I also added the ability to morphTargets to true for some future Morph animations on SkinnedMeshes (needs some thought there, so I didn't add any additional code, but the above materials will allow custom scripts to later be added by someone using this library to create and play morph animations until we have a proper solution)....

This will solve c-frame#87, as well as c-frame#86
@msj121
Copy link
Contributor

msj121 commented Sep 14, 2016

I have created a pull request (#89), this will solve both this issue, and all also #86...

@fuleinist
Copy link
Author

Thanks @msj121, tested and works like a charm : )

@msj121
Copy link
Contributor

msj121 commented Sep 14, 2016

My pleasure, nice to be able to commit back to this component as I really like the code and I am using it a lot so far :). As you can see I just modified your code a little bit to get it working.

@donmccurdy
Copy link
Collaborator

Looks like we're good here, with some more upcoming changes from msj121's #91. Thanks all!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants