Search Unity

Changing Character height

Discussion in 'AR/VR (XR) Discussion' started by BigB, Oct 13, 2015.

  1. BigB

    BigB

    Joined:
    Oct 16, 2008
    Posts:
    672
    Hi there,

    I'm doing my player crouch by decreasing the height value of the character controller in realtime.
    The camera follows the character controller, and all works good.
    However, using DK2 , the character controller is scaled, physics work, but now the camera is stuck at the original height.
    I'm using the manual oculus implementation (OVRPlayerController).

    Any clues on how to fix this ?

    Thanks,
    Bruno
     
  2. FlyingMollusk_Team

    FlyingMollusk_Team

    Joined:
    Mar 16, 2015
    Posts:
    21
    We ran into this a bit with our game. We're using the native in-engine oculus implementation, so the situation might be different. Still, we were experiencing behavior where the camera was moving based on its initial position as well as the orientation of the Oculus. This is of course, expected. You want the camera to turn with VR, but the Oculus implementation also takes into account position in the native code. So if the Oculus rift gets higher, the camera view gets higher and so on. This doesn't work for our game since we have situations that require the player to be certain heights.

    The way we got around this was having a counter mover. At run time, if a VR headset is detected, we create an empty game object at the camera's original position. We parent that new game object under our player, then move the camera under the new game object. Then, as the game plays, this new intermediary game objects reads the changes in the camera's local position, and acts accordingly to counteract it.

    I don't know if this will work for you, but this is what we did to get things working for our situation.
     
  3. umartin

    umartin

    Joined:
    Oct 14, 2015
    Posts:
    2
    In OVRPlayerController is a bool called useProfileData. This overrides camera position. Uncheck this and you can set the camera position as you wish.

    OVRPlayer.jpg
     
  4. unity_ky13KtWIJ0ryzw

    unity_ky13KtWIJ0ryzw

    Joined:
    Dec 28, 2019
    Posts:
    1
    This saved me a lot of time man, thanks a lot! Works like a charm.
     
  5. martinezalonso

    martinezalonso

    Joined:
    Nov 9, 2018
    Posts:
    5
    umartin, THANK YOU SO MUCH!!!