Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

349
Views
¿Aplicar la rotación de objetos del juego usando la rotación relativa del controlador VR?

Tengo un objeto de juego en Unity que quiero poder rotar usando mi controlador VR. Puedo lograr esto haciendo lo siguiente ...

 bool triggerClicked = false; Transform rightHand = Player.instance.rightHand.transform; void Update () { if (triggerClicked) { transform.eulerAngles = rightHand.eulerAngles; } {

... pero el problema es que el objeto que quiero rotar inicialmente se ajusta a la rotación actual de mi controlador cuando presiono el gatillo y luego funciona según lo previsto. Necesito que se mueva en relación con la rotación inicial del objeto. ¿Cuál es la forma correcta de hacer esto?

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Resuelto. Debe capturar algunos cuaterniones iniciales cuando se hace clic en el gatillo por primera vez y luego calcular las diferencias relativas y aplicarlas. Esto evita el problema de ajuste inicial a la rotación.

 private bool triggerClicked = false; private Transform rightHand = Player.instance.rightHand.transform; private Quaternion initialObjectRotation; private Quaternion initialControllerRotation; private bool set = false; void Update () { if (triggerClicked) { if(set == false) { initialObjectRotation= transform.rotation; initialControllerRotation = rightHand.rotation; set = true; } Quaternion controllerAngularDifference = initialControllerRotation * Quaternion.Inverse(rightHand.rotation); transform.rotation = controllerAngularDifference * initialObjectRotation; } else { set = false; } {
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!