Search Unity

Question XR Origin Rotation Causing Issues With Controller Velocity

Discussion in 'VR' started by podzy, Oct 30, 2022.

  1. podzy

    podzy

    Joined:
    Jan 21, 2022
    Posts:
    1
    In my project I'm currently grabbing the deviceVelocity from each of my controllers using:
    Code (CSharp):
    1. TryGetFeatureValue(CommonUsages.deviceVelocity, out Vector3 velocity)
    I am applying the velocity to a sphere to use as spell projectile and for the most part it works as intended. I can physically rotate myself and the sphere gets sent in the correct direction.

    But when I rotate myself using the joystick/continuous turn provider, they are sent out incorrectly.

    I'm assuming the issue has to do with the XR Origin transform getting rotated during the turn action, whereas the camera just rotates around the XR Origin otherwise.

    I'm not sure how to go about compensating for the rotation. Any help would be appreciated!