Jump to content
  • Advertisement
Sign in to follow this  

Dynamic Aim/up Down Animations?

This topic is 860 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts



I have a character with an aim straight and fire handgun straight animations. I want him to also be able to aim down/up and fire from those poses too. Think Resident Evil 1/2/3.


I'm trying to find a way to do it dynamically to save time and effort for my animator. I was thinking I could dynamically have the upper part of the character body aim up/down and blend in additive the fire/shooting animation.


I'm not sure how to go about having him aim up/down. Do I have to write an IK system for this or is there a more straight-forward solution?


Any books, links, hints or pointers on the subject are appreciated.


Share this post

Link to post
Share on other sites

Do you know about matrices? 

You could seperatly adjust the model matrix according to your aiming.


And try looking at Skeletal animation, it can also be done via shaders. 


What kind of library/engine are you using? 

Share this post

Link to post
Share on other sites

I suppose this is a little bit a trial and error process.You can figure out a strategy but you never know how good it looks before you have implemented.

The first thing I would try is to have a separate basic weapon animation and shot animation.

The basic weapon aim could have different segments for "taking out the weapon", "transition all the way from aiming up to aiming down", "reload", etc..

When the weapon fires I would override the wrist rotation with data from the shot animation.

Also, if you want the animation to be more rich and involve the arm and forearm you could examine which kind of rotation the recoil causes on those bones and apply it manually.

On my engine in pseudocode this would look about like this and should be executed at each frame.

Apply_kf_animation(name=up_down_aim, frame = somelinearfunction(aiming_angle), root = character_root);  // resets to the aiming position
if (time_from_trigger < animation_time) {
   Apply_kf_animation(name = wrist_shot, frame = some_exponentialdecay(time_from_trigger), root = character_wrist).
   Apply_rotation(joint = arm, axis = ?, some_exponentialdecay(time_from_trigger) * RECOIL_ON_ARM);
   Apply_rotation(joint = forearm, axis = ?, some_exponentialdecay(time_from_trigger) * RECOIL_ON_FOREARM);

Again, I dont' know if this is good enough but is the first thing I would try.

Then much depend on what your engine has to offer.

If your engine has Ik, just apply the movement to the handgun and let it figure out the rest.

Share this post

Link to post
Share on other sites

Any books, links, hints or pointers on the subject are appreciated.


It might be useful to know the libraries or engines you are using.


Without knowing details about your system, my thoughts are:


* Subdivide the screen to x grid zones (probably 9) to detect the reticle or mouse location. Use that to figure out where to point the arrow. 


* Use animation blending or blend trees or whatever your system names it to make it pretty. The animator is likely making a base idle animation with tiny motions, an animation for swinging the weapon while walking, another animation for swinging the weapon while running. Add in another set to blend in to move between the current mouse location. Perhaps those would be blend left, blend right, blend up, blend down.


* Alternatively, using a floating position for 'forward' you can use a joint on your model as your forward direction. Lerp that coordinate toward whatever zone matches it.  If they're in the upper-left zone, lerp the joint to that coordinate. If they move the mouse to the lower right corner, lerp there. If they move in large arks you'll be lerping all through the zone.  This could work well for a large number of zones.


* Alternatively, if your model is using IK already figure out the bone they're using and do basically the same thing, moving your position and letting physics solve it.


* Alternatively, rotate the model directly.

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!