Advertisement Jump to content
Sign in to follow this  

2D bone animation - point gun at mouse

This topic is 687 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

How is this handled?

It's some form of kinematics which I kinda understand and I have a very solid grip of trig, but I don't know how to start with having both hands attached to a single weapon with each arm moving independently and the torso also moving to accommodate extreme angles. How would one keep the gun completely static (It appears to have an origin/rotation point at the shoulder) while having the arms bend with the hands static on the gun?

Is the gun rotated to point at the mouse and that motion propagates back through the arms? Or does it figure out where the gun needs to be pointed and then rotate the arms to match?

How is the movement handled for the torso? Is the torso only rotated when the arms reach a limit?


As you can see I have a lot of questions. I'd just like a starting point to begin with, or someone to suggest a way to approach it all. An example or tutorial would be great if you could point me to one.

What I'd like to avoid is using a third party program like DragonBones, Spriter or Spine. I'd like to start at the beginning of the problem to get a fuller understanding of it all.


Share this post

Link to post
Share on other sites
Some key principles to do this are: object rotation, animating in another objects space, and 2 bone IK

1. First imagine the aim vector itself is an object which is roatating and that you can "parent" the gun under it. This is important because you want the recoil to animate in the space of the aim vector.

2. Next, animate the hands relative to the gun.

3. Read Ryan Juckett's 2 bone IK article here

4. The torso does look like it is just lerping to a specific pose when the angle of the aim vector crosses the horizontal axis. This is a good, simple way to do it. If you want continuous smooth pose changes you need to set up a series of poses you blend between which have their blend weights driven by the aim angle.

Share this post

Link to post
Share on other sites

Looks like there's a center point and the two hand points rotate around it at a fixed distance to keep them aligned with the cursor. The rest is just inverse kinematics with the root in the hips.

Share this post

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

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. 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!