Q:

escalera de mano unity

 public float velocidadSubida = 5f;
     bool DentroEscalerilla = false;
 
     void OnTriggerEnter(Collider hit){
         //Si es el personaje el que esta en la escalerilla
         if (hit.gameObject.tag == "Escalerilla") {
             DentroEscalerilla = true;        
         }
     }
 
     void OnTriggerExit(Collider hit){
         if (hit.gameObject.tag == "Escalerilla") {
             DentroEscalerilla = false;
         }
     }
 
     void Update(){
             Vector3 movimiento = new Vector3 (0, velocidadSubida*Time.deltaTime, 0);
             if (DentroEscalerilla == true){                                 
                 if (Input.GetKey(KeyCode.W))
                 {
                     gameObject.transform.position += movimiento;                    
                 }
             }
     }
0

New to Communities?

Join the community