Sign in to follow this  
gcard28

animated character aiming

Recommended Posts

gcard28    171
Hi I am having a problem that I can't seem to find a solution to. Say I have an enemy AI soldier. He walks up to the player who is above him and takes aim at the character by raising his arms to the player's position. If the player jumps down from his ledge that AI player lowers his arms the appropriate amount so that he can aim at the player at his new posision. My question is I can find the angle and vector the enemy AI should shoot at but I have no idea how to translate this into something that will make the enemy AI move his arms and torso to match where he needs too shoot. Do I need to manualy move bones in the hierarchy in my model? Or is there a better easier way to do this? Thanks for anyones help!

Share this post


Link to post
Share on other sites
Qatal    127
It's been a while since I've done any character animation work (recent projects involved spacecraft, which dont need much skinning ;), but here's how i used to do it:

[There's most likely a better method now that people use]

- For the vertical range over which a character can aim, create a bunch of discrete poses (i used single-frame animations for this, but you can have some ambient animation in there too, for slightly wavering aim, etc.)

- Each pose aims at a particular 'ideal' angle relative to the xz plane.
- Work out the angle between the xz plane and your target

- Choose the two poses closest to that angle (there is one above, and one below)
- Linearly interpolate between them, based on the desired angle.

This is simple, fast, and works pretty well. If you have 5-6 poses, the linear interpolation isnt particularly noticeable either.

Let me know how it turns out for you :)

Regards,
Chris

Share this post


Link to post
Share on other sites
bennyW    140
Another way is to have two aiming anims. One that starts from the left at frame 0, and ends to the right at 1. Then another the starts from up at frame 0 and points down at frame 1.

What you can do then, is figure out where the player is within the enemy's min-max ranges for left and right, getting a value from 0 to 1. Plug that into your animation system for the left-right anim, do the same for the up and down anim. Your animation system takes care of the aiming for you, all you had to do is come up with some values to plug into it.

BennyW

Share this post


Link to post
Share on other sites
Guest Anonymous Poster   
Guest Anonymous Poster
I like the 2 frame animation method from BennyW. However is it possible to have smooth interpolation with only 2 keyframes.... the character will be moving and his target aim will change as a result. I just wonder if 2 frames are enough to generate the correct frame animations.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this