Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

Making a Good Run/Walk Cycle
Started by Caleb P Jun 01 2015 10:07 AM

3 replies to this topic
spine run walk
[TOPIC CONTROLS]
This topic has been archived. This means that you cannot reply to this topic.
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

Caleb P

[GLOBAL: userInfoPane.html]
Caleb P
  • Corona Geek

  • 1,424 posts
  • Corona SDK

Ok, so I finally bought Spine a week or so ago, and I must say, it's really amazing and great.

 

I made a really neat run animation that looks great, and a really neat walk animation that looks great. My character runs/walks according to their current speed, controlled by a joystick. I set it to play the run animation if the speed is over a certain threshold, and the walk animation if it's under a certain threshold. I've added a mix between the two, as well as between them and the idle pose.

 

The problem is, when I try to change between the two, due to the mixing, if I go back and forth between speeds really quickly, the player animation kind of hovers between the two animations, with one leg out in a really weird-looking way. I can't just not mix the animations, because the "snapping" between them is unacceptable.

 

I think if I could edit the actual keyframes of the animation (as complicated as that could be), I'd be able to fix it by making the animation dynamic based on speed (similar to the way Link's is handled in Phantom Hourglass or Spirit Tracks - the faster you go, the farther and faster your arms and legs move and the faster your "hat thingy" flaps).

 

Unless there's another way? How are smooth transitions between animations that potentially go back and forth quickly done? I would really appreciate some help.

 

Has anyone done something like this before?

 

- Caleb



[TOPIC: post.html]
#2

thomas6

[GLOBAL: userInfoPane.html]
thomas6
  • Contributor

  • 982 posts
  • Corona SDK

Hi Caleb! In my view you're better off animating them yourself using sine waves. Here's a WIP-video that shows my run / walk cycle:

 

 

Cheers,

Thomas



[TOPIC: post.html]
#3

Caleb P

[GLOBAL: userInfoPane.html]
Caleb P
  • Corona Geek

  • 1,424 posts
  • Corona SDK

@thomas6:

Not an option for me. I already tried doing that, and, while I did end up making something that looked ok, I can't do that for all my animations. Plus, I really want to get my game done relatively soon.

 

Your animation looks cool, though :)

 

Is anyone else able to answer this? Surely someone else has done this same thing...?

 

- Caleb



[TOPIC: post.html]
#4

Caleb P

[GLOBAL: userInfoPane.html]
Caleb P
  • Corona Geek

  • 1,424 posts
  • Corona SDK

Ok. Whew. Finally got a good looking cycle going on my own.

 

Basically, for anyone wanting to do this, you'll need to ditch the AnimationState object and delve into plain ol' Animation. Unfortunately, the Spine Lua runtime doesn't work quite as it's described as working in the "Using Runtimes" doc (that is, some of the function arguments are incorrect), so you'll need to look at the Animation.lua code your self.

 

I ended up perpetually playing the walk animation, and blending the run animation with the walk animation based on the current magnitude of the joystick. Which sounds really simple, but isn't really in practice. Also, to get a smooth transition between the two, you'll need to set up a constantly updating "current mix level" parameter that slowly moves towards whatever magnitude your joystick is and use that for the mix.

 

That sounds super arcane, but if someone struggles with this, I'll be willing to share some more information.

 

- Caleb




[topic_controls]
[/topic_controls]