-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hi ! jumping and crouch aren't working. #1
Comments
Check if you've already assigned the gameObjects "GroundCheck" and "CeilingCheck" to the controller script. |
hi ! thank for your reply :) I 've let this pb aside for a couple of days. but yes, my ceiling and groundCheck are positionned correctly. I continue to investigate . Once again, thank you for your help PlzDntBlm. |
hey, I'm having a similar problem to this. I've triple checked my Ceiling/ground Checks. used Debug.Log to make sure that my "Input.GetKeyDown("f")" is working (It does) and I have no clue what's wrong code: bool Crouching = false; void Update ( ) {
also, on another note. my box collider (the one that is to be disabled) is constantly flickering, on and off. |
I found a solution, if you change the FixedUpdate section of the CharacterController2D script to a LateUpdate it eliminates the issue with jumping. |
Hi! Had a problem too when setting the checks for ceiling and ground. The editor always returned me that they where not declared, and they'll always return null. Just removed the "serializeField" and turn the variable to public. That solved my problem. Here you have my edited script. `
|
To fix the jump make the ground check and the ceiling check a child of the player, this worked for me |
I've spent hours and hours trying to get this to work as a straight up beginner. I've copied the code exactly. 2019.1.5f1 version. I was able to troubleshoot that somewhere the code is causing Crouch to be always on. Changing from Serialize to Public as suggested above simply flips my problem and I'm able to crouch and uncrouch but not jump. Also, most likely the source of all of the issues is somewhere in the code for detecting if a player is crouching under a ceiling. It is ineffective. When I can get crouching working, the code is completely ignored and the player character just stands up into the overhead block and cannot move. This is literally the worst introduction to Unity. Is it always like this? This is barely any code at all and apparently different update versions provide different results. |
Fixed it temporarily with The Putting this here because it'll take me a while to code a proper solution but you might be able to apply fixes to your code sooner (I'm a software engineer but I'm not well versed in Unity). |
Ha, someone already submitter a PR, sweet! #3 |
I know this is a bit late but to fix this make sure you're not setting ground to be on the same layer as anything like the camera. Changed this and it fixed it. |
I moved my ceiling check up a little more and it then worked. Im using a tilepalette environment with the auto box colliders on painted elements. Good luck! |
Es klappt nicht zu Springen Hier mein code: using System.Collections; public class PlayerMovement : MonoBehaviour{
} |
how to fix it when u press the play button it deletes your box collider without pressing the crouch button? Plzzz help. using System.Collections; public class PlayerMovement : MonoBehaviour
} |
I tried all of the recommendations on this post but still I cant get it to jump. public class PlayerMovement : MonoBehaviour public CharacterController2D controller;
void FixedUpdate() And for the ceiling/ground check I have no idea where to place them |
This is very late but after some time of fidgeting with it I figured out that you gotta keep the ground object in a different layer than the player which was what I was doing and that ground check and ceiling check in the same layer as ground. |
Hi, first thank for your tutorials. its very good.
bout the character 2d movement, here is a problem I meet, I effectivly press up and down arrows or 'w' and 's' ... or space (I've set everything right about the input), but the caracter dosen t jump or crouch. I put a Debug Log inside the if(Input.Get ... ) and it seems that my key are pressed. So I wonder what's going on.
see below
if (Input.GetButtonDown("Jump"))
{
Debug.Log("Jumped");
jump = true;
}
if (Input.GetButtonDown("Crouch"))
{
Debug.Log("Crouched");
crouch = true;
}
else if (Input.GetButtonUp("Crouch"))
{
crouch = false;
}
have you got any idea ?
The text was updated successfully, but these errors were encountered: