private void TransformHand(Frame frame, ProxyNode proxyNode, MarkNode markNode, HandChirality handChirality) { if (proxyNode == null || markNode == null) { return; } var deltaRotation = Quaternion.FromToRotation(proxyNode.transform.forward, markNode.transform.forward); var localProxyPosition = proxyNode.transform.worldToLocalMatrix.MultiplyPoint(leapRoot.position); var markPosition = markNode.transform.localToWorldMatrix.MultiplyPoint(localProxyPosition); var scaleLeftHand = new Vector( markNode.transform.localScale.x / proxyNode.transform.localScale.x, markNode.transform.localScale.y / proxyNode.transform.localScale.y, markNode.transform.localScale.z / proxyNode.transform.localScale.z); if (handChirality == HandChirality.Left) { frame = frame.TransformLeft(new LeapTransform(-leapRoot.position.ToLeap(), LeapQuaternion.Identity)); frame = frame.TransformLeft(new LeapTransform(Vector.Zero, deltaRotation.ToLeap(), scaleLeftHand)); frame = frame.TransformLeft(new LeapTransform(markPosition.ToLeap(), LeapQuaternion.Identity)); } else { frame = frame.TransformRight(new LeapTransform(-leapRoot.position.ToLeap(), LeapQuaternion.Identity)); frame = frame.TransformRight(new LeapTransform(Vector.Zero, deltaRotation.ToLeap(), scaleLeftHand)); frame = frame.TransformRight(new LeapTransform(markPosition.ToLeap(), LeapQuaternion.Identity)); } }
public ProxyNode GetProxyNode(HandChirality chirality) { if (chirality == HandChirality.Left) { return(proxyNodeLeftHand); } return(proxyNodeRightHand); }
public InteractionHand GetInteractionHand(HandChirality handChirality) { if (handChirality == HandChirality.Left) { return(InteractionHandLeft); } return(InteractionHandRight); }
public void SetHandTransform(ProxyNode proxyNode, MarkNode markNode, HandChirality handChirality) { if (handChirality == HandChirality.Left) { proxyNodeLeftHand = proxyNode; markNodeLeftHand = markNode; } else { proxyNodeRightHand = proxyNode; markNodeRightHand = markNode; } }
public void EnableHand(bool value, HandChirality handChirality) { if (handChirality == HandChirality.Left) { leftHandEnabled = value; leftHandRendererEnabled = value; leftHandPhysicsEnabled = value; } else { rightHandEnabled = value; rightHandRendererEnabled = value; rightHandPhysicsEnabled = value; } }