I've seen a ton of movement tutorials and tried out many things but this one was really the best one I've come by! Great stuff, next up is your 3rd person camera tutorial!
Yes, I agree! I spent 5 days trying to find one like this for bolt, but I had to get C# for this one so I held off for a while, but then I realized I didn't need to learn and just gain knowledge from this.
You are my new favorite youtuber, no over exaggerating. Thank you so much!!! I have one question, how to I make my "Player" be able to interfere with objects, such as push cubes around?
I use the "Rigidbidy" component istahead of the "Character controller". It makes it easier to understand and you don't have to do much calculations. You can move stuff around, and it detects collisions very well. You don't go through walls xD
I realized I could have answered this question. You can use sphere colliders as triggers around the game objects to allow them to be interactable. If the Player is inside the collider, show a text that says Press E to Interact and then inside onTriggerStay detect the input and do whatever you want the interaction to do. Good luck!
It's a really good tutorial. However, the variable "_directionY" keeps increasing it's value until you jump. So, if you fall from any lengh without jumping, you will fall very fast.
hey bro, you have to set yVelocity to 0 if controller.IsGrounded == true, it prevents it keep adding velocity even it's touching the ground, hope it helps you
very good tutorial also slow which isn't bad because I don't need to pause the video every millisecond to follow along. certainly have a like and sub for me.Thank you!
do you happen know how to add a 3rd (triple) jump where you can continuosly jump across like in metroid. my only thought was to add an ienumerator and wait a sec(s) to accomplish it? can you delay the next line of code (in Update) so it gives the character time to jump before triple jumping? if I just copy your code and place it below it just hits jump twice basically at the same time is there any way to amend it to keep the original double jump but then have a continuous metroid jump after the 2nd jump? all I did was add the name of multiplier and bool putting canTripleJump and TripleJumpMultiplier.
I'm having an issue here. When I use move like that, it just warps me to that position, rather than giving me the nice upwards arc as if I've jumped. So gravity still works, bringing the character controller downwards after jumping, but the initial move is just a teleport to a higher position, rather than a jump.
Hello i really love your videos, they are simple and get straight to the point, i was wondering if you're going to expand this type of character controller? by adding collisions and camera control
Hi, jump is working, But i have one problem. Its too fast. When i reduced gravity, jump is higher, not slower. How can I make the jump slower without changing anything in gravity and directionY?
How do you get the Character Controller to collide with non-Rigidbody objects? My capsule dude just falls through the floor. It will push Rigidbodies around, but it ghosts through any sort of wall or static object.
really good video but i have one question, how do i make it so when walking off a platform works with the gravity, right now it's just falling straight down instead of slowly falling.
Hey, I'm attempting to make a space game. How would I go by making no gravity movements with rotational movements? So like I can go completely upside down and my camera would follow.
You can check Edit -> Project Settings -> Input Manager to see if there is a key binding for Jump. There should be a default key binding named Jump with Space as its key.
i ran into a promblem where when i took the C# script and dragged it to the player it said "the script don't inherit a native class that can manage a script" and i have no idea what that means or how to fix it can someone please help me?
eline sağlık çok güzel olmuş. Bir sorum olacak karakter kontrolünü yaptıktan sonra farkettim ki aynı anda 2 yönde ilerleyince( ileri ve sağ örnek olarak) hız iki katına çıkıyor bunu nasıl fixleyebiliriz acaba?
Çok teşekkürler. Bahsettiğin sorunu anladım. Çözüm için direction ve moveSpeed çarpımından sonra normalize metodu kullanılabilir. İlk aklıma gelen bu oldu. Deneme fırsatım olduğunda daha net bir cevap verebilirim. Şimdilik umarım yardımcı olur.
i can jump more than 2 times in a row, can jump in the air permanently, how do i set to jump only 2 times and then have to be on the ground before i can jump again?
Does this apply to first person or only to third person games? I tried to use this in my first person game and it is not working. I think it has something to do with the camera moving, but the character still responding to the commands in the way it is programmed to. For example, I can face to the left and press W, but this would make me to into the right. Can anyone tell me how to solve this, I am new to Unity.
Thank you mate. It's very simple method. Devamını bekliyoruz. Can you show us Third Person Jump while running with animation?(like mixamo characters). Abone olundu bildirim açıldı.
it's called _snakeCase. It's just a naming convention people use usually for private variables, then camelCase is for public variables. You don't have to do it, some people just like to organize it that way.
direction.y is causing a bug like it doesn't exist lol any idea what else i can use trying to merge it with my own script ignore the player bit im trying to see if it works by tag using UnityEngine; public class charactercontroller1 : MonoBehaviour { public Rigidbody rb; public Rigidbody rb2; [SerializeField] public float speed = 4f; public float rotationspeed = 80; float rot = 0f; [SerializeField] public float gravity = 8; Vector3 moveDir = Vector3.zero; private Vector3 Jump; public float jumph; [SerializeField] public float jumpforce = 3.5f; CharacterController controller; Animator animator; // Start is called before the first frame update void Start() { Jump = new Vector3(0f, jumph, 0f); controller = GetComponent(); animator = GetComponent(); } // Update is called once per frame void Update() { Player.Position.y -= gravity; if (controller.isGrounded) { if (Input.GetKey("w")) { animator.SetInteger("condition", 1); moveDir = new Vector3(0, 0, 1); moveDir *= speed; moveDir = transform.TransformDirection(moveDir); } if (Input.GetKeyUp("w")) { animator.SetInteger("condition", 0); moveDir = new Vector3(0, 0, 0); }
does not work errors appear here the errors Assets\scrpts\Movement.cs(12,58): error CS1002: ; expected Assets\scrpts\Movement.cs(7,44): error CS1519: Invalid token ';' in class, struct, or interface member declaration Assets\scrpts\Movement.cs(7,33): error CS1002: ; expected heres the code using System.Collections; using System.Collections.Generic; using UnityEngine; public class Movement : MonoBehaviour { Private CharecterController _controller; // Start is called before the first frame update void Start() { _controller = GetComponent() } // Update is called once per frame void Update() {
Hey dude! When I write the script it gives me an error and it says "Error CS1061 'ThirdPersonMovement' does not contain a definition for 'moveDir' and no accessible extension method 'moveDir' accepting a first argument of type 'ThirdPersonMovement' could be found (are you missing a using directive or an assembly reference?)" How can I fix this?
@@DenizSimsek Well I did create a "float moveDir" or something like that a week ago to try and see if I can fix it and the error went away but the dash didn't work... Propably did it wrong lol So how should I do it?
@James Thwaites Thank you a lot but I am really just messing around and learning stuff right now... It's really to early for me to say that I will make a game so I am just collecting skills and knowledge!
@James Thwaites Understandable! I agree with everything you said but I just need a little more practice but nonetheless... Thank you for your motivational words! Also timed dash? You mean dashing with cooldown where you can't spam it? Can you maybe show me that code chief 👀?
why is my life such a failiure? i tried about 6 character controller videos in unity and NONE OF THEM work. i've spent days of my life trying to become a programmer and i always fail
You spend your time learning Unity and programming. You are already cooler than many people I know. Try to look at the learning phase as a continuous improvement. You are not becoming anything, you’re just getting better and better. If something doesn’t work, try to relax for a bit. Maybe do something else. And then try to understand where is the problem. Think about what your are trying to do, then how you are trying to achieve it. Read the code line by line and try to reason the output.
@@justanothercc enjoy the failure, even senior devs often feel like they have no clue wtf they're doing. If you think that there's ever a point where things work the first time you're wrong. Being a programmer is just becoming a professional problem solver/debugger. If you don't like that find something else to do
Thanks for the tutorial.
For anyone wondering, the double jump bit starts at 9:30
Watched so many tutorials just wanted to stop the infinite jump thank you very much for this video.
I've seen a ton of movement tutorials and tried out many things but this one was really the best one I've come by! Great stuff, next up is your 3rd person camera tutorial!
Yes, I agree! I spent 5 days trying to find one like this for bolt, but I had to get C# for this one so I held off for a while, but then I realized I didn't need to learn and just gain knowledge from this.
Dude. You explain in a very detailed way! Really nice video!
You are my new favorite youtuber, no over exaggerating. Thank you so much!!!
I have one question, how to I make my "Player" be able to interfere with objects, such as push cubes around?
Thank you very much for your comments! I will extend this series with the topics like intearacting objects and NPCs.
I use the "Rigidbidy" component istahead of the "Character controller". It makes it easier to understand and you don't have to do much calculations. You can move stuff around, and it detects collisions very well.
You don't go through walls xD
I realized I could have answered this question. You can use sphere colliders as triggers around the game objects to allow them to be interactable. If the Player is inside the collider, show a text that says Press E to Interact and then inside onTriggerStay detect the input and do whatever you want the interaction to do. Good luck!
I think you can just add a Rigidbody to the object you want to move. I don't know if you have to toggle "Is Kinematic".
@@ATdeVerdad1 its okay this comment was 7 months ago
i didnt exactly do what you did, and idk what exactly i did but im able to double jump now, thx!!
the code i was using before watching your video was from here --> ruclips.net/video/tXDgSGOEatk/видео.html
I cannot tell you how much this helped thanksss
Best video about character control that I have ever seen.
Great video, can't wait for the camera tutorial :D
xD you just need to put the camera in the character
Finally, something that works 100%, thank you so much! :)
I love the birds in the background
Great starting place, thanks man
your video was the only one that worked, Thanks!
Thank you, you are the best!
Thank you for tutorial.
i love this video, really really clean and clear
It's a really good tutorial. However, the variable "_directionY" keeps increasing it's value until you jump. So, if you fall from any lengh without jumping, you will fall very fast.
hey bro, you have to set yVelocity to 0 if controller.IsGrounded == true, it prevents it keep adding velocity even it's touching the ground, hope it helps you
@@LuonLDC helped me, thanks!
very good tutorial also slow which isn't bad because I don't need to pause the video every millisecond to follow along.
certainly have a like and sub for me.Thank you!
You're a life saver!
Thank you for this! Liked not just because it's helpful, but because I didn't know about the serialize field thing.
Very helpful, thanks!
well explained... !!
tebrikler kardeşim
do you happen know how to add a 3rd (triple) jump where you can continuosly jump across like in metroid. my only thought was to add an ienumerator and wait a sec(s) to accomplish it? can you delay the next line of code (in Update) so it gives the character time to jump before triple jumping? if I just copy your code and place it below it just hits jump twice basically at the same time is there any way to amend it to keep the original double jump but then have a continuous metroid jump after the 2nd jump? all I did was add the name of multiplier and bool putting canTripleJump and TripleJumpMultiplier.
the madlad is back!
I'm having an issue here. When I use move like that, it just warps me to that position, rather than giving me the nice upwards arc as if I've jumped. So gravity still works, bringing the character controller downwards after jumping, but the initial move is just a teleport to a higher position, rather than a jump.
Thanks dude, this helped a lot!
Thanks for this, this video together with brackeys' third person controller gave me the insight on how to squish a lot of bugs.
i luv you!!!!! this is what i found! thx you
Hello i really love your videos, they are simple and get straight to the point, i was wondering if you're going to expand this type of character controller? by adding collisions and camera control
thank you this helped me a lot
So cool man
Thanks man!
thanks, your video enlighten me!!
That helped a lot thank you
Hi, jump is working, But i have one problem. Its too fast. When i reduced gravity, jump is higher, not slower. How can I make the jump slower without changing anything in gravity and directionY?
I did the same script but my Player falls quickly after moving off of an object.
Help!!
Its always a helper😇
Needed to know if i should use rigidbody or this instead but now i know how to use both
How do you get the Character Controller to collide with non-Rigidbody objects? My capsule dude just falls through the floor. It will push Rigidbodies around, but it ghosts through any sort of wall or static object.
Thank you for this, really helped! :DD
wow thanks a lot for this!
ty mate realy healpfull
I need to ask, how do i fix vertical axis not setup
Make sure Vertical is capitalized when its used in the string. It cannot be lower case or else it will throw that error.
Too bad you aren't using the new input system. Great video though.
Thank you helped a lot !:)
dude im pretty new but im 50% sure that @ 7:51 instead of making it a serilized feild you could have just changed it to public
really good video but i have one question, how do i make it so when walking off a platform works with the gravity, right now it's just falling straight down instead of slowly falling.
How do you save the codes for some reason I’m dumb
ctrl + s
thanks for help me basic knowlge
tysm!!!! your a life saver!
Thanks a lot!
How can i make the player slightly lose control when they jump?
When i put the direction.y -= gravity;
Line my player goes forward by himself. Does anyone know why?
Yep, I have the same problem
Hi thanks for the vid very nice
Hey, I'm attempting to make a space game. How would I go by making no gravity movements with rotational movements? So like I can go completely upside down and my camera would follow.
Is it 2D or 3D?
Look at brackeys tutorial How To Make A Game, I think episode 4, camera follow
i think you would stick the camera with your player
it always says the associated script can not be loaded.please fix any compile errors and assign a valid script how do i fix this
Make sure the name of the script is the same as the Monobehaviour class
I don't know what to press if I want to jump ( No button is working ). Can you help me because I can't move further? Thanks🔥
just press space lmao
also he puts "jump" as a place holder. you can put any key in there instead like "space" or "z" or ""y anything as long as you type it right.
You can check Edit -> Project Settings -> Input Manager to see if there is a key binding for Jump. There should be a default key binding named Jump with Space as its key.
Is it possible to remove the character move portion of the script and only leave in the double jump? It's interfering with my animator movement setup.
i ran into a promblem where when i took the C# script and dragged it to the player it said "the script don't inherit a native class that can manage a script" and i have no idea what that means or how to fix it can someone please help me?
but when i fall it is way too fast, how do i fix this?
Same prop
i thought this wouldent work because its 8 months old but it did
Thanks man, you're great!
I keep getting a CS0103: The name ‘_controller’ does not exist? What did I do wrong? I followed your scripted and it does not work.
okay I've had this thing with every script for third person I've tried the controls are inverted
mine is still having mistakes
eline sağlık çok güzel olmuş. Bir sorum olacak karakter kontrolünü yaptıktan sonra farkettim ki aynı anda 2 yönde ilerleyince( ileri ve sağ örnek olarak) hız iki katına çıkıyor bunu nasıl fixleyebiliriz acaba?
Çok teşekkürler. Bahsettiğin sorunu anladım. Çözüm için direction ve moveSpeed çarpımından sonra normalize metodu kullanılabilir. İlk aklıma gelen bu oldu. Deneme fırsatım olduğunda daha net bir cevap verebilirim. Şimdilik umarım yardımcı olur.
i can jump more than 2 times in a row, can jump in the air permanently, how do i set to jump only 2 times and then have to be on the ground before i can jump again?
Make sure that the if statement Conditions has a boolean state to either true or false then execute have the oppsites of that.
Does this apply to first person or only to third person games? I tried to use this in my first person game and it is not working. I think it has something to do with the camera moving, but the character still responding to the commands in the way it is programmed to. For example, I can face to the left and press W, but this would make me to into the right. Can anyone tell me how to solve this, I am new to Unity.
And my player falls too fast only when they walk off a plane Help me!
Uh if it falls it does that and that mean it has gravity
@@buffalo5357 How to fix it
@@sunce4030 lower the gravity
after i implement it my character start floating
how to rortate
When I put this in, for some reason it moves me on the X axis rather than the y, I can't figure out why.
I think you can change the location of x and y in coding. like x 1 bla bla y 2 bla bla = y 1 bla bla bla ...
Please make on video on fps controller
4:40 name of this app?
Visual Studio Code
Thank you mate. It's very simple method. Devamını bekliyoruz. Can you show us Third Person Jump while running with animation?(like mixamo characters). Abone olundu bildirim açıldı.
The gravity with controller.move does not work with me, here i have to use controller.SimpleMove instead
i haw a bug when i am going to forward and i am turning my camera in the game i am loking my foeward but cube going rearward
help me pls
why are there underscores in there code?
it's called _snakeCase. It's just a naming convention people use usually for private variables, then camelCase is for public variables.
You don't have to do it, some people just like to organize it that way.
1:24 It's not a capsule it's a BEAN
ağzına sağlık
direction.y is causing a bug like it doesn't exist lol any idea what else i can use trying to merge it with my own script ignore the player bit im trying to see if it works by tag
using UnityEngine;
public class charactercontroller1 : MonoBehaviour
{
public Rigidbody rb;
public Rigidbody rb2;
[SerializeField]
public float speed = 4f;
public float rotationspeed = 80;
float rot = 0f;
[SerializeField]
public float gravity = 8;
Vector3 moveDir = Vector3.zero;
private Vector3 Jump;
public float jumph;
[SerializeField]
public float jumpforce = 3.5f;
CharacterController controller;
Animator animator;
// Start is called before the first frame update
void Start()
{
Jump = new Vector3(0f, jumph, 0f);
controller = GetComponent();
animator = GetComponent();
}
// Update is called once per frame
void Update()
{
Player.Position.y -= gravity;
if (controller.isGrounded)
{
if (Input.GetKey("w"))
{
animator.SetInteger("condition", 1);
moveDir = new Vector3(0, 0, 1);
moveDir *= speed;
moveDir = transform.TransformDirection(moveDir);
}
if (Input.GetKeyUp("w"))
{
animator.SetInteger("condition", 0);
moveDir = new Vector3(0, 0, 0);
}
if (rb.velocity.y == 0)
{
if(Input.GetButtonDown("Jump"))
{
Player.Position.y = jumpforce;
}
}
}
rot += Input.GetAxis("Horizontal") * rotationspeed * Time.deltaTime;
transform.eulerAngles = new Vector3(0, rot, 0);
moveDir.y -= gravity * Time.deltaTime;
controller.Move(moveDir * Time.deltaTime);
}
}
16:06 you could just use an else if statement haha, don't have to put and if inside an else clause.
does not work
errors appear here the errors
Assets\scrpts\Movement.cs(12,58): error CS1002: ; expected
Assets\scrpts\Movement.cs(7,44): error CS1519: Invalid token ';' in class, struct, or interface member declaration
Assets\scrpts\Movement.cs(7,33): error CS1002: ; expected
heres the code
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Movement : MonoBehaviour
{
Private CharecterController _controller;
// Start is called before the first frame update
void Start()
{
_controller = GetComponent()
}
// Update is called once per frame
void Update()
{
}
}
This happens to everyone, beginners and advanced programmers...
The line... _controller = GetComponent() ... needs a ";" at the end of the code.
that gravity is not working
I just fall from the edges like a giant rock
Why at 14:41 both directionY at line 36, and the vector at line 40 are multiplied by Time.deltatime? isn't enough to apply in one row OR the other?
Hey dude!
When I write the script it gives me an error and it says
"Error CS1061 'ThirdPersonMovement' does not contain a definition for 'moveDir' and no accessible extension method 'moveDir' accepting a first argument of type 'ThirdPersonMovement' could be found (are you missing a using directive or an assembly reference?)"
How can I fix this?
Did you create a variable called moveDir inside the script?
@@DenizSimsek Well I did create a "float moveDir" or something like that a week ago to try and see if I can fix it and the error went away but the dash didn't work...
Propably did it wrong lol
So how should I do it?
@James Thwaites Thanks but I have already fixed it XD
@James Thwaites Thank you a lot but I am really just messing around and learning stuff right now...
It's really to early for me to say that I will make a game so I am just collecting skills and knowledge!
@James Thwaites Understandable!
I agree with everything you said but I just need a little more practice but nonetheless...
Thank you for your motivational words!
Also timed dash?
You mean dashing with cooldown where you can't spam it?
Can you maybe show me that code chief 👀?
Sorry it didnt work
why is my life such a failiure?
i tried about 6 character controller videos in unity and NONE OF THEM work.
i've spent days of my life trying to become a programmer and i always fail
You spend your time learning Unity and programming. You are already cooler than many people I know. Try to look at the learning phase as a continuous improvement. You are not becoming anything, you’re just getting better and better.
If something doesn’t work, try to relax for a bit. Maybe do something else. And then try to understand where is the problem. Think about what your are trying to do, then how you are trying to achieve it. Read the code line by line and try to reason the output.
@@DenizSimsek thanks =D
@@justanothercc enjoy the failure, even senior devs often feel like they have no clue wtf they're doing. If you think that there's ever a point where things work the first time you're wrong. Being a programmer is just becoming a professional problem solver/debugger. If you don't like that find something else to do
Its not helpful to watch a 20 minute video full off errors that have to be fixed before the code will work.
when i press space the player doesn't jump, i wanna know what is the problem