RickyRoaster

Well i have a character with all the animations, and i made the jump work, now i'm working on walking right and left.
I made this code, but here's what happens in the play mode:
I hold down a button "d" and the character walks right normaly, and when i realsese the button, the character would play an idle animation over the walking animation, and the character looks like it's freezed, but his head moves... How do i fix it ? Here's a code:
if (Input.GetKeyDown (KeyCode.D))
{
skeletonAnimation.state.SetAnimation (0, "Walking", true);
}
if (Input.GetKeyUp (KeyCode.D))
{
skeletonAnimation.state.SetAnimation (0, "Idle", true);
}
if (Input.GetKey (KeyCode.D))
{
transform.Translate (Vector2.right * WalkingSpeed * Time.deltaTime);
}
I realised that when i do the code under GetKey, it would try to do it repeatly which couses it to just freeze it, so i got it on keyDown, and to stop on KeyUp, and got the classic translate fuction under GetKey....
RickyRoaster
  • Posts: 16

Mitch

https://www.github.com/EsotericSoftware ... troller.cs

Check out the Spineboy example in the Spine runtime's.
User avatar
Mitch

Mitch
  • Posts: 974

RickyRoaster

Mitch wrote:https://www.github.com/EsotericSoftware/spine-runtimes/blob/master/spine-unity/Assets/Examples/Scripts/SpineboyController.cs

Check out the Spineboy example in the Spine runtime's.
I just tryed using that code, but just renaming the walk to "walking", and it does the same thing it did in my own one... What the hell is going on here ?

---

It's like freezing it to the last frame except doing the idle animation, but when i do the jump, it gets the idle animation normally after finishing the jump one, but the walking animation just freeze it to the one frame...

---

Hmm.. Well maybe there's like a command that will delete the animation from the track, so it doesen't bother the next ones that will be played ?

---

Yep, that is a problem, they are playing over eachothers, i need to clear the animations from the track first, then play it on the empty track, how do i do it ?

---

Or not.... The spineboy and it's controller works normally, but that script (spineboycontroller.cs) works the same as mine on walking, it freezes the last frame of the walking cept' getting it to idle... Please help guys, i don't know what's happening.
RickyRoaster
  • Posts: 16

Mitch

Can you post your character's exported JSON and Atlas files?
User avatar
Mitch

Mitch
  • Posts: 974

RickyRoaster

Mitch wrote:Can you post your character's exported JSON and Atlas files?
Sure, it's a fast made testing character anyway, just to get along with spine-unity, to see how everything works so yeah, this is my stupid a** testing character:

skeleton.atlas.txt


skeleton.json


skeleton.png


I know, i know it's retarded, i drew it myself, i repeat it's a testing character, untill i get my friend who is a great 2D artist.

---

I posted the image too in case someone has time to check everything and see what's a problem...


____________________________________________________________________________________________________
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
____________________________________________________________________________________________________

AND HERE'S A SCRIPT:

TestingChracterControl.cs
You do not have the required permissions to view the files attached to this post.
RickyRoaster
  • Posts: 16

Mitch

You need to set keyframes in your idle animation to put the legs where you want to put them. If you dont set them on Frame 0 then they will stay the way they were in the previous animation until you get to the next key.
User avatar
Mitch

Mitch
  • Posts: 974

RickyRoaster

Mitch wrote:You need to set keyframes in your idle animation to put the legs where you want to put them. If you dont set them on Frame 0 then they will stay the way they were in the previous animation until you get to the next key.
Umm.. Whaat ? ... I'm sorry man i just don't get it, what do i need to do exacly ? Thanks for taking your time anyways.
RickyRoaster
  • Posts: 16

Mitch

Open your spine project.

Go to Animate mode.

Select your Idle Animation

Go to frame 0

keyframe EVERYTHING on frame 0.

The Idle animation doesnt know what to do with the legs when you switch from Run to Idle because it doesn't have any keys.
User avatar
Mitch

Mitch
  • Posts: 974

RickyRoaster

Mitch wrote:Open your spine project.

Go to Animate mode.

Select your Idle Animation

Go to frame 0

keyframe EVERYTHING on frame 0.

The Idle animation doesnt know what to do with the legs when you switch from Run to Idle because it doesn't have any keys.
Oh yeah yeah yeah... I had some problems similliar to this before, and i realized that it's becouse i didn't put the start keyframe on the frame 0 first, so the part just teleported around it was all messy... Thank you man, i'm gonna try this out now.

---

Mitch wrote:Open your spine project.

Go to Animate mode.

Select your Idle Animation

Go to frame 0

keyframe EVERYTHING on frame 0.

The Idle animation doesnt know what to do with the legs when you switch from Run to Idle because it doesn't have any keys.
Mitch, my idle animation is keyframed on the frame 0 :/ , it's not that... I think every one of my animations needs to end with the idle's first keyframe so it ends up being good... That would be really annoying, i don't have time for it too... Might try another program.

---

Becouse all of the animations that ended difrrent from the idle's first keyframe, they just stay on their last frame. The jump one had the last keyframe like the idle's first, and it works normally becouse of that.. SO yeaaah... I'll try some more things that are in my head.

---

WAAAIT, meh god i'm just being stupid theese days xD ... Actually i just keyframed the foreground body parts, but the background ones stayed unkeyframed... This might work, and i'll do this for all the anims, becouse they might do the same becouse of it.... Thanks once again, i'll let you know if it fixed.
RickyRoaster
  • Posts: 16

Mitch

You're wrong... about a lot of things.

Please upload your Spine project file so I can help you.

edit

Missed your ninja edit. There you go.
User avatar
Mitch

Mitch
  • Posts: 974

RickyRoaster

Mitch wrote:You're wrong... about a lot of things.

Please upload your Spine project file so I can help you.

edit

Missed your ninja edit. There you go.
It's all working perfectly now, i keyframed everything, rotation and translate... I'd never came to this alone, thank you so much man :) !
RickyRoaster
  • Posts: 16


Return to Runtimes