Player Controller PART 2: How To Make Player Move (Tutorial)

This is the second part of our character controller tutorial.
In this video you'll learn how to make our player move, and how to switch between idle and walk Spine animations.
Hope you'll find it useful! 👍
As always, Russian titles available!
Субтитры на русском! 😉
Here's the link to the official Spine Unity Runtime documentation:
esotericsoftware.com/spine-uni...
_______________________
FOLLOW US
►Instagram:
/ thinkcitric
►Twitter:
/ citricthink
_______________________
MUSIC
Beach Buggy Ride by SIRPRICE / sirpricedj
Creative Commons - Attribution 3.0 Unported- CC BY 3.0
creativecommons.org/licenses/b...
Music promoted by Audio Library • Beach Buggy Ride - Ele...
#spine2d #unity2d #charactercontroller #unitytutorial #madewithunity #madewithspine #spineanimation #skeletonanimation #tutorial #howto #thinkcitric #gamedev #gamedevelopment #unity2019 #playercontroller

Пікірлер: 36

  • @ThinkCitric
    @ThinkCitric2 жыл бұрын

    Hey guys! There is a small issue that was brought up to me: if you set a different scale for your character in the Inspector, the controller script will set it back to 1. So, if you have this issue with scaling, here's what you can do: 1. Declare a new variable: private Vector3 characterScale; It will store the scale that you've configured in the editor. 2. In the Start method, let's set this new vector to this: characterScale = transform.localScale; So that at the start of each scene, the actual scale of the character is stored in this variable. 3. In the Move method, let's change the if(movement > 0) condition. Currently, it is if (movement > 0) { transform.localScale = new Vector2(1f, 1f); } else { transform.localScale = new Vector2(-1f, 1f); } But it should be: if (movement > 0) { transform.localScale = new Vector2(characterScale.x, characterScale.y); } else { transform.localScale = new Vector2(-characterScale.x, characterScale.y); } This will turn the character in accordance with the movement direction, and keep the scale that you've set in the Inspector. Hope it helps!

  • @austinnelsonart9413

    @austinnelsonart9413

    2 жыл бұрын

    Thank you!!

  • @user-qk4er7ve6d

    @user-qk4er7ve6d

    Жыл бұрын

    спасибо, помогло, жаль, что вы прекратили серию уроков, потому что мы так и не узнаем как сделать персонажу атаку...(

  • @ThinkCitric
    @ThinkCitric5 жыл бұрын

    Hey, thanks for watching! 🧡 Part 3 of this tutorial will be available by the end of the next week. Please feel free to ask me any questions!

  • @ThinkCitric

    @ThinkCitric

    5 жыл бұрын

    Hey everyone! As I've promised, part 3 is available here: kzread.info/dash/bejne/nIKmpdSyhZC0pps.html Enjoy! 🧡

  • @user-ng4uz5sk2z

    @user-ng4uz5sk2z

    2 жыл бұрын

    please tell me!I do other animations like the video of the jump, but the animation also only plays the 1st frame and not the entire animation (((How to fix it?

  • @kpickett9128
    @kpickett91282 жыл бұрын

    this tutorial is amazing! perfect intro to how to manipulate spine animations with code. thanks so much for making this!

  • @Chilzivi
    @Chilzivi3 жыл бұрын

    Great Tutorial, excellent pacing, all the details and on top soothing voice. Thanks for making these!

  • @user-ng4uz5sk2z

    @user-ng4uz5sk2z

    2 жыл бұрын

    please tell me!I do other animations like the video of the jump, but the animation also only plays the 1st frame and not the entire animation (((How to fix it?

  • @Chilzivi

    @Chilzivi

    2 жыл бұрын

    @@user-ng4uz5sk2z Sorry I'm not sure how to help with this issue. Maybe if you ask on the main comment thread Think Citric or others can help.

  • @vietanhnguyen1415
    @vietanhnguyen14152 жыл бұрын

    Your video is awesome, i wonder why it has so little likes, keep up your works

  • @stuff3862
    @stuff38624 жыл бұрын

    Hi I was wondering, can you layer animations like in the unity animator or no?

  • @ThinkCitric
    @ThinkCitric4 жыл бұрын

    Since many of you have asked, I've created a few Udemy courses on Spine! 💛 ► Spine Essential course: www.udemy.com/course/learn-2d-character-animation-for-games-in-spine-essential/?referralCode=828AEA929E30837D1F4F ► Spine Pro course: www.udemy.com/course/spine-pro-a-complete-2d-character-animation-guide/?referralCode=84DB13BBD24AC645D6EA

  • @kojirohiori666
    @kojirohiori6662 жыл бұрын

    Hi! Thanks so much for the tutorial! What to do if we need to add a new animation to the character?

  • @sarahtonpere9400
    @sarahtonpere94002 жыл бұрын

    H, thank you for your great tutorial. This has helped me a lot with th e project I'm working on. As I'm trying to ass more and more animations, some of them won't work. I noticed that the CurrentState in the Inspector is ALWAYS set to "Idle". Other animations like "Reloading" or "sliding" hence don't work. Do you have any tips for me ? Thanks a lot !

  • @oainsh
    @oainsh4 жыл бұрын

    Hey! I am trying to get this done as well. Since I had no background in animation, I have outsourced the actual animations and now trying to get them into Unity... I have a peculiar environment, though - it's 3D, but the character is in 2D. Built as a platformer, though. Would you be available for couple rarely specific questions? :)

  • @artof3dpen
    @artof3dpen3 жыл бұрын

    Can you explain how you got Player with Skeleton Mesh, Skeleton animation, Box Collider 2D and Rigibody?

  • @megadodd
    @megadodd5 жыл бұрын

    great tutorial!

  • @ThinkCitric

    @ThinkCitric

    5 жыл бұрын

    Thank you so much! :)

  • @user-ng4uz5sk2z

    @user-ng4uz5sk2z

    2 жыл бұрын

    please tell me!I do other animations like the video of the jump, but the animation also only plays the 1st frame and not the entire animation (((How to fix it?

  • @user-um5uf3vv5y
    @user-um5uf3vv5y2 жыл бұрын

    Hi I created individual spine projects for different actions of one game character. I wonder if i need to merge them and create only one atlas file.

  • @OtroFanDelPes
    @OtroFanDelPes4 жыл бұрын

    Hello, excellent tutorials, I hope you can do more about spine and unity. I wanted to ask you if it is possible to use cinemachine with spine skeleton, so that the camera follows the character. Thanks and regards from Argentina.

  • @ThinkCitric

    @ThinkCitric

    4 жыл бұрын

    Excellent question! Yes, it is possible, I use Cinemachine for all of my projects. You just need to drag your player object to the Follow option of your virtual camera. You can take a look at my 2D Camera Follow tutorial, I have Cinemachine and Spine-animated character there. Best of luck! :)

  • @user-ng4uz5sk2z

    @user-ng4uz5sk2z

    2 жыл бұрын

    please tell me!I do other animations like the video of the jump, but the animation also only plays the 1st frame and not the entire animation (((How to fix it?

  • @yellerdog
    @yellerdog3 ай бұрын

    Hello! Lovely tutorials, thank you so much! My character seems to automatically start walking to the left (and falling over) as soon as I hit Play. The falling has been solved by adding a Freeze Rotation constraint, but nothing seems to stop it from automatically walking off. What am I doing wrong here? I've applied the scale fix mentioned in the comments. public void Move() { movement = Input.GetAxis("Horizontal"); rigidbody.velocity = new Vector2(movement * speed, rigidbody.velocity.y); if (movement != 0) { SetCharacterState("Walking"); if (movement > 0) { transform.localScale = new Vector2(characterScale.x, characterScale.y); } else { transform.localScale = new Vector2(-characterScale.x, characterScale.y); }

  • @DannyOnateArt
    @DannyOnateArt9 ай бұрын

    great tutorial but i have one error, please help me. This is error: Assets\Scripts\Player_Controller.cs(28,49): error CS1503: Argument 2: cannot convert from 'UnityEngine.AnimationState' to 'string'

  • @mikegameartist6561
    @mikegameartist65614 жыл бұрын

    Hi thank you so much for the tutorials, I just started learning unity. i have a small programming background and i' wanna be an indie Developer (solo if possible). i started a C# course to refresh what i knew and also learn Unity Classes/Methods and all that stuff. problem is when i watched your tutorial and other people's videos online i got super overwhelmed with all the things i need to learn. and also the order of learning these things. currently as i said i'm focusing on C#, but i don't know what to do next. so please give me some advice thank you.

  • @ThinkCitric

    @ThinkCitric

    4 жыл бұрын

    Hi, first of all - best of luck on your indie path! :) I would suggest starting to build actual small games, you will learn a lot by doing that. Building a couple of levels of a platformer will teach you tons of stuff, and everything you've learned so far will come handy. And don't worry if you don't know something: you can fill the gap easily, there are plenty of free Unity tutorials available. It takes some baby steps at the beginning, but you'll get to your goal eventually. Again, best of luck!

  • @mikegameartist6561

    @mikegameartist6561

    4 жыл бұрын

    @@ThinkCitric Thanks for the quick answer, I'll do just that, again thanks and good luck you too. i'd like you to know that i'love your videos and i'm always waiting for more Vlogs and tutorials.

  • @nidhinmathew2925
    @nidhinmathew29253 жыл бұрын

    I need to add more animations state

  • @exmarxgames
    @exmarxgames4 жыл бұрын

    Problem, my animations do not want to switch even after making sure that the names are correct, any suggestions?

  • @ThinkCitric

    @ThinkCitric

    4 жыл бұрын

    Have you got any compiler errors in the script?

  • @exmarxgames

    @exmarxgames

    4 жыл бұрын

    Think Citric no compiler errors. It decides to not swap the animation even tho I have debugged to check the animation name and the string are the same. Just to give some insight of what I am trying to do: I am trying to create a player select screen that changes the animation of the current skeleton, I was hoping that there would be an easier way than having to create multiple different instances of the skeleton animation tied to a skin and have to toggle them on or off depending on whether they decide to change the character

  • @miloweigel5821
    @miloweigel58214 жыл бұрын

    how can i scale the Animation? if i scale the Player, the Animation is x1/y1.

  • @ThinkCitric

    @ThinkCitric

    4 жыл бұрын

    Tried that right now, if I scale the SkeletonAnimation object the animations are scaled as well. So, shouldn't be any problem with that. If you still experience any issues, I suggest to export your character from Spine at a desired scale. You can change this in Export -> Pack Settings.

  • @miloweigel5821

    @miloweigel5821

    4 жыл бұрын

    @@ThinkCitric thx :)