Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Bow Rotation Issues - Holopoint VR

Discussion in 'AR/VR (XR) Discussion' started by Alzan, Apr 10, 2016.

  1. Alzan

    Alzan

    Joined:
    Sep 2, 2012
    Posts:
    81
    Good Afternoon,
    I'm working on an update for Holopoint (an insane archery game on Steam), and have ran into an issue. The idea - which is currently not working, is that the bow is held and tilted (position & z rotation) with the front controller while drawn and aimed (x & y rotation) with the back controller. Does anyone know how to modify a quaternion so that that bow is tilted and aimed by two different inputs? At first I used lookRotation to aim the bow away from the back controller, but that does not allow for tilt on the z axis.

    Thank you
     
  2. Void24

    Void24

    Joined:
    Oct 15, 2013
    Posts:
    50
    Quaternion.lookRotation can take two arguments. The first is the look direction, which you have used successfully to aim the bow away from the back controller. The second is the up direction, which is what you want for tilt control.

    If you just want the front hand to control tilt, pass the transform.up or transform.forward (depending on your desired controller orientation) of the front controller. You could also average the transform.up direction from both controllers (this makes more sense on weapons other than a bow.

    Holopoint looks cool! It is on my list of purchases I need to make, once I wade through all the content I have already.
     
    Alzan likes this.
  3. Alzan

    Alzan

    Joined:
    Sep 2, 2012
    Posts:
    81
    Thank you! Your solution fixed our code and is going to be used in a future build!
     
    Void24 likes this.