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 may be revoked at the discretion of Oculus staff.

Oculus Custom Hands - Stutter

DemonGamesStudioDemonGamesStudio Posts: 19 Oculus Start Member
edited October 15 in General Development
I am trying to implement custom hands, for some reason it stutters / lags. I set the frame time to 90fps which helps a bit but still way too laggy. I have searched online for a long time and can not seem to find any answer.

To be more specific, it is just the hands that lag / stutter. Seems to do it more when moving or turning. The custom hands are not attached to the OVR player controller, attaching them seems to make them disappear.

Can anyone explain whats going on or has the same experience?

** I have already tried setting the time settings to 1/90 which is 90 frames per second. This does not stop the jitter / stutter / lag with the hands.

Thank you in advance.

Answers

  • CyrussphereCyrussphere Posts: 3
    NerveGear
    If you are using Unity there is a Time setting that can be adjusted to help. Its covered a little bit in this video https://www.youtube.com/watch?v=rnOR1OANIAU&list=PLrk7hDwk64-Y7ELKfkw8ox8TaT9y3gNpS&index=2
  • DemonGamesStudioDemonGamesStudio Posts: 19 Oculus Start Member
    edited October 15
    I know there is. I did say in the post that I changed the frame time to 90fps. I will try to edit the post to be more specific.
    ** Edit. I have also seen and been through those videos multiple times.
  • DarkTableDarkTable Posts: 27
    Brain Burst
    How are you updating the hand's positions? There's an event in OVRCameraRig called UpdatedAnchors. If you subscribe to that you will get a callback at exactly the same time that Oculus updates the position of the controllers in the tracking space. It shouldn't be possible for the hands to lag in that situation.
    using UnityEngine;
    
    public class HandTracker : MonoBehaviour
    {
    	[SerializeField]
    	OVRCameraRig cameraRig;
    
    	[SerializeField]
    	Transform leftHandTransform;
    
    	[SerializeField]
    	Transform rightHandTransform;
    
    	void Start()
    	{
    		cameraRig.UpdatedAnchors += OnUpdatedAnchors;
    	}
    
    	private void OnDestroy()
    	{
    		cameraRig.UpdatedAnchors -= OnUpdatedAnchors;
    	}
    
    	private void OnUpdatedAnchors(OVRCameraRig rig)
    	{
    		leftHandTransform.SetPositionAndRotation(rig.leftHandAnchor.position, rig.leftHandAnchor.rotation);
    		rightHandTransform.SetPositionAndRotation(rig.rightHandAnchor.position, rig.rightHandAnchor.rotation);
    	}
    }
    


  • DarkTableDarkTable Posts: 27
    Brain Burst
    Another thought: Do you have any animations on the hands that might be setting their position? There could be a fight between the animation position and the VR position that looks like jitter?
  • DemonGamesStudioDemonGamesStudio Posts: 19 Oculus Start Member
    edited October 15
    I am very confused. I am currently using the custom hands that Oculus provide.

    * Edit. I tried making my own script with the code you said, and while it actually fixes the stuttering issue, it means the player hands can not be manually be rotated, so when turning your hands in game is not rotated the right way.


    **Edit. Both custom hand left and right are a child of Player.

    So at this point I got it to where the hands dont stutter, but the hands are not rotated the right way... trying to rotate them manually does nothing, it just resets its self, and that I think would be due to the code above which I used in the new script I made.

  • DarkTableDarkTable Posts: 27
    Brain Burst
    Okay. I just tried out the CustomHands scene in the Sample Framework and I see the stutter that you're talking about. I feel bad saying this in the Oculus forum, but so much of the code in the Sample Framework is broken and out of date.

    In OVRGrabber.cs try changing the Awake() function by adding the three lines below:
    		// Add this
    		if (rig == null)
    		{
    			rig = OVRManager.instance.GetComponent<OVRCameraRig>();
    		}
    		// End add this
    
    The finished function should look something like this (I added some Debug.Log messages so you can see if there are problems):
    	protected virtual void Awake()
    	{
    		m_anchorOffsetPosition = transform.localPosition;
    		m_anchorOffsetRotation = transform.localRotation;
    
    		// If we are being used with an OVRCameraRig, let it drive input updates, which may come from Update or FixedUpdate.
    
    		// FIXME: HEY OCULUS THIS IS A DUMB AND HACKY WAY TO FIND THE OVRCameraRig!!!!!!!
    		OVRCameraRig rig = null;
    		if (transform.parent != null && transform.parent.parent != null)
    			rig = transform.parent.parent.GetComponent<OVRCameraRig>();
    
    		// Add this
    		if (rig == null)
    		{
    			Debug.Log("Trying one last time to find the OVRCameraRig.");
    			rig = OVRManager.instance.GetComponent<OVRCameraRig>();
    		}
    		// End add this
    
    		if (rig != null)
    		{
    			Debug.Log("Success! Found the OVRCameraRig");
    
    			rig.UpdatedAnchors += (r) => { OnUpdatedAnchors(); };
    			operatingWithoutOVRCameraRig = false;
    		}
    		else
    		{
    			Debug.LogWarning("Couldn't find the OVRCameraRig. There will be hand jitter.");
    		}
    	}
    
      

  • DemonGamesStudioDemonGamesStudio Posts: 19 Oculus Start Member
    This isn't working either : / It essentially does the same thing as the script you said about before. I have contacted Oculus, maybe they can advise on the next step, but at this point I think I'm just going to give up searching, and I might just have to use the Avatar hands again. If I do find an answer, I will post back here, for anyone who has the same issue.
Sign In or Register to comment.