protected virtual void SaveFinger(HandPose.Finger poseFinger, Finger finger) { poseFinger.proximal.localPosition = finger.proximal.mesh.transform.localPosition; poseFinger.proximal.localRotation = finger.proximal.mesh.transform.localRotation; poseFinger.intermediate.localPosition = finger.intermediate.mesh.transform.localPosition; poseFinger.intermediate.localRotation = finger.intermediate.mesh.transform.localRotation; poseFinger.distal.localPosition = finger.distal.mesh.transform.localPosition; poseFinger.distal.localRotation = finger.distal.mesh.transform.localRotation; }
public virtual void UpdateFinger(Finger finger, HandPose.Finger openPoseFinger, HandPose.Finger closePoseFinger, float ratio) { finger.proximal.collider.transform.localPosition = Vector3.Lerp(openPoseFinger.proximal.localPosition, closePoseFinger.proximal.localPosition, ratio); finger.proximal.collider.transform.localRotation = Quaternion.Lerp(openPoseFinger.proximal.localRotation, closePoseFinger.proximal.localRotation, ratio); finger.intermediate.collider.transform.localPosition = Vector3.Lerp(openPoseFinger.intermediate.localPosition, closePoseFinger.intermediate.localPosition, ratio); finger.intermediate.collider.transform.localRotation = Quaternion.Lerp(openPoseFinger.intermediate.localRotation, closePoseFinger.intermediate.localRotation, ratio); finger.distal.collider.transform.localPosition = Vector3.Lerp(openPoseFinger.distal.localPosition, closePoseFinger.distal.localPosition, ratio); finger.distal.collider.transform.localRotation = Quaternion.Lerp(openPoseFinger.distal.localRotation, closePoseFinger.distal.localRotation, ratio); if (!Application.isPlaying) { finger.proximal.mesh.transform.localPosition = Vector3.Lerp(openPoseFinger.proximal.localPosition, closePoseFinger.proximal.localPosition, ratio); finger.proximal.mesh.transform.localRotation = Quaternion.Lerp(openPoseFinger.proximal.localRotation, closePoseFinger.proximal.localRotation, ratio); finger.intermediate.mesh.transform.localPosition = Vector3.Lerp(openPoseFinger.intermediate.localPosition, closePoseFinger.intermediate.localPosition, ratio); finger.intermediate.mesh.transform.localRotation = Quaternion.Lerp(openPoseFinger.intermediate.localRotation, closePoseFinger.intermediate.localRotation, ratio); finger.distal.mesh.transform.localPosition = Vector3.Lerp(openPoseFinger.distal.localPosition, closePoseFinger.distal.localPosition, ratio); finger.distal.mesh.transform.localRotation = Quaternion.Lerp(openPoseFinger.distal.localRotation, closePoseFinger.distal.localRotation, ratio); } }