Welcome to the Oculus Developer Forums!

Your participation on the forum is subject to the Oculus Code of Conduct.

In general, please be respectful and kind. If you violate the Oculus Code of Conduct, your access to the developer forums will be revoked at the discretion of Oculus staff.
New to the forums? Click here to read the How To guide. -- Developers click here.

OVRGrabber and Crossplatform development - not working with Vive wands

ryan99ryan99 Posts: 24
Brain Burst
Hi There,

I've been working on getting OVRGrabber.cs in the AvatarGrab scene to work across both Vive and Rift. I am using Unity 2018.3.

I'm running into odd behavior where AvatarGrabberRight and AvatarGrabberLeft won't move along with the controllers (using openVR and Vive wands) 
When using the Rift all works fine.

I think I've isolated the problem to the rigid body and physics system:

inside void OnUpdatedAnchors() - 

GetComponent<Rigidbody>().MovePosition(destPos);
GetComponent<Rigidbody>().MoveRotation(destRot.normalized);

both work as expected with the Rift but not at all with the Vive.
In order to get things moving with the Vive wands I need to swap to:

       transform.position = destPos;
       transform.rotation = destRot.normalized;

Also - with the vive wands I need to move OnUpdatedAnchors()  to be done in Update() as FixedUpdate() only fires once on startup.

Assigning the new position and rotation directly still doesn't get the grabbing working with the Vive but at least the game objects are mirroring the controllers successfully.
Testing this with the Rift works but results in less realistic movement when throwing due to bypassing the rigidbody I believe.

I know the cross-platform support is rather new but I was hoping someone might have some suggestions why this might be happening and how I could go about fixing it?

Thanks!
 - Ryan

Comments

  • ryan99ryan99 Posts: 24
    Brain Burst
    It seems the problem is that Unity physics are paused on launch and don't activate until the Rift is put on your head. (proximity sensor)

    When running the scene with the Vive the proximity sensor is (as expected) never detected and while the scene renders and the head tracks properly - the physics never run. Rigidbodies will stay floating in mid air.

    So the real question is: how do I either stop Oculus from blocking the unity physics from running OR how do I trick OVRManager that the proximity sensor has been activated when using the Vive?
  • ryan99ryan99 Posts: 24
    Brain Burst
    Time.timescale is being set to zero on launch. I can't find where it is happening but if I run an alternate script that updates Time.timescale to 1 shortly after launch then the physics work and grabbing works with both the Rift and Vive.

    Simple fix in the end but I would love to find where Time.timescale is being set to zero in the first place.
Sign In or Register to comment.