Search Unity

SteamVR HandColliderLeft/Right lags behind hand movement

Discussion in 'VR' started by gabrielmukobi, Feb 20, 2020.

  1. gabrielmukobi

    gabrielmukobi

    Joined:
    Aug 11, 2019
    Posts:
    2
    I'm trying to build a seated space dogfighter game in Unity 2019.3 with the SteamVR Unity plugin where the ship is controlled by physically grabbing and touching controls in the cockpit.

    I am using the SteamVR Player prefab from the Interaction System, but the trouble I'm running into is that when the Player GameObject is moving forward rapidly, the SteamVR HandColliderLeft and HandColliderRight GameObjects (instantiated by the HandPhysics.cs component on each hand) that are responsible for collision end up lagging behind the controller and render model positions, so although it looks like I'm touching the controls of the ship, the hand colliders are many meters back and nothing can accurately be grabbed.

    To replicate, simply add the Player prefab to a new scene, enter play mode, and select the Player->HandColliderLeft/Right(Clone) GameObjects so their colliders show up in the scene view, then watch the colliders lag behind the hand model when the hand is moving. This is easiest to see when the Player prefab is moving at least around 20 meters per second, but you can also just shake your hand fast and the colliders won't always line up.

    Does anyone know how to get around this issue? I simply can't find anything about HandPhysics.cs or HandCollider.cs online, and this issue is pretty critical to the game I'm building which makes development a bit frustrating. Could this issue be solved by editing some SteamVR code (maybe in Hand.cs, HandPhysics.cs, or HandCollider.cs) so that the HandColliderLeft/Right objects snap to the actual hand position?

    If you're able to give any help, it would be much appreciated!
     
  2. EnriqueCaballero1

    EnriqueCaballero1

    Joined:
    Sep 20, 2017
    Posts:
    5
    Hey bud, I'm having this problem as well and I was able to improve the jitter by 90% by doing the following:

    Get the HandColliderLeft and Right objects and set them to your Player layer, and disable collisions of Player and Player in the Physics matrix in Project Settings.

    That helps a bit.

    But what really helps is to disable gravity on the hand colliders Rigid body. I also set it to interpolate for good measure.

    I still get a bit of jitty, but massively better

    I hope this helps.
     
    Vaupell likes this.
  3. jchen05

    jchen05

    Joined:
    Sep 18, 2020
    Posts:
    1
    Hi, I'm not sure if you've already fixed this issue, but I found some fixes that mostly clear up all jitter/lag issues with hands:

    - Open the HandPhysics script. Change the FixedUpdate function to LateUpdate.
    - Now, under the Player prefab, find the LeftHand and RightHand objects. You will need to do the following for both hands:
    - Scroll down to the Hand Physics (Script) component
    - Double-click on the HandColliderLeft/Right (depending on which Hand object you are currently on) Hand Collider Prefab.
    - This should open up the collider prefab model view. Now, under the RigidBody component:
    - Turn off Use Gravity
    - Click on the Interpolate dropdown and select Interpolate.
    After configuring these settings, the hand lag should pretty much be gone. For me, my hands no longer lag behind when I move linearly and when I snap turn.
    I'm not sure if all these settings are necessary, or if any of them will interfere with functions in your game, but try it out.
     
    Last edited: Jan 28, 2021
    vivian-a and IronBlade like this.