Control Mixamo Characters with the Unity Input System

Start using Mixamo characters in your games. In this video I walk through how to download characters and animations from Miximao, import them into Unity, and control them with the Input System.
Download the unity package
drive.google.com/file/d/1o_ju...
Please consider supporting my work with the links below.
www.buymeacoffee.com/SodaRocket
www.paypal.com/donate?busines...
Chapters:
0:00 Intro
0:36 Scene Setup
0:55 Downloading and Importing a Character
2:36 Creating an Input Action Asset
4:38 Giving the Player Control
17:14 Easy Camera Follow with Cinemachine
18:25 Getting Animations from Mixamo
21:00 The Animator Controller
21:52 Transition Between Animations
24:28 Playing Animations Directly
25:10 Fixing the Jump Animation
25:26 Using Animation Events
26:38 Tweaking the Jump Animation
27:14 Outro

Пікірлер: 104

  • @galan2541
    @galan254111 күн бұрын

    Dude, thank you so much! Finally found the video w/o any useless explanation and just straight to the point! Subscribed 👏👏

  • @taimoori
    @taimoori2 жыл бұрын

    Amazing work and movement system setup. I was searching for this for months. Thanks ❤️

  • @sodarocketstudios

    @sodarocketstudios

    2 жыл бұрын

    Glad it helped!

  • @petethechin
    @petethechin Жыл бұрын

    Very Very helpful, TYVM

  • @johnpotesta3744
    @johnpotesta3744 Жыл бұрын

    Thank you

  • @jroc6745
    @jroc67452 жыл бұрын

    This helped me understand the input system better thank you. A request for a future video or series, a Sprint like GTA where you button mash. Nobody seems to have a video on button mash to sprint. They all use "hold shift down".

  • @sodarocketstudios

    @sodarocketstudios

    2 жыл бұрын

    My first thought for that is to create a speed multiplier variable with a default value of 1. Then everytime you press the button, you increase it by a small amount until it reaches the max value. To get the deceleration part, you could either subtract a small amount from the multiplier each frame (This would be a very linear deceleration). Or, maybe do something like Multiplier *= .9 I can think about it a bit more, but that would be my first approach.

  • @jroc6745

    @jroc6745

    2 жыл бұрын

    @@sodarocketstudios Thanks for the quick reply. Forgive me Im new so I understand what you're suggesting but not the code. Hopefully when you get time you can make a video on it. It would be something nobody else has covered. Thanks again tho. Peace

  • @manfredjohannes2771
    @manfredjohannes2771 Жыл бұрын

    love it

  • @juliaalder2007
    @juliaalder20072 жыл бұрын

    Thank you so much!!! :)

  • @sodarocketstudios

    @sodarocketstudios

    2 жыл бұрын

    No problem, I hope I covered everything you wanted to see.

  • @juliaalder2007

    @juliaalder2007

    2 жыл бұрын

    @@sodarocketstudios I'm working right now. Tomorrow I can watch the whole video. 🤗

  • @juliaalder2007

    @juliaalder2007

    2 жыл бұрын

    @@sodarocketstudios I really love it. It`s to the point and I understand everything you do. Thanks again!

  • @princekogaianmikoshi405
    @princekogaianmikoshi4052 жыл бұрын

    In the input control's where you made the jump function If I add in another a 3rd button F for Fly what button on a controller would you make it I was thinking L3 or so R3 can be dash or run

  • @sodarocketstudios

    @sodarocketstudios

    2 жыл бұрын

    You can use any button you want. Personally, I like the idea of reusing the jump button and in the OnJump method add, if (isGrounded) then jump else fly.

  • @1xMuchx1
    @1xMuchx12 жыл бұрын

    Great content and very nice explanation

  • @sodarocketstudios

    @sodarocketstudios

    2 жыл бұрын

    If you pass in a reference to the cinemachine virtual camera, you can adjust the z component of the follow offset to move the camera up and down. it might be easier to setup the camera like I do in this video kzread.info/dash/bejne/lqWauM6MqLK-pps.html.

  • @sodarocketstudios

    @sodarocketstudios

    2 жыл бұрын

    I created a unity package of the project and put a link to it in the description. You will need to make sure you install cinemachine and the input system package to get it to work right.

  • @VisualV.
    @VisualV.2 жыл бұрын

    Hi! First of a all, Great Video! The problem I'm facing is that OnJump function is not showing in player input events however the OnMove and OnLook are working perfectly fine! Any Idea What could be the reason for the same? Your Explanation is Top Notch and you earned yourself a subscriber!

  • @sodarocketstudios

    @sodarocketstudios

    2 жыл бұрын

    If you could paste the header of your on jump function, it might be a bit easier. The most basic errors I can think of that would cause that are having OnJump set to private, or if you have a parameter other than a callback context.

  • @VisualV.

    @VisualV.

    2 жыл бұрын

    @@sodarocketstudios Sure Let me get back to you👍

  • @phoenixcreations94
    @phoenixcreations942 ай бұрын

    The best tutorial ever, but one missimg thing sir, how can i make it from walking to running ? 😊

  • @sodarocketstudios

    @sodarocketstudios

    2 ай бұрын

    Thanks! I don't have a video on it, but what you are looking for are called blend trees. Then, you just need to multiply the speed by a sprint multiplier in the movement code.

  • @atulyadav1159
    @atulyadav11592 жыл бұрын

    @Soda Rocket Studios can you add video for third-person shooting controlling guns and animations.

  • @sodarocketstudios

    @sodarocketstudios

    2 жыл бұрын

    I can definitely start looking into it. I might do something a bit less specific to try and keep it useful for more people. This is just a guess, but I suspect that for something like guns, instead of making character animations for each specific gun, you could put target points on the gun and use inverse kinematics (I'm not an expert at animation, so this could be very wrong.). I played with that a tiny bit when I was making the Mixamo video. I can start researching, and, if it looks like an approach that makes sense, I can make a video explaining how to do it. If I covered third-person shooter controls, I might make it it's own video. Were you thinking things like how to aim and setup a crosshair, then how to determine what the player is shooting?

  • @atulyadav1159

    @atulyadav1159

    2 жыл бұрын

    @@sodarocketstudios thank you so much. Yes i was thinking about aim and shooting.

  • @sodarocketstudios

    @sodarocketstudios

    2 жыл бұрын

    I might try to do a video on the controls portion first. I think I would be able to get it out faster. I definetly recommend doing some research on it in the meantime if you need it soon.

  • @atulyadav1159

    @atulyadav1159

    2 жыл бұрын

    Sure i will do some research.

  • @dadsspaghetti9774
    @dadsspaghetti97742 жыл бұрын

    Hey man i know this is a dumb question but for some reason i cant find the onmove in the player input

  • @sodarocketstudios

    @sodarocketstudios

    2 жыл бұрын

    It's a function that you have to create before you can connect it to the input system. If you did make it, then make sure it is public. If you don't specify it is set to private by default and you won't be able to see it.

  • @traynorth83
    @traynorth834 ай бұрын

    how do i get the orientation box on character to its feet?

  • @sodarocketstudios

    @sodarocketstudios

    4 ай бұрын

    If you are talking about the collider, you should be able to move it around in the inspector until it matches up correctly.

  • @traynorth83

    @traynorth83

    4 ай бұрын

    @@sodarocketstudios No i mean the green ,red, and blue orientation box. mine is in the middle of my player.

  • @sodarocketstudios

    @sodarocketstudios

    4 ай бұрын

    The most common method is to create an empty parent object that contains the object with the player model as a child. Then, you can adjust the location of the child object with the model on it until the feet are on the ground.

  • @traynorth83

    @traynorth83

    4 ай бұрын

    @@sodarocketstudios thank you so much

  • @kurtlosbanos6123
    @kurtlosbanos61232 жыл бұрын

    Hi. I followed your tutorial until 8:31 but when I press the play button, it isn't my character that is moving but the camera itself. How to fix this? My camera is the one that is moving not the character.

  • @sodarocketstudios

    @sodarocketstudios

    2 жыл бұрын

    Did you attach the avatar controller script to the player instead of the camera?

  • @kurtlosbanos6123

    @kurtlosbanos6123

    2 жыл бұрын

    @@sodarocketstudios yes on the player. I attached it on the player. I just followed your instructions

  • @sodarocketstudios

    @sodarocketstudios

    2 жыл бұрын

    @@kurtlosbanos6123 I'm not sure how that happens since I use a character controller to move the character. Unless your character is a child object of the camera, but then both would be moving. are your character and camera two completely separate game objects?

  • @kurtlosbanos6123

    @kurtlosbanos6123

    2 жыл бұрын

    @@sodarocketstudios Yes they are separate. I would like to send you a picture but I don't know how and I cant comment pictures in youtube.

  • @vinesseyt
    @vinesseyt2 жыл бұрын

    Extra code for rotation? Using A and D from wasd

  • @sodarocketstudios

    @sodarocketstudios

    2 жыл бұрын

    instead of the mouse delta.x being added to the rotation vector, add the x component of the move input vector multiplied by some rotation speed value. I believe that will work. I am in a game jam right now, but If you need more help, I can try some things after this week.

  • @vinesseyt

    @vinesseyt

    2 жыл бұрын

    @@sodarocketstudios Yeah I am pretty stuck so I would love getting more help once you are free if that is possible

  • @sodarocketstudios

    @sodarocketstudios

    2 жыл бұрын

    @@vinesseyt The quick and dirty way you can accomplish this is to comment out ReadValue in the OnLook method, then in On move, change moveVector = context.ReadValue(); to moveVector.y = context.ReadValue().y; and right after that, add lookVector.x = context.ReadValue().x; Instead of telling the character to walk left or right, you are now telling the camera to rotate based on the A and D input. It will be very slow, so you may need to increase the sensitivity multiplier when setting the rotation.

  • @danishsaeed7969
    @danishsaeed7969 Жыл бұрын

    Jump is not working after I pressed Space button it didn't work??

  • @sodarocketstudios

    @sodarocketstudios

    Жыл бұрын

    The easiest way to fix it is to walk through each part and check it. I would start by making sure your input action is set up correctly. Then make sure you have connected the jump method to the jump action on the player input manager. If both of those are correct, then it is likely something wrong with the jump function. If it is a problem with code, I will need to know more to help.

  • @danishsaeed7969

    @danishsaeed7969

    Жыл бұрын

    @@sodarocketstudios Thanks of the reply, but I have corrected it on the moment 😊

  • @vinnaweng
    @vinnaweng Жыл бұрын

    Great tutorial, but jump seems not working. When I clicked on play, the character just kept flying and disappeared.

  • @sodarocketstudios

    @sodarocketstudios

    Жыл бұрын

    I'm guessing you got a sign wrong somewhere, make sure the gravity is applying a negative y to the velocity. I changed my mind on where I put the negative sign in the video, so I wouldn't be surprised if you set gravity as negative and then in the on move you have another negative sign canceling it out.

  • @vinnaweng

    @vinnaweng

    Жыл бұрын

    @@sodarocketstudios Thanks. I fixed the gravity sign. Your code works great! I added a mesh collider to the 3D scene, then the character won't keep falling out of the scene. :D

  • @AryanRekhi
    @AryanRekhi Жыл бұрын

    Can you please continue this tutorial to add a shift sprint and make this bit smooth

  • @sodarocketstudios

    @sodarocketstudios

    Жыл бұрын

    To add sprinting, you just need to change the movement speed when the sprint key is pressed.

  • @AryanRekhi

    @AryanRekhi

    Жыл бұрын

    @@sodarocketstudios what if statement where do a GetKeyDown press shift = increase the speed of the player and play the sprinting animation Will that work?

  • @sodarocketstudios

    @sodarocketstudios

    Жыл бұрын

    With how I setup the control script, I think the easiest way would be to add in a sprint input action. Then in the player controller script add an OnSprint function just like all of the other controls. In that function you will want to check the phase of the sprint button. If the phase is started(meaning the button was pressed) you can multiply the movement speed by some sprint speed multiplier. If the phase is canceled (meaning the button was released) you can then divide my that speed multiplier. So you will have: If(context.started) MovementSpeed*=sprintMultiplier If(context.canceled) MovementSpeed/=sprintMultiplier

  • @AryanRekhi

    @AryanRekhi

    Жыл бұрын

    @@sodarocketstudios is it possible that I can share my updated script with you on Twitter or something so that you can look into it , and if you can also tell me what could I change in animator window with sprint animation

  • @sodarocketstudios

    @sodarocketstudios

    Жыл бұрын

    On Twitter I am @SodaRocketDev. Or if you go to my channel, you can get my email (I don't want to put it in a comment to avoid bots). As for the animation part, I haven't done too much with animations so I can't tell you exactly what to do, but I can point you toward blend trees. I know there are several tutorials on them, and I think that might be what you are looking for.

  • @danishsaeed7969
    @danishsaeed7969 Жыл бұрын

    Hi, I didn't find that Input Actions?? Can anyone help me??

  • @ellavonck704

    @ellavonck704

    4 ай бұрын

    i know its a bit late but you need to install the input system package, package manager -> unity registry -> input system

  • @martinrodriguez2803
    @martinrodriguez2803 Жыл бұрын

    im having issues with the player controller script (not having the Move Speed*) and when i try to add the OnMove* to the Player Input/Events/Control, it doesnt pop up for me? could i have done the script wrong? im a first time use to unity so everything is new to me. Thank you in advance for the help

  • @sodarocketstudios

    @sodarocketstudios

    Жыл бұрын

    For the Move speed, do you have [SerializeField] before the vector declaration? I.e. [SerializeField] private float MoveSpeed; and for the onMove function you need to make sure you use the Public keyword so: public void OnMove. The other problem would be if the function doesn't accept a callback context. In that case you want it to look like this, OnMove(InputAction.CallbackContext context). I assumed you meant that these things weren't showing up in the inspector, which is the window in the unity editor that shows you all of the components on a selected game object. If that is the case, then it is most likely you are missing something I described above. Otherwise, I may have misunderstood your problem. If this doesn't fix your problems I can try to help you walk through it more.

  • @martinrodriguez2803

    @martinrodriguez2803

    Жыл бұрын

    ​@@sodarocketstudios yeah, I made sure the script matches what you provided, I wonder if it's because I'm using an updated version of unity? and yes if you are free to walk me through it would greatly appreciate it!

  • @sodarocketstudios

    @sodarocketstudios

    Жыл бұрын

    Let's start with the Move speed then, since it will probably be easier to solve. If you can give me some more detail on the problem, it will help me figure what is going on.

  • @martinrodriguez2803

    @martinrodriguez2803

    Жыл бұрын

    @@sodarocketstudios (using this code) using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.InputSystem; public class PlayerController : MonoBehaviour { [SerializeField] private float moveSpeed = 1; private Vector2 moveVector; private CharacterController characterController; // Start is called before the first frame update void Start() { characterController = GetComponent(); } // Update is called once per frame void Update() { Move(); } public void OnMove(InputAction.CallbackContext context) { moveVector = context.Readvalue(); } private void Move() { Vector3 move = transform.right*moveVector.x + transform.forward*moveVector.y; characterController.Move(move*moveSpeed*Time.deltaTime); } }

  • @sodarocketstudios

    @sodarocketstudios

    Жыл бұрын

    That was a tricky one to catch. The error was only useful for pointing out where it was, but I believe the issue is that you didn't capitalize the v in ReadValue in your OnMove function.

  • @elonmusk4823
    @elonmusk48232 жыл бұрын

    can i have that script it is hard to type pls

  • @sodarocketstudios

    @sodarocketstudios

    2 жыл бұрын

    I will put it up when I get a chance. Unfortunately I won't have access to the computer with the files for awhile.

  • @elonmusk4823
    @elonmusk48232 жыл бұрын

    pls put it in dicreption

  • @BenGodot
    @BenGodot2 жыл бұрын

    how would you do this for first person?

  • @sodarocketstudios

    @sodarocketstudios

    2 жыл бұрын

    The easiest way would be to create an empty game object under the character hierarchy. You will put this object where you want the eyes to be. then set the camera (Not a cinemachine virtual camera) as a child of the eyes object and set the position as (0,0,0).

  • @BenGodot

    @BenGodot

    2 жыл бұрын

    @@sodarocketstudios thank you!

  • @BenGodot

    @BenGodot

    2 жыл бұрын

    @@sodarocketstudios this works great, but the player starts to randomly move around unless you move forward and I'm not sure how to make it so you can look left and right

  • @sodarocketstudios

    @sodarocketstudios

    2 жыл бұрын

    @@BenGodot When you say it randomly moves, is it just walking on its own, or more like sliding? If it is walking around, then the only problem I can think of is that the motion vector isn't getting zeroed properly when you release the movement buttons. Looking left and right should be handled with the rotate method we created that will rotate the character around the y-axis. I am realizing now, that if you converted this controller to first person, then you wouldn't be able to look up and down, so you would need to add that by rotating the camera around its local x-axis based on the y value from the mouse delta. If you set it up to look up and down, but not left and right, then you want to rotate the character on the y-axis using the x component of the delta, and rotate the camera on its x-axis based on the y component of the mouse delta.

  • @BenGodot

    @BenGodot

    2 жыл бұрын

    @@sodarocketstudios thank you!

  • @GinesLA
    @GinesLA2 жыл бұрын

    jump dont works for me

  • @sodarocketstudios

    @sodarocketstudios

    2 жыл бұрын

    In what way does it not work? I can try to walk through it with you.

  • @torres5015
    @torres50152 жыл бұрын

    18:18 20:57

  • @samsg1538
    @samsg15382 жыл бұрын

    isnt working no clue what i did wrong

  • @samsg1538

    @samsg1538

    2 жыл бұрын

    followed all steps character wont move

  • @sodarocketstudios

    @sodarocketstudios

    2 жыл бұрын

    What part isn't working? It's possible that I had a mistake in the video, or something changed between different versions of unity. You aren't the only that seems to be having problems, so it might help others if we can work through it.

  • @samsg1538

    @samsg1538

    2 жыл бұрын

    @@sodarocketstudios im on unity 2021 so maybe thats why but i found a third person controller pack in the unity asset store so im using that now

  • @Rghad97
    @Rghad9711 ай бұрын

    25:59