private void CalibrateHand(Transform handBone, IKSolverVR.Arm arm, bool isLeft) { // adjust tracker position to transform position (neck) var target = TargetObject.transform; // matches the rotation but the pose of player does not necessarily matches the pose of the model // 1st, matches wrist-to-palm vector to tracker forward var trackerUpVector = transform.up; var handUpVector = handBone.rotation * Vector3.Cross(arm.wristToPalmAxis, arm.palmToThumbAxis); if (handUpVector.y < 0) { handUpVector = -handUpVector; } var angle1 = Vector3.Angle(trackerUpVector, handUpVector); var axis1 = -Vector3.Cross(trackerUpVector, handUpVector); target.rotation = Quaternion.AngleAxis(angle1, axis1) * target.rotation; // 2nd, matches hand upward (downward) vector to tracker upward (downward) var trackerDownVector = -trackerUpVector; var currentForwardVector = target.forward; var angle2 = Vector3.Angle(trackerDownVector, currentForwardVector); var axis2 = -Vector3.Cross(trackerDownVector, currentForwardVector); target.rotation = Quaternion.AngleAxis(angle2, axis2) * target.rotation; }
public VRIKSolverDataArm(IKSolverVR.Arm arm) { positionWeight = arm.positionWeight; rotationWeight = arm.rotationWeight; shoulderRotationWeight = arm.shoulderRotationWeight; shoulderTwistWeight = arm.shoulderTwistWeight; bendGoalWeight = arm.bendGoalWeight; swivelOffset = arm.swivelOffset; armLengthMlp = arm.armLengthMlp; }
public void ApplyTo(IKSolverVR.Arm arm) { arm.positionWeight = positionWeight; arm.rotationWeight = rotationWeight; arm.shoulderRotationWeight = shoulderRotationWeight; arm.shoulderTwistWeight = shoulderTwistWeight; arm.bendGoalWeight = bendGoalWeight; arm.swivelOffset = swivelOffset; arm.armLengthMlp = armLengthMlp; }
public CachedSolver(IKSolverVR solver) { Solver = solver; Spine = solver.spine; LeftArm = solver.leftArm; LeftLeg = solver.leftLeg; RightArm = solver.rightArm; RightLeg = solver.rightLeg; Locomotion = solver.locomotion; LeftLegBones = LeftLeg.bones; RightLegBones = RightLeg.bones; }