playcanvas / engine

JavaScript game engine built on WebGL, WebGPU, WebXR and glTF
https://playcanvas.com
MIT License
9.52k stars 1.33k forks source link

Animation system using curves, blending of multiple animations over time, blend trees and root motion #319

Closed whydoidoit closed 4 years ago

whydoidoit commented 9 years ago

The current animation system is pretty limited and it's hard to get great character effects due to the limitations around animation blends.

Suggest that the following is needed over time:

noahcoetsee commented 5 years ago

PLEASE, someone, integrate this. The engine is so powerful but without an easy way to integrate root motion and multiple animations on a skeleton, the animation system is pretty much useless for most character design.

There's no telling how important these features would be. Not to mention that @whydoidoit 's motion.js file is now broken and also can't help people anymore (it's not broken, the engine won't let you attach it to an entity).

I would appreciate any help if you could give it (especially maybe you, @whydoidoit , but nevertheless, I am forced to stop using this engine until I can successfully integrate root motion..)

Thanks, Guys!

willeastcott commented 5 years ago

Have you tried updating motion.js yourself?

We've been working on a replacement animation system here:

https://github.com/playcanvas/playcanvas-gltf/blob/master/src/playcanvas-anim.js

It supports animation curves and better animation crossfading. It should evolve into what is outlined in the OP.

noahcoetsee commented 5 years ago

Ok, I'll check it out. Looks pretty good! Is the animation crossfading planned to be implemented into the actual component ever, or just as a functional scripting component?

I understand what's going on in the code, but just to confirm, animation masking is not in this yet? Or is it already implemented under a different name (session curving)?

willeastcott commented 5 years ago

It will be brought into the mainline engine codebase as a 'true' component in the next few months, yes. As for whether it supports animation masking, I don't think so, but @thomasbiang can comment on that.

noahcoetsee commented 5 years ago

I know curving is a big deal in PlayCanvas, but I also see many unanswered questions (from last year mostly) about how to mask animations and layer animations, etc. I have also made a post in the forums about this. Maybe if you could help out and explain how to mask/layer animations on a skeleton, on this forum post? I just haven't seen any good explanations for a simple way to do this!

I'd really appreciate it if you could help me out with this!

https://forum.playcanvas.com/t/skeleton-blending/8055/2

thomasbiang commented 5 years ago

I think blending is supported https://github.com/playcanvas/playcanvas-gltf/blob/4f12805e95ec71b09c1d0cbe7644f47a09d478ba/src/playcanvas-anim.js#L1289 You can blend one animation clip or one curve (DOF). But currently it is not organized as a blend tree. It should be easy to add blend mask support.

noahcoetsee commented 5 years ago

@thomasbiang Thanks! That sounds pretty neat. If you need any help implementing the feature, I'm here. I have some previous experience working with the WhitestormJS folks off yonder, but I still have very little engine Javascript experience, so forgive me for my mistakes or stupidity 🤣

Of course, once this is integrated into Playcanvas, I can make a nice little tutorial about animation layering so that we can clear that confusion up once and for all.

Also: I know it would be a lot of trouble for either of you, but could you see what's going on with the forum link above? I would really appreciate any sort of explanation as to how the current playcanvas animation system handles simple animation layering! Thanks!

(Of course, if you're just going to work on implementing it in the gltf addon, then obviously don't bother wasting your time explaining it to me).

lol I can be confusing with these long and weird comments. Sorry about that.

noahcoetsee commented 5 years ago

Got it figured out! @yhydra helped me out

yhydra commented 5 years ago

https://github.com/yhydra/playcanvas-animator

If anyone else is looking for animation layering, avatar masking

thisredone commented 5 years ago

Are you guys still working on this?

slimbuck commented 4 years ago

Please note that glb animation support combined with this https://github.com/playcanvas/engine/pull/2007 is addressing many of the features requested here.

willeastcott commented 4 years ago

Good point @slimbuck. Although the new pc.AnimComponent doesn't include everything requested here, I think we should we should close this issue. A separate issue should be opened for each feature not included in #2007, and we can work through them one by one (e.g. IK, root motion compensation).