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

100
Visualizações
How to add a force 90 degrees / sideways from a forward vector3 direction

I have 2 cubes, one big, one small, the larger cube will be stationary, while the smaller cube will be given a force towards the larger cube with :

smallerCube.GetComponent<Rigidbody>().AddForce((largeCube.transform.position - smallerCube.transform.position).normalized * force);

now I want to find out how to add a force with a 90 degree offset on the Y axis from the above given direction

largeCube.transform.position - smallerCube.transform.position

so it will seem to orbit the largerCube with a force towards it as well as a sideways force with a 90 degree offset from the 'towards' direction.

how would I go about doing something like that, using Rigidbody physics.

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

You rotate a vector by simply multiply it with the according rotation using the * operator.

For an offset of 90° in the global Y axis you can use Quaternion.Euler like e.g.

var rotatedDirection = Quaternion.Euler(0, 90, 0) * (largeCube.transform.position - smallerCube.transform.position).normalized;
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