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. Dismiss Notice

Question Can't constraint camera position with Tracked Pose Driver

Discussion in 'XR Interaction Toolkit and Input' started by lordsamain, Dec 25, 2020.

  1. lordsamain

    lordsamain

    Joined:
    Jun 17, 2018
    Posts:
    14
    Hi everyone !

    I have a problem with my VR camera when I use the tracked pose driver with Update and Before Render. I can't constrain the position of the camera if I want to prevent it from going through walls. I have to use a subterfuge with the camera offset but it annoys me :) If I just choose Update in the tracked pose driver, it works but everything is jerky.
    Does anyone have a solution? Thanks! :)
     
  2. arfish

    arfish

    Joined:
    Jan 28, 2017
    Posts:
    777
    Hi,

    Don't believe you should try to change the position of the camera transform at all. It's for the XR subsystem to move and rotate the camera. Put it as a child to another transform, and move that instead. Make sure both the camera and the parent has the local scale set to 1,1,1. Then I think it should be fine to for example subtract the camera vector towards the wall in each frame, from the parent, to prevent further 6-DOF movements of the player to go through the wall.

    Perhaps there are other techniques for it too?
     
  3. lordsamain

    lordsamain

    Joined:
    Jun 17, 2018
    Posts:
    14
    Thanks :) That's what i do. It works but i just don't know why you can constraint the camera position in Update but not in Update and Before Renderer.