protected virtual void UpdateUpperLeg(LegSensor legSensor) { if (footTarget.upperLeg.target.transform != null) { if (legSensor.upperLeg.confidence.position > 0) { footTarget.upperLeg.target.transform.position = HumanoidTarget.ToVector3(legSensor.upperLeg.position); } //else // footTarget.upperLeg.target.transform.position = footTarget.shoulder.target.transform.position + footTarget.shoulder.target.transform.rotation * footTarget.outward * footTarget.shoulder.bone.length; if (legSensor.upperLeg.confidence.rotation > 0) { footTarget.upperLeg.target.transform.rotation = HumanoidTarget.ToQuaternion(legSensor.upperLeg.rotation); } footTarget.upperLeg.target.confidence = legSensor.upperLeg.confidence; } }
protected virtual void UpdateFoot(LegSensor legSensor) { if (footTarget.foot.target.transform != null) { if (legSensor.foot.confidence.position > 0) { footTarget.foot.target.transform.position = HumanoidTarget.ToVector3(legSensor.foot.position); } else { footTarget.foot.target.transform.position = footTarget.lowerLeg.target.transform.position + footTarget.lowerLeg.target.transform.rotation * Vector3.down * footTarget.lowerLeg.bone.length; } if (legSensor.foot.confidence.rotation > 0) { footTarget.foot.target.transform.rotation = HumanoidTarget.ToQuaternion(legSensor.foot.rotation); } footTarget.foot.target.confidence = legSensor.foot.confidence; } }
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; }
protected virtual void UpdateJaw(FaceTarget.TargetedJawBone jaw) { jaw.target.transform.localRotation = HumanoidTarget.ToQuaternion(jaw.target.rotation); }