Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

299
Visualizações
¿Cómo mover al jugador usando rigidbody.moveposition pero mover al jugador hacia donde está mirando y de acuerdo con ese movimiento del jugador?

Aquí está el script de mi controlador de jugador hasta ahora... '''

 //Variables public float speed = 5f; public float sprintSpeed = 10f; public float jumpForce = 10f; private Rigidbody rb; //Methods private void Start() { rb = GetComponent<Rigidbody>(); } private void FixedUpdate() { BasicMovement(); } void BasicMovement() { //Get Player Input float inputX = Input.GetAxis("Horizontal"); float inputZ = Input.GetAxis("Vertical"); //Get where is Player moving position Vector3 direction = new Vector3(inputX, 0f, inputZ); //Move Player rb.MovePosition(transform.localPosition + (direction * speed * Time.deltaTime)); }

'''

El script del controlador de cámara: ''' //Variables public float mouseSensitivity = 100f; // Variable de sensibilidad del mouse para que pueda cambiarla más tarde a mi gusto public Transform playerBody; //Entonces la cámara sabe cuál es el cuerpo del jugador private float xAxisRotation; //Para moverse en el eje x

 void Start() { } void FixedUpdate() { Cursor.lockState = CursorLockMode.Locked; //Locks mouse cursor at the center of the screen //Get Mouse X,Y positions in variables float mouseX = Input.GetAxis("Mouse X") * mouseSensitivity * Time.deltaTime; //Gets mouse location at the x-axis float mouseY = Input.GetAxis("Mouse Y") * mouseSensitivity * Time.deltaTime; //Gets mouse location at the y-axis xAxisRotation -= mouseY; //-ensures the rotation is not flipped xAxisRotation = Mathf.Clamp(xAxisRotation, -90f, 90f); //Clamps rotation to -90, 90 so that player cannot look behind transform.localRotation = Quaternion.Euler(xAxisRotation, 0f, 0f); //I dont know //Implement mouseX position to playerBody so that the entire player moves in the X-Axis playerBody.Rotate(Vector3.up * mouseX); }

'''

Si necesita algo más, por favor dígalo.

over 4 years ago · Santiago Trujillo
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda