I’ve tried doing this but it didnt work out that well and it led to very inconsistent jumps that go super high up, this is my current script for jump input
if (Input.GetKeyDown(jumpKey)&& isGrounded)
{
Jump();
StopSlide();
}
i tried replacing input.getkeydown with input.getkey but it just doesnt work…help, i dont want to keep on pressing jump ;-;
i tried this(just using getkey instead of getbutton) and it leads to very inconsistent jumps with some being very small and some just launching you into the air.
I think it’s pretty obvious there are no Rigidbodies in the code above, but the formula is the same: it’s just basic dynamics 101. That doesn’t change. Try it now with a rigidbody and a quick test script if you disbelieve me.
If you’re getting irregular velocities, make sure you’re obeying all the proper use of physics systems: only transact in FixedUpdate() against Rigidbodies, etc.
creo que tengo la respuesta aqui tengo este codigo que le permite moverme y saltar tambien que solo salte al toca el suelo pero necesito que me ayudne enotra cosa por alguna razon me dice que me falta un} pero estoy seguro que no me falta ninguno podrian ayudar
controlador de jugador de clase pública: MonoBehaviour {
bool canJump;
// Se llama al inicio antes de la primera actualización del cuadro
inicio vacío ()
{
}
// La actualización se llama una vez por fotograma
Actualización nula ()
{
if (Input.GetKey (“izquierda”))
{
gameObject.GetComponent () .AddForce (nuevo Vector2 (-20000f * Time.deltaTime, 0));
could you translate this to english? Im not using google so I can’t translate the page or at least i don’t know how to and also could you use code blocks?
NO ITS NOT. the video explains how to do the jump with INPUT.GETKEYDOWN, SO YOU HAVE TO PRESS IT EVERY TIME, IM LOOKING FOR HOW TO HOLD THE JUMP BUTTON AND ONLY JUMP WHEN GROUNDED OMFG IS IT THAT HARD TO UNDERSTAND
Maybe instead of yelling at them, you could change Input.GetKeyDown to Input.GetKey as that one is detected all the time it is held down. After all, that code already checks if the player is grounded.
I do agree with the sentiment here. Please refrain from shouting and putting down fellow forum users if you don’t appreciate the answers you are getting. Just be friendly and understanding. People are trying to help you.