Jump to content

Blending two animations


PerEspen00
 Share

Recommended Posts

Hi,

 

I'm interested in having two animation playing at the same time. The main problem is that I want to be able to walk while attacking with my sword, but I can't do this since I don't have any animations for that. Is there any way to have half the body play a walking animation and half a sword attack?

 

Thanks!

Link to comment
Share on other sites

This is called split animation. Blending in the animation realm is something different. Find the bone at the highest hierarchy for lower body and save it off, and then find a bone at the highest hierarchy level for upper body and save it off. I think you should be able to call PlayAmimation() on each bone and it'll play that animation for it and it's children.

 

http://www.leadwerks.com/werkspace/page/api-reference/_/entity/entityplayanimation-r918

 

This does present other challenges such as syncing both when you are just running and not attacking. With the old AnimationManager, which you can still get I think, I would create one animation manager for the entire body and another for upper body only. With that we get to control what update function gets called first, so I would call the entire body animation manager update first and then the upper body last. What this means is when running the entire body animation plays and since there is no animation on the upper body it doesn't play but the entire body is playing run anyway. Then when the player shoots for example I'd play the shoot animation on the upper body. The entire body is still playing run but then just for the upper body those bone positions and rotations get overwritten with the shoot animation, and when shoot is done it stops playing anything on upper body and the entire body goes back into running again.

Link to comment
Share on other sites

Wouldn't it be possible to, during attacking, call the lower body and upper separately. But when running we call the parent object and set its animation to running for example? This would only require some syncing during the transition, but this might look fine due to the blending. I'll try it later. But thanks for the reply, this seems hopefull!

Link to comment
Share on other sites

How much would this type of process cost performance wise? Iterating through each bone would be a bit slow I would think. Im interested in this also. I want to improve my animation system.

 

I didn't mention anything about iterating through each bone though. If that's what LE does during animation then it is what it is, but to get the bones you need is a one time thing at start up that you store off. The you call PlayAnimation() on them just like you would if you did it on the entire model. The cost is whatever it takes to play an animation on a model * 2.

 

Wouldn't it be possible to, during attacking, call the lower body and upper separately. But when running we call the parent object and set its animation to running for example?

 

Given PlayAnimation() doesn't let you set the frame, then syncing doesn't seem possible with that system. You can of course roll your own using the core SetAnimationFrame() function. If you're looking for split animation it's probably best to do that so you have more control.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...