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; }
void Awake() { vrik = GetComponent <VRIK>(); initialScale = transform.localScale; initialLoco = new IKSolverVR.Locomotion(); var vrikLoco = vrik.solver.locomotion; initialLoco.footDistance = vrikLoco.footDistance; initialLoco.stepThreshold = vrikLoco.stepThreshold; initialLoco.maxVelocity = vrikLoco.maxVelocity; initialLoco.stepHeight = new AnimationCurve(vrikLoco.stepHeight.keys); initialLoco.heelHeight = new AnimationCurve(vrikLoco.heelHeight.keys); }
public void ApplyTo(IKSolverVR.Locomotion locomotion) { locomotion.weight = weight; locomotion.footDistance = footDistance; locomotion.stepThreshold = stepThreshold; locomotion.angleThreshold = angleThreshold; locomotion.comAngleMlp = comAngleMlp; locomotion.maxVelocity = maxVelocity; locomotion.velocityFactor = velocityFactor; locomotion.maxLegStretch = maxLegStretch; locomotion.rootSpeed = rootSpeed; locomotion.stepSpeed = stepSpeed; locomotion.relaxLegTwistMinAngle = relaxLegTwistMinAngle; locomotion.relaxLegTwistSpeed = relaxLegTwistSpeed; }
public VRIKSolverDataLocomotion(IKSolverVR.Locomotion locomotion) { weight = locomotion.weight; footDistance = locomotion.footDistance; stepThreshold = locomotion.stepThreshold; angleThreshold = locomotion.angleThreshold; comAngleMlp = locomotion.comAngleMlp; maxVelocity = locomotion.maxVelocity; velocityFactor = locomotion.velocityFactor; maxLegStretch = locomotion.maxLegStretch; rootSpeed = locomotion.rootSpeed; stepSpeed = locomotion.stepSpeed; relaxLegTwistMinAngle = locomotion.relaxLegTwistMinAngle; relaxLegTwistSpeed = locomotion.relaxLegTwistSpeed; }
void SetupTarget() { if (m_target != null) { m_target.Source = m_source; m_target.SourceType = UniHumanoid.HumanPoseTransfer.HumanPoseTransferSourceType.HumanPoseTransfer; m_blendShape = m_target.GetComponent <VRMBlendShapeProxy>(); m_firstPerson = m_target.GetComponent <VRMFirstPerson>(); var animator = m_target.GetComponent <Animator>(); if (animator != null) { animator.runtimeAnimatorController = m_animationController; VRIK m_vrik = m_target.gameObject.AddComponent <VRIK>(); m_vrik.AutoDetectReferences(); m_vrik.solver.spine.headTarget = m_headTarget; m_vrik.solver.leftArm.target = m_leftHandTarget; m_vrik.solver.rightArm.target = m_rightHandTarget; m_vrik.solver.leftArm.stretchCurve = new AnimationCurve(); m_vrik.solver.rightArm.stretchCurve = new AnimationCurve(); IKSolverVR.Locomotion m_vrikLoco = m_vrik.solver.locomotion; m_vrikLoco.footDistance = 0.1f; m_vrikLoco.stepThreshold = 0.2f; VRIKCalibrator.Calibrate(m_vrik, null, m_headTarget, null, m_leftHandTarget, m_rightHandTarget, null, null); m_firstPerson.Setup(); _handPoseController.SetAnimaor(animator); if (m_faceCamera != null) { m_faceCamera.Target = animator.GetBoneTransform(HumanBodyBones.Head); } } } }