• Editor
  • Setting Up Animation to follow Cursor

  • Изменено
Related Discussions
...

So I have a character who uses a bow and arrow, and in the game, I want to be able to use the mouse cursor, or the right stick of a controller to aim the bow. Essentially I want the character to aim the bow wherever I point the mouse/stick, when you are holding down the aim button.

How do I set up my rig in Spine for this to work? I will be exporting it to Game Maker Studio 2.

Is this doable? Or do I need multiple animation angles for it to reference depending on where I'm aiming?

Depending on the art style and what looks good visually, you could have the torso inherit its rotation from a single IK bone. Then moving the IK handle around would cause the character to rotate up/down to aim toward the IK handle (assuming you aligned the handle that way initially). In GMS2, the goal would be to override control of that IK handle's position programmatically to line up with where you're aiming.

Alternatively (and this is the option that allows for more customized posing of the character from one extreme to another), you could have an animation for aiming up and an animation for aiming down, and blend between the two at runtime to hit the angles inbetween. For this approach, I sometimes also have a middle 'normal' straight ahead aiming animation inserted into the blend mix halfway, if there's any awkwardly interpolated posing that happens when just using up mixed with down.

Ahhh posted at the same time as Emjay!

Check out this post:
IK supported by runtimes and do I need the pro-version?
It explains 2 ways to do this and links to a web demo and example game that do it. Also the spineboy example project does it, open the Preview view and play the aim animation, then in the editor viewport (not Preview) drag the crosshair bone around. To easily find the crosshair bone using type-to-search, press enter, then type cr, press enter again (to select), then press escape (to deselect type-to-search).

Thanks so much!

Haha, and here I thought I'd save you or Erika a little effort by taking a moment to help out, Nate! But your response is definitely more helpful, since I hadn't even realized spineboy had the exact same aiming setup that I was describing. I've never even done that particular setup, so it was just theoretical on my part! Glad to see the logic of what I was imagining checks out in practice and is a recommended method. 😉