Search Unity

  1. Read here for Unity's latest plans on OpenXR.
    Dismiss Notice

[Solved] VRTK - Interacting with Object While Moving Issue

Discussion in 'AR/VR (XR) Discussion' started by amanda247, Dec 1, 2016.

  1. amanda247

    amanda247

    Joined:
    Jan 20, 2015
    Posts:
    6
    Hi everyone,

    I am not sure if this is a bug with VRTK or just a general bug. I am new to Unity so I really appreciate any help. Thanks!

    I will try to explain below what is happening but take a look at the video to get a better idea

    When the car is not moving, putting my VR controller on the steering wheel will highlight it red (showing that it can then be interacted with) and I can grab/move it.

    But when the car is moving, the steering wheel doesn't highlight when I place my controller on part of it. I have to reach further for it to highlight and be able to grab it. The faster the car is going, the less I am able to interact with the object until eventually it's not possible at all.


    Notes:

    * Steering wheel is connected to the car using a joint.
    * I've tried this with other props that are not connected to the car and same thing happens.


    Other Important Notes:

    * When highlighted red, the OnTriggerStay function is continually called.
    * When controller is on the object but it's on the part that doesn't highlight red it calls OnTriggerEnter continually instead of OnTriggerStay. I think it should be calling OnTriggerStay.



    Is it possible to interact with objects while moving?

    Thanks in advance!

     
    Last edited: Dec 4, 2016
  2. amanda247

    amanda247

    Joined:
    Jan 20, 2015
    Posts:
    6
    I've updated the post with more important notes I've found and tried to make it more clear. Let me know if there are anymore details that are needed. Thanks!
     
  3. FiveFingerStudios

    FiveFingerStudios

    Joined:
    Apr 22, 2016
    Posts:
    498
    It is possible to interact with objects while moving, I'm just not sure of the limits as I'm making a zombie game and don't have any fast moving objects like a car.

    I would suggest you post on the VRTK website as there are many more people there that are better suited to give you an answer.
     
  4. DestinWarren

    DestinWarren

    Joined:
    Feb 7, 2017
    Posts:
    2
    I'm having the same problem with my game. I would love to know the solution. I'll share all info I find thank you.
     
  5. amanda247

    amanda247

    Joined:
    Jan 20, 2015
    Posts:
    6
    Hey DestinWarren,

    I was able to fix my issue by going to each game object, finding the Rigidbody settings in the inspector, and setting "Collision Detection" to "Continuous Dynamic"

    Hope this helps. :)
     
  6. DestinWarren

    DestinWarren

    Joined:
    Feb 7, 2017
    Posts:
    2
    Thank you it was a big help.
     
  7. tthom1108

    tthom1108

    Joined:
    Dec 29, 2017
    Posts:
    2
    Hi, This doesnt seem do fix it for me. Might I also ask how you all are returning the wheel back to 0(ie wheel pointed forwards). And would it matter if I use FixedUpdate/LateUpdate/Update?

    Also, are you guys using Hinge joints for this, or is there a better way?
    And Angular drag... Does that affect this too?

    Thank you!

    [Answer for me]
    I am using the VRTK_Fixed Joint grab... I set the collision detection to Continuous Dynamic. That didn't seem to do much, but when i multiplied the BreakForce on the VRTK script by 10, that solved my problem. Not sure how much of it is the Collision detection VS how much is the BreakForce... Could be combo of both.. [Also, I am just using Update]
     
    Last edited: Mar 7, 2018
  8. ristophonics

    ristophonics

    Joined:
    May 23, 2014
    Posts:
    31
    Similar issues with this prototype: https://mogacreative.itch.io/orbital-dogfight

    The button colliders in the cockpit seem to migrate during fixed update. I have basically tracked this to floating point imprecision a high speed. When accelerating (rigidbody) at high speed the colliders basically jitter which can cause incorrect inputs during fixed update. I found this to be happening at sub 1000 meters from the origin. If the rigidbody ship/car is simply moving fast and not accelerating or deceleratinng or changing angular momentum the colliders track much better. I think increasing the timestep would help but that is a no go for me.

    The one solution I think would work well is to do the kerbal approach. Detach the 'cockpit' and render it separately from the car or ship which is undergoing physics updates. This way the collider interactions inside the car/ship will not be undergoing acceleration. A camera on the ship layers its view behind the cockpit camera. I have yet to do this because some other duct tape approaches are holding for now.


    ... EDIT: The final solution I am using is to make sure the colliders for button and wheels are on the same layer as the colliders in the avatar hands. This layer interacts only with itself in the physics engine reducing unwanted collisions to 0.

    Check out Critical Gravity as well. Let me know what you think
     
    Last edited: May 13, 2019
  9. ristophonics

    ristophonics

    Joined:
    May 23, 2014
    Posts:
    31
    Wow. Had to re-write the avatar steering wheel script after upgrading to Unity 2018. The new wheel uses no physics and no joints but rather takes advantage of a pure vector math solution. I do have one collider on the wheel marked as a 'trigger' but that is it. Let me know if you are interested in the code.. otherwise try the wheel out in the free demo here https://mogacreative.itch.io/critical-gravity-demo
     
  10. Hyperactive

    Hyperactive

    Joined:
    Aug 13, 2013
    Posts:
    6
    Hey looks really cool! I'm currently trying to figure out this driving wheel as well at the moment. Any help on that would be much appreaciate. It's really only once the wheel is on a object that's moving fast that everything breaks down, and I haven't figured out how to keep the wheel working nicely while you move.
     
  11. ristophonics

    ristophonics

    Joined:
    May 23, 2014
    Posts:
    31

    Are you using Rigidbodies and joints or are you using code?
     
unityunity