public void OnSceneGUI() { Handle handle = (Handle)target; if (handle.handTarget == null) { return; } if (!Application.isPlaying) { handle.handTarget.poseMixer.ShowPose(handle.handTarget.humanoid, handle.handTarget.side); HandInteraction.MoveHandTargetToHandle(handle.handTarget, handle); ArmMovements.Update(handle.handTarget); FingerMovements.Update(handle.handTarget); handle.handTarget.MatchTargetsToAvatar(); } }
private void UpdateArmIK(ArmSensor armSensor) { Vector3 handTargetPosition = handTarget.hand.target.transform.position; Quaternion handTargetRotation = handTarget.hand.target.transform.rotation; Vector3 forearmUpAxis = HumanoidTarget.ToQuaternion(armSensor.upperArm.rotation) * Vector3.up; if (handTarget.upperArm.target.confidence.rotation < 0.9F) { handTarget.upperArm.target.transform.rotation = ArmMovements.UpperArmRotationIK(handTarget.upperArm.target.transform.position, handTargetPosition, forearmUpAxis, handTarget.upperArm.target.length, handTarget.forearm.target.length, handTarget.isLeft); handTarget.upperArm.target.confidence = armSensor.upperArm.confidence; } if (handTarget.forearm.target.confidence.rotation < 0.9F) { handTarget.forearm.target.transform.rotation = ArmMovements.ForearmRotationIK(handTarget.forearm.target.transform.position, handTargetPosition, forearmUpAxis, handTarget.isLeft); handTarget.forearm.target.confidence = armSensor.forearm.confidence; } handTarget.hand.target.transform.rotation = handTargetRotation; handTarget.hand.target.confidence.rotation = armSensor.hand.confidence.rotation; }