Jump to content

Animation bone set (animation "expressions")


Christian Clavet
 Share

Recommended Posts

HI, Perhaps a similar feature already exist, but I've not seen it from the docs. Sorry if something like this already exists.

 

When I was modding SourceSDK characters, we could use a reference pose, then based on that reference pose, have a "AIM" animation, and a walk cycle, or run cycle then by "expressions" (from what I remember from the MDL compiler script), we could use them separately. The expression then on SourceSDK was kind of complicated for the AIM because we had to blend calculate the position from the mouse rotation (aimfront - aimleft for example and to find the position calculate the blend value to find the approximate frame)

 

For this to work, a reference frame needed to be defined. The animator had to take the reference pose and make all the different animations.

 

I was thinking of something that in the model editor could select a set of bones and assign them to a specific animation (or animation expression). Then a command in LUA or C++ (Not checked yet how Leadwerks call the animations, but we could call something like this:

 

animate (CYCLE_WALK+AIM_FRONT)

This would select the walk cycle for the legs and aiming at the front for the arms.

 

If there nothing like this yet, this could be really nice to have, and for example, we could trigger a expression change (mean face expression like fear) when the character is hit, or angry when the character attack.

 

Without this, there is a way, but the character must be made "in parts" and theses parts must be attached to bones.

 

A little out of this topic, I have a question: can we take a animation from another model an apply it to a active one. (Like the animator would create each animation inside a separate file). Would this could work, or we require to have all the animation inside a single file?

Link to comment
Share on other sites

So I think you are talking about split animation. Basically where you play different animations on different bones. The way you would do this today would be in code not in any setup of the model. I've done this with my own animation code but I think you should be able to do it with the current AnimationManager class that the enemy AI script uses.

 

You can find a bone by it's name with:

 

self.spine = self.entity:FindChild("bonename")

 

Then you should be able to make 2 instances of the AnimationManager class. One will be for the entire model and the other will be for the upper 1/2 (which you'll find some kind of spine bone for).

 

So now you always play the "base" animation manager first and the "spine" one second. So then you can play the "run" animation on the entire base, and in the same frame play the "shoot" animation on just the spine (or whatever bone would control the top part of the body). This "top" part will overwrite the values that the base did for the top part only and so you've now split the animation.

 

You can also, in the Script:Draw() AFTER calling animation managers Update() method, rotate bones around to make the character lean if turning and so on.

 

You could also play for only the top 1/2 and bottom 1/2 instead of the base (total body) and top 1/2. This should save you calculations as playing for the entire body then overwriting for the top 1/2 wasted some calcs that never got seen. How you transition back to entire body though can be a little trickier as you would want them to, say, go back to animation after reloading on the top 1/2, but if they are separate you'd want to sync them so they are both on the same frame to look normal. If you play the entire base, then you don't have to sync them, but just stop playing the reload and the base will blend back in for the entire animation ensuring everything is in sync.

  • Upvote 3
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...