How do I make the axes not reversed unity

0

I have this code to move the player but when the controls are broken they are reversed ie I go forward with "w" to the right with "D" but when I turn to the right if I press W it does not move forward but to the side and control is reversed, I do not know how to correct that

       using System.Collections;
       using System.Collections.Generic;
       using UnityEngine;

  public class Control : MonoBehaviour {
public float Velocidad = 7f;
public float Giro = 12f;

private Animator anim;
private Rigidbody playerRigibody;
private Vector3 desplazamiento;
public GameObject referencia;

void Start() {

    anim = GetComponent<Animator>();
    playerRigibody = GetComponent<Rigidbody>();

}



  void Update(){

    float hor = Input.GetAxisRaw("Horizontal");
    float ver = Input.GetAxisRaw("Vertical");
    float salto = Input.GetAxisRaw("Jump");
    moverJugador(hor, salto,ver);
    animaJugador(hor,salto,ver);

    transform.Rotate(0, Input.GetAxis("Mouse X") * 2, 0);

}

void moverJugador(float hor, float salto, float ver)
{
    desplazamiento.Set(hor, salto, ver);
    desplazamiento = desplazamiento.normalized * Velocidad;

    playerRigibody.MovePosition(transform.position + desplazamiento * Time.deltaTime);


}



void animaJugador(float hor,float salto, float ver) {

    bool caminata = hor != 0f || ver != 0f;
    anim.SetBool("caminar", caminata);

    bool jum = salto != 0f ;
    anim.SetBool("salto", jum);
}
   }
    
asked by Jose Eduardo 16.05.2018 в 02:14
source

0 answers