Hi,
we have a question concerning Phaser 2 runtimes. Is it possible to blend multiple animations into one.
So lets say the character is moving his body. On top of that we want to play various facial animations.
After searching for quite some time, I found this thread which shows that it seems to be possible in unity:
viewtopic.php?f=3&t=475
Can this be translated to phaser runtimes?
Kind regards,
Andreas
Phaser 2 - Blend animations together
Re: Phaser 2 - Blend animations together
Hello,
Currently there is no official support for such a feature. You are correct that it is available in Unity.
Having said that, it is not difficult to implement something quite similar ( if you have the cycles ) given
that fact that we provide full source access to the runtimes.
I suggest you can start off by understanding how a character is posed in Creature via the PoseCreature() function.
The key is to look at the part which says bone_override_callback. This is a callback function that you can override. Notice how it
gives you a dictionary of bones ( called the bone_map )
From there you can literally just write/modify in whatever values of each bone you want and this will change the pose of the character.
What you can do is thus to first switch to an active animation, set its runtime, step the animation by say 0.1 steps, then use the callback to collect all the poses of the bones in that current time for that animation. Repeat the same process, but now for other animations you care about. Once you have collected a pool of bone poses for the various animation clips, you pose the character again one final time and simply go into blend the various bone poses you collected together based on your custom weighting. This allows you to have a lot of flexibility and you can do even fancier stuff if you want.
Cheers
Currently there is no official support for such a feature. You are correct that it is available in Unity.
Having said that, it is not difficult to implement something quite similar ( if you have the cycles ) given
that fact that we provide full source access to the runtimes.
I suggest you can start off by understanding how a character is posed in Creature via the PoseCreature() function.
The key is to look at the part which says bone_override_callback. This is a callback function that you can override. Notice how it
gives you a dictionary of bones ( called the bone_map )
From there you can literally just write/modify in whatever values of each bone you want and this will change the pose of the character.
What you can do is thus to first switch to an active animation, set its runtime, step the animation by say 0.1 steps, then use the callback to collect all the poses of the bones in that current time for that animation. Repeat the same process, but now for other animations you care about. Once you have collected a pool of bone poses for the various animation clips, you pose the character again one final time and simply go into blend the various bone poses you collected together based on your custom weighting. This allows you to have a lot of flexibility and you can do even fancier stuff if you want.
Cheers
Re: Phaser 2 - Blend animations together
Hi Chong,
thanks a lot for your quick reply.
I took a closer look at the source code. I think I understand the approach you are describing. We are using typescript here. So I created a new Creature class that extends your class, in that class I created a new Manager which overrides the bones_override_callback.
So currently my code injection seems to run. Good start. I will tinker a little further and maybe ask you some questions on the go
Kind regards,
Andreas
thanks a lot for your quick reply.
I took a closer look at the source code. I think I understand the approach you are describing. We are using typescript here. So I created a new Creature class that extends your class, in that class I created a new Manager which overrides the bones_override_callback.
So currently my code injection seems to run. Good start. I will tinker a little further and maybe ask you some questions on the go

Kind regards,
Andreas
Re: Phaser 2 - Blend animations together
Hi Chong,
I wanted to report back and let you know that it worked out very well...
I am not yet finished completely. Bones animations are now properly overriding. Currently working on overriding mesh displacements. And after that region visibility and opacity. Which should not be to hard.
Once again, thanks for your support.
I wanted to report back and let you know that it worked out very well...
I am not yet finished completely. Bones animations are now properly overriding. Currently working on overriding mesh displacements. And after that region visibility and opacity. Which should not be to hard.
Once again, thanks for your support.