Jump to content

Recommended Posts

Posted

I enlarged the camera by 7 times, and then the hand position was wrong. Could you please tell me how to solve this problem? Thank you

Posted

Hi @毛.sy

We don't support changing camera scale in the current version.

Can you please share your use case why you need to scale the camera in a VR application? Can you please verify if setting camera scale to (1,1,1) can solve the problem?

Posted

Hello  @zzy

For some reasons, I had to enlarge the scene, so the camera was also enlarged by 7 times. However, after I enlarged the model of the camera and the hand, I found that the movement distance of the hand was still scale=1. Therefore, I would like to ask how to set the enlarged movemeHand_Tracking_Unity_CameraTest.unitypackagent distance of the hand。Thank you 

微信图片编辑_20201013111531.jpg

Posted

Hi @毛.sy

Can you please try if the following changes solve your problem?

Please change UpdateResult function in Assets\ViveHandTracking\Scripts\Engine\ViveHandTrackingEngine.cs to:

  public override void UpdateResult() {
    var transform = GestureProvider.Current.transform;

    IntPtr ptr;
    int index;
    var size = GestureInterface.GetGestureResult(out ptr, out index);

    if (index < 0) {
      Debug.LogError("Gesture detection stopped");
      State.Status = GestureStatus.Error;
      State.Error = GestureFailure.Internal;
      return;
    }
    if (index <= lastIndex)
      return;
    lastIndex = index;
    if (State.Status == GestureStatus.Starting)
      State.Status = GestureStatus.Running;

    if (size <= 0) {
      State.LeftHand = State.RightHand = null;
      return;
    }

    bool isLeft = false;
    var structSize = Marshal.SizeOf(typeof(GestureResultRaw));
    for (var i = 0; i < size; i++) {
      var gesture = (GestureResultRaw)Marshal.PtrToStructure(ptr, typeof(GestureResultRaw));
      ptr = new IntPtr(ptr.ToInt64() + structSize);
      for (int j = 0; j < 21; j++)
        gesture.points[j] = transform.TransformPoint(gesture.points[j]);
      State.SetRaw(gesture);
      isLeft = gesture.isLeft;
    }
    if (size == 1) {
      if (isLeft)
        State.RightHand = null;
      else
        State.LeftHand = null;
    }
  }

 

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...