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

777
Visualizações
Unity 3D: mover un objeto alrededor de una circunferencia circular mirando hacia adelante

Estoy usando Unity3D para mover al jugador alrededor de la circunferencia de un círculo grande mirando hacia el centro en todo momento.

El siguiente código funciona usando transform.forward

 // Rotate the forward vector towards the target direction Vector3 newDirection = Vector3.RotateTowards(transform.forward, targetDirection, singleStep, 0.0f);

y luego muevo el jugador hacia los lados usando

 characterController.Move(horizontalSpeed * transform.right * Time.deltaTime);

Me he quedado atascado en cómo hacer que el jugador se mueva alrededor de la circunferencia pero mirando hacia adelante con la izquierda del jugador mirando hacia el centro del círculo. mi codigo es el siguiente

 void Start() { characterController = GetComponent<CharacterController>(); } void Update() { // Determine which direction to rotate towards Vector3 targetDirection = GameObject.Find("Platforms").transform.position - transform.position; // The step size is equal to speed times frame time. float singleStep = 1 * Time.deltaTime; // Rotate the forward vector towards the target direction by one step Vector3 newDirection = Vector3.RotateTowards(transform.forward, targetDirection, singleStep, 0.0f); // Draw a ray pointing at our target in Debug.DrawRay(transform.position, newDirection*50, Color.red); // Calculate a rotation a step closer to the target and applies rotation to this object transform.rotation = Quaternion.LookRotation(newDirection); CheckIfOnGround(); characterController.Move(velocity * Time.deltaTime); }
over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

Reemplace transform.forward a transform.left

over 4 years ago · Santiago Trujillo Relatório
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