Search Unity

Question Hands doesn't show at right place

Discussion in 'VR' started by impactcs, Sep 16, 2022.

  1. impactcs

    impactcs

    Joined:
    Jan 28, 2022
    Posts:
    4
    Hi everyone,

    I'm using Open XR in my unity project.
    So I disabled the position tracking of the main camera (headset) in the xr rig (because otherwise people were abble to move through walls by moving in real life).

    So now it's perfect because only the rotation of the head is taken into account.
    The problem is:
    I can still moves the controllers and the hands are responding correctly, but the hands are not located on the right place. I think by default the game engine place the hands towards the headset position but because I disabled it my hands are like in my feets now.

    Does anyone have a clue on how to solve this problem ?

    Thanks.
     
  2. DevDunk

    DevDunk

    Joined:
    Feb 13, 2020
    Posts:
    5,060
    Why would you remove the positional data from VR? That's one of the immersive things about it.
    If you don't want them to look through walls simply push back the player or fade to black when someone puts their head inside like all games do.

    IF you are really against that for some reason, explain how your player is set-up. What packages are used, what components etc
     
  3. impactcs

    impactcs

    Joined:
    Jan 28, 2022
    Posts:
    4
    Thanks for the reply,
    Sorry for the late answer, the problem is still present since all this time:

    When I move in real life, the "xrOrigin" and the "cameraOffset" aren't moving, only the "main camera" is moving. This pattern is really annoying because I can see the body of my avatar standing still on the xrOrigin position. (it's like I left my body like a ghost and see my body standing there on the xrOrigin position). What I would like to do is to freeze the main Camera onto the xrOrigin position so that even if I move in real life, It doesn't impact the way of the game (only being able to move the player with the controllers). The current pattern also has a second negative point: because my character has a character controller with collision, the fact that I move in real life and move the main camera allows me to travel through walls and see what is hidden behind.

    You are right when you say, "why would we disable the fact that: moving in real life does change the view in the game, because this is immersive !"
    You are right, if there is a way to be abble to make the xrOrigin follow the camera this would be huge because, my player would also follow the camera but not sure the collision of my player (player controller) would take priority on the camera movement.
     
  4. DevDunk

    DevDunk

    Joined:
    Feb 13, 2020
    Posts:
    5,060
    Instead of relying on the XR origin, why don't you just put all player logic and collision detection on the camera? Make the avatar etc follow the camera instead of xr origin. That's how I made a physical movement game.
    For colliding with walls, I suggest taking the 'fade to black when colliding' method for this. Or maybe move the camera offset to push back the player without breaking tracking.

    Or you can write your own tracking system. For this open up the device tracking script from unity and edit where you want
     
  5. impactcs

    impactcs

    Joined:
    Jan 28, 2022
    Posts:
    4
    Ok thanks for your answer, I finally found out how to make the player follow the camera and it works, but the camera tracking position overwrites everything. If I try to detect the collision and move the camera with a script the script will be ignored because of the priority to real time position. So I tried to put a character controller on the camera it also doesn't work because the real time position also take priority on it.

    Any other suggestion to be abble to handle a collision with the camera on a table or wall ?
     
  6. DevDunk

    DevDunk

    Joined:
    Feb 13, 2020
    Posts:
    5,060
    I think you're almost there. When you walk into a wall, you can move the camera offset (or xr origin) to push back the player :p