Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

212
Vistas
How to make the player jump up automatically when standing on a specific block in Unity?

(please forgive me for my bad coding skills)

So im trying to make a jumppad in unity where, if the player stands on the jump pad, the player automatically gets shot up into the sky.

float height = 50f;

else if (onJumpPad)
        {
            while (true) {
                velocity.y += 1;
                height -= 1;

                if (height == 0)
                {
                    height = 50f;
                    break;
                }
            }
        }

above is the half-working code. I have to jump ON the jump pad to make the player get shot up into the sky.

Any help is appreciated.

(I know that the height variable should not belong in the middle of the else if statement, I just wrote it for demonstration purposes).

full code here = https://pastebin.com/3ZVu5bUq

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

I think you might need kind of jump pad. So First of all don't forget to add a collider on block as much height and width as you need. Then you can check with OnTriggerEnter or OnCollisionEnter. For Example:-

I have a block named jumpPad. I added a box collider on that with full of width and with minimum height. I didn't checked IsTrigger so I have to use OnCollisionEnter. Now what I will write in code inside player script is:-

    void OnCollisionEnter(Collision other)
    {
       if(other.gameObject.CompareTag("jumpPad")
       {
           GetComponent<Rigidbody>().AddForce(Vector3.Up * force);
       }
    }

In this code force is already declared somewhere in script. Also make sure to give block a tag if you are using CompareTag or .tag == "jumpPad". Also you need to add rigidbody component to player object.

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda