Spine Animaitons - Get the bone from an arm to follow the mouse

1.2k Views Asked by At

I am trying to get the arm in the spine animation to follow the mouse so it looks good when I shoot, here is an example of what I want it to do but using spine: https://www.youtube.com/watch?v=eofB2Z4-00w I have been looking through the code trying to find a specific method to develop a way to do this but have yet figured out a way!

Spine(http://esotericsoftware.com/) is an animation tool that I am using in unity for animations for a game that my team and I are developing. I am currently on the player controller and have been stuck on this part of the project for a week or so. I have developed a way to create a fire point using the bonefoller.cs script within spine-unity runtime, so it shoots from a specific position(Bone) that I set it to. Just need a way to let the arm from the shoulder to follow the exact position of the mouse so it works seamlessly. If there is anyone out there that has a background in using spine with unity that would be awesome to get some help from you! If there is also some documentation furthering my knowledge on how to do so that would also be accepted :) Thank-you in advance if you help me!!! :D

1

There are 1 best solutions below

0
On

You need to construct a vector that has its origin at the shoulder position and its end at the mouse position, and the same for the arm (origin at the shoulder, end at the hand). Determine the angle between the two vectors and perform the necessary rotation on the arm to close the gap between the two vectors.