How to Check if Your Player is GROUNDED Unity Tutorial
Vložit
- čas přidán 9. 04. 2020
- How to check if your character is standing on the ground! Also we cover checking WHAT your character is standing on, as well as calculating slope angles and using that data to affect your character's movement.
This is part two of the How to Make a First Person Controller in Unity series. What would you like the next part to be about? Leave a comment and let me know.
Thanks for watching!
-----------------------------------------------------------------------------------
JOIN THE DISCORD SERVER!
/ discord
-----------------------------------------------------------------------------------
SUPPORT THE CHANNEL
The easiest way to support the channel is by liking, subscribing, and sharing. But if you want to go that little bit further, sign up for my Patreon at; / b3agz
All Patreons get access the Patreon-exclusive Discord channel in our server, as well as the show notes from each video. These are annotated code snippets that I use to remind me what I'm doing when I record...
-----------------------------------------------------------------------------------
LINKS
Script from the video; github.com/b3agz/quick-bits/b...
-----------------------------------------------------------------------------------
SOCIAL STUFF!
Website: b3agz.com
Twitter: / b3agz
Instagram: instragram.com/b3agz
#MadeWithUnity #UnityTutorial #GameDev - Hry
Man, just thank you so much! Been looking for a raycast decision for 2 days and absolutely broke my head of the wall. Thank you sooo much!
I can already see an exploit here. The speed change is being calculated based on the slopeAngle, which itself is dependent on direction. This means that a player walking backwards up a slope would move faster.
this is intentional for speedrunners obviously.
How would you fix this
this is not a bug it is a... FEATURE! yeah we all obviously want this for speedrunning and we are TOTALY not trying to avoid more debugging. psh who would do that!
@@mrkoix2398 😂
Did you just discover B hopping in half life?
Really excellent explanation as always, thanks so much for taking the time to run through this and break it down. You are really helping me out a great deal get to grips with Unity and code around generating these game types. Keep up the great work and why so many views but so few likes, come on guys support click that like Button !
this was really helpful! thanks!
Use the direction the player is trying to move to calculate the speed rather than the way you are facing. Otherwise, you can run uphill really quickly if you walk backwards.
Good call.
Omg ty soooo much for this. i almost gave up on this.
thank you so much man, i spent all day trying to do this and i couldn't, i was watching a vid from Brackeys, and when i used your vid i got it first try. this is a way better video then brackeys not even joking
I just found your channel and I liked the crosshair video and this one since it told me how to do the thing I wanted which is being slowed down on slopes. It was hard to find a tutorial for that.
Can I ask if you could consider these stuff for the next tutorials?:
- Crouching under objects and standing up will not push you out from under it (meaning you will stay crouched under the object when the crouch button is released)
- You slow down when crouching (tutorials from big CZcamsrs like Brackeys did not bother with this)
- Crawling (you are completely on the ground and are even slower then crouching)
- Jump or sprint out from crouching position (when crouching pressing Shift for sprint and W for forward you will uncrouch and start to sprint or start jumping with the Spacebar)
Wonderful tutorial. The only issue I am still having with this and the one in the Minecraft series, is you can flip the camera upside down. Any chance of a quick part 3 for that? I know you mentioned you were going to compile a bunch of small things but yea, that would be something SUPER beneficial!
Thanks, you helped me allot.
rly helpful
Use spherecast instead of raycast, because with raycast, the ground needs to be directly below the center of the player. With spherecast you can still jump if you are on the edge of a cliff.
Bookmarked this video under #gold
I was really hoping you would solve the character "bouncing" down the slope when going too fast down...
Otherwise, really great ideas and suggestions! :)
This implementation has a lot of limitations and bugs for it to be implemented in an actual game,
The only place I maybe would use such a basic implementation is a game like minecraft, even in that it won't work in 60% of the cases, for ex, on ledges or on steep slope
after 30 minutes of frustation i found out that for some reason visual studio automatically corrected transform to _cameraTransform XD
What about stairs? How would you do a character controller with a rigidbody properly wotk with stairs?
Character controller is best for stairs. or you could do a raycast on the feet and just above them.
Was going nutz in the first 5 minutes because that raycast was not working on terrain. Put a box under my player and it suddenly worked. How can I make this work with the terrain?
EDIT: Its actually not working when the terrain is flat.
how does it not know that the player is grounded
hi early!
Can you check out my game? Thanks