//private float m_LastTime; protected virtual void Awake() { m_FBBIK = GetComponent <FullBodyBipedIK>(); m_FBBIK.solver.OnPreUpdate += ModifyOffset; //m_LastTime = Time.time; OnInit(); }
void Start() { ik = GetComponent <FullBodyBipedIK>(); // You can use just LateUpdate, but note that it doesn't work when you have animatePhysics turned on for the character. ik.solver.OnPostUpdate += RotateShoulders; }
private void OnVrmDisposing() { _ik = null; _rightArmBendGoal = null; _leftArmBendGoal = null; _isInitialized = false; }
private void Start() { this.ik = base.GetComponent <FullBodyBipedIK>(); IKSolverFullBodyBiped expr_17 = this.ik.solver; expr_17.OnPostUpdate = (IKSolver.UpdateDelegate)Delegate.Combine(expr_17.OnPostUpdate, new IKSolver.UpdateDelegate(this.RotateShoulders)); }
void Start() { ik = GetComponent <FullBodyBipedIK>(); animator = GetComponent <Animator>(); lastForward = transform.forward; }
public static void Prefix(ArmsController __instance, PlayerTool tool) { FullBodyBipedIK ik = VRHandsController.main.ik; ik.solver.GetBendConstraint(FullBodyBipedChain.LeftArm).bendGoal = __instance.leftHandElbow; ik.solver.GetBendConstraint(FullBodyBipedChain.LeftArm).weight = 1f; if (tool == null) { Traverse tInstance = Traverse.Create(__instance); tInstance.Field("leftAim").Field("shouldAim").SetValue(false); tInstance.Field("rightAim").Field("shouldAim").SetValue(false); ik.solver.leftHandEffector.target = null; ik.solver.rightHandEffector.target = null; if (!VRHandsController.main.pda.isActiveAndEnabled) { Transform leftWorldTarget = tInstance.Field <Transform>("leftWorldTarget").Value; if (leftWorldTarget) { ik.solver.leftHandEffector.target = leftWorldTarget; ik.solver.GetBendConstraint(FullBodyBipedChain.LeftArm).bendGoal = null; ik.solver.GetBendConstraint(FullBodyBipedChain.LeftArm).weight = 0f; } Transform rightWorldTarget = tInstance.Field <Transform>("rightWorldTarget").Value; if (rightWorldTarget) { ik.solver.rightHandEffector.target = rightWorldTarget; return; } } } }
void Start() { action = GameObject.Find("Surface").GetComponent <Actions>(); speed = action.userSpeed; task = action.task; dict = task.dict; //to get the right shoulder position ik = GameObject.Find("Assistant").GetComponent <FullBodyBipedIK>(); R_shoulderPos = ik.solver.rightArmChain.nodes[0].transform; R_hand = ik.solver.rightArmChain.nodes[2].transform; startTime = Time.time; for (int i = 0; i < task.activeNum; i++) { if (dict[i].hitTarget() == false) { for (int j = 0; j < task.activeNum; j++) { if (Vector3.Distance(dict[i].oriObject.transform.position, dict[j].targHolder.transform.position) < 0.05f && i != j) { pointNum.Add(i); //check all the cubes that are in the wrong positions pointNum.Add(j); //find a pair of cubes break; } } } } pointNum.Add(0); index = pointNum[0]; }
void Start() { ik = GetComponent <FullBodyBipedIK>(); // Connect the left hand to the target Quaternion targetRotation = target.rotation; target.rotation = leftHandTarget.rotation; FixedJoint j = target.gameObject.AddComponent <FixedJoint>(); j.connectedBody = leftHandTarget.rigidbody; target.rotation = targetRotation; // Remember the rotation of the root relative to the pelvis rootRelativeToPelvis = Quaternion.Inverse(pelvisTarget.rotation) * transform.rotation; // Remember the position of the root relative to the pelvis pelvisToRoot = Quaternion.Inverse(ik.references.pelvis.rotation) * (transform.position - ik.references.pelvis.position); // Set effector weights ik.solver.leftHandEffector.positionWeight = 1f; ik.solver.leftHandEffector.rotationWeight = 1f; }
void Start() { ik = GetComponent <FullBodyBipedIK>(); // Connect the left hand to the target Quaternion targetRotation = target.rotation; target.rotation = leftHandTarget.rotation; FixedJoint j = target.gameObject.AddComponent <FixedJoint>(); j.connectedBody = leftHandTarget.GetComponent <Rigidbody>(); target.GetComponent <Rigidbody>().MoveRotation(targetRotation); //target.rotation = targetRotation; // Remember the rotation of the root relative to the pelvis rootRelativeToPelvis = Quaternion.Inverse(pelvisTarget.rotation) * transform.rotation; // Remember the position of the root relative to the pelvis pelvisToRoot = Quaternion.Inverse(ik.references.pelvis.rotation) * (transform.position - ik.references.pelvis.position); rootTargetPosition = transform.position; rootTargetRotation = transform.rotation; lastWeight = weight; }
public HeelInfoAnimation(ChaControl chaControl) { _generalSetting = StilettoContext._generalSettingsProvider.Value; _animationBody = chaControl.animBody; _body = chaControl.objBodyBone.transform.parent; _highWaist = _body.Find("cf_j_root/cf_n_height/cf_j_hips/cf_j_waist01"); _lowWaist = _highWaist.Find("cf_j_waist02"); if (_lowWaist == null) { return; } _leftThigh = _lowWaist.Find("cf_j_thigh00_L"); _leftHighLeg = _leftThigh.Find("cf_j_leg01_L"); _leftLowLeg = _leftHighLeg.Find("cf_j_leg03_L"); _leftFoot = _leftLowLeg.Find("cf_j_foot_L"); _leftToe = _leftFoot.Find("cf_j_toes_L"); _rightThigh = _lowWaist.Find("cf_j_thigh00_R"); _rightHighLeg = _rightThigh.Find("cf_j_leg01_R"); _rightLowLeg = _rightHighLeg.Find("cf_j_leg03_R"); _rightFoot = _rightLowLeg.Find("cf_j_foot_R"); _rightToe = _rightFoot.Find("cf_j_toes_R"); _fullBodyBiped = _animationBody.GetComponent <FullBodyBipedIK>(); _reset = true; }
public void Initialize(ArmsController controller) { armsController = controller; player = Utils.GetLocalPlayerComp(); ik = controller.GetComponent <FullBodyBipedIK>(); scale = MainCameraControl.main.viewModel.localScale; }
void Start() { // Storing the default scale of the bomb defaultScale = transform.localScale; r = character.GetComponent <Rigidbody>(); ik = character.GetComponent <FullBodyBipedIK>(); }
static bool Prefix(MotionIKUI __instance, ChaControl _chara, Motion.IK _ik, FullBodyBipedIK _fullBodyIK, KinematicCtrl _kinematicCtrl, int _charaID) { if (_ik == null || _fullBodyIK == null || _kinematicCtrl == null) { return(false); } var hEditInstance = Singleton <HEditGlobal> .Instance; var nowPartCharaInfo = hEditInstance.nowPartCharaInfo; hEditInstance.nowPartCharaInfo = null; if (_ik.isUse) { _kinematicCtrl.Active(PoseInfo.ModeEN.IK, false); } var effectors = new IKEffector[] { _fullBodyIK.solver.bodyEffector, _fullBodyIK.solver.leftShoulderEffector, _fullBodyIK.solver.leftHandEffector, _fullBodyIK.solver.rightShoulderEffector, _fullBodyIK.solver.rightHandEffector, _fullBodyIK.solver.leftThighEffector, _fullBodyIK.solver.leftFootEffector, _fullBodyIK.solver.rightThighEffector, _fullBodyIK.solver.rightFootEffector }; var chains = new FBIKChain[] { _fullBodyIK.solver.leftArmChain, _fullBodyIK.solver.rightArmChain, _fullBodyIK.solver.leftLegChain, _fullBodyIK.solver.rightLegChain }; for (int i = 0; i < EffectorIndices.Length; i++) { var targetIndex = EffectorIndices[i]; var effector = effectors[i]; var area = _ik.areas[targetIndex]; SetIKUse(__instance, targetIndex, effector, area.isUse, _kinematicCtrl, false); SetIKWeight(__instance, targetIndex, effector, area.isUse, area.weight, false); hEditInstance.SetIKParent(_chara, _kinematicCtrl, area.parentCharaID, area.parentArea, targetIndex); hEditInstance.SetIKPos(_kinematicCtrl.lstIKBone[targetIndex].changeAmount, area.amount); } for (int i = 0; i < ChainIndices.Length; i++) { var targetIndex = ChainIndices[i]; var chain = chains[i]; var area = _ik.areas[targetIndex]; SetIKUse(__instance, targetIndex, chain, area.isUse, _kinematicCtrl, false); SetIKWeight(__instance, targetIndex, chain, area.isUse, area.weight, false); hEditInstance.SetIKParent(_chara, _kinematicCtrl, area.parentCharaID, area.parentArea, targetIndex); hEditInstance.SetIKPos(_kinematicCtrl.lstIKBone[targetIndex].changeAmount, area.amount); } if (!_ik.isUse) { _kinematicCtrl.Active(PoseInfo.ModeEN.None, false); } else if (__instance.CharaInfoData != null && __instance.CharaInfoData.useCharaID != _charaID) { hEditInstance.KinematicCtrlAllVisible(_kinematicCtrl, false); } hEditInstance.nowPartCharaInfo = nowPartCharaInfo; return(false); }
//public AudioSource FailureClip; //This routine starts the pickup for the object IEnumerator OnPickUp() { ik = BallIO.lastUsedInteractionSystem.GetComponent <FullBodyBipedIK> (); while (holdWeight < 1f) { holdWeight += Time.deltaTime; yield return(null); } }
protected override void Start() { base.Start(); ik = GetComponent <FullBodyBipedIK>(); animator = GetComponent <Animator>(); lastForward = transform.forward; }
protected override void Start() { base.Start(); this.aim = base.GetComponent <AimIK>(); this.ik = base.GetComponent <FullBodyBipedIK>(); this.aim.Disable(); this.ik.Disable(); this.fpsCamDefaultRot = this.firstPersonCam.transform.localRotation; }
// OnStateEnter is called when a transition starts and the state machine starts to evaluate this state override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { player = AC.KickStarter.player; ik = player.GetComponent <FullBodyBipedIK>(); intSystem = player.GetComponent <InteractionSystem>(); rightHandTarget = player.GetComponent <InteractionSystem>().interactionObject.rHandTarget; leftHandTarget = player.GetComponent <InteractionSystem>().interactionObject.lHandTarget; }
void Awake() { _animator = GetComponent <Animator>(); _rotationShiftL = Quaternion.LookRotation(leftHandForward.normalized, leftHandUp.normalized); _rotationShiftR = Quaternion.LookRotation(rightHandForward.normalized, rightHandUp.normalized); #if FINALIK _ik = GetComponent <FullBodyBipedIK>(); #endif }
protected override void Awake() { base.Awake(); _charaPoseControllers.Add(this); this._body = this._target.ociChar.fullBodyIK; if (this._target.isFemale) { this._boobsEditor = new BoobsEditor(this, this._target); this._modules.Add(this._boobsEditor); } if (this._target.isFemale) { this._siriDamL = this.transform.Find("p_cf_anim/cf_J_Root/cf_N_height/cf_J_Hips/cf_J_Kosi01/cf_J_Kosi02/cf_J_SiriDam_L"); this._siriDamR = this.transform.Find("p_cf_anim/cf_J_Root/cf_N_height/cf_J_Hips/cf_J_Kosi01/cf_J_Kosi02/cf_J_SiriDam_R"); this._kosi = this.transform.Find("p_cf_anim/cf_J_Root/cf_N_height/cf_J_Hips/cf_J_Kosi01/cf_J_Kosi02/cf_J_Kosi02_s"); } else { this._siriDamL = this.transform.Find("p_cm_anim/cm_J_Root/cm_N_height/cm_J_Hips/cm_J_Kosi01/cm_J_Kosi02/cm_J_SiriDam_L"); this._siriDamR = this.transform.Find("p_cm_anim/cm_J_Root/cm_N_height/cm_J_Hips/cm_J_Kosi01/cm_J_Kosi02/cm_J_SiriDam_R"); this._kosi = this.transform.Find("p_cm_anim/cm_J_Root/cm_N_height/cm_J_Hips/cm_J_Kosi01/cm_J_Kosi02/cm_J_Kosi02_s"); } this._leftFoot2 = this._body.solver.leftLegMapping.bone3.GetChild(0); this._leftFoot2OriginalRotation = this._leftFoot2.localRotation; this._leftFoot2ParentOriginalRotation = 357.7f; this._rightFoot2 = this._body.solver.rightLegMapping.bone3.GetChild(0); this._rightFoot2OriginalRotation = this._rightFoot2.localRotation; this._rightFoot2ParentOriginalRotation = 357.7f; this._siriDamLOriginalRotation = this._siriDamL.localRotation; this._siriDamROriginalRotation = this._siriDamR.localRotation; this._kosiOriginalRotation = this._kosi.localRotation; IKSolver_Patches.onPostUpdate += this.IKSolverOnPostUpdate; IKExecutionOrder_Patches.onPostLateUpdate += this.IKExecutionOrderOnPostLateUpdate; FKCtrl_Patches.onPreLateUpdate += this.FKCtrlOnPreLateUpdate; Expression_Patches.onPostLateUpdate += this.ExpressionOnPostLateUpdate; OCIChar_ChangeChara_Patches.onChangeChara += this.OnCharacterReplaced; OCIChar_LoadClothesFile_Patches.onLoadClothesFile += this.OnLoadClothesFile; //OCIChar_SetCoordinateInfo_Patches.onSetCoordinateInfo += this.OnCoordinateReplaced; this.crotchJointCorrection = PHPE._self.crotchCorrectionByDefault; this.leftFootJointCorrection = PHPE._self.anklesCorrectionByDefault; this.rightFootJointCorrection = PHPE._self.anklesCorrectionByDefault; }
// Start is called before the first frame update void Start() { anim = GetComponent <Animator>(); cam = GameObject.Find("Main Camera"); lineRenderer = GetComponent <LineRenderer>(); moveCamera = GameObject.Find("MoveCamera").GetComponent <CinemachineFreeLook>(); aimCamera = GameObject.Find("AimCamera").GetComponent <CinemachineFreeLook>(); lookAT = transform.parent.Find("LookAT").transform; ik = GetComponent <FullBodyBipedIK>(); gun.SetActive(false); }
void Start() { action = GameObject.Find("Surface").GetComponent <Actions>(); speed = action.userSpeed; task = action.task; dict = task.dict; //to get the right shoulder position ik = GameObject.Find("Assistant").GetComponent <FullBodyBipedIK>(); R_shoulderPos = ik.solver.rightArmChain.nodes[0].transform; R_hand = ik.solver.rightArmChain.nodes[2].transform; startTime = Time.time; for (int i = 0; i < task.activeNum; i++) { if (dict[task.matNum[i]].hitTarget() == false) { temp1.Add(task.matNum[i]); //find the objects first } } for (int i = 0; i < temp1.Count; i++) { temp2.Add(FindtargHolder(temp1[i])); //find the target holder for each objects } temp3 = SortIndex(temp2); //sort the target holder for (int i = 0; i < temp1.Count; i++) { pointNum.Add(FindObjectOnHolder(temp3[i])); //find the objects on the sorted holder } //for (int i = 0; i < task.activeNum; i++) //{ // if (dict[task.matNum[i]].hitTarget() == false) // { // pointNum.Add(task.matNum[i]); //check all the cubes that are in the wrong positions // } //} pointNum.Add(0); index = pointNum[0]; index_holder = FindtargHolder(index); red = Resources.Load <Material>("Materials/ObjectColor/red") as Material; white = Resources.Load <Material>("Materials/ObjectColor/white") as Material; }
void Start() { ik = GetComponent <FullBodyBipedIK>(); // Get a call from FBBIK each time it has finished updating ik.solver.OnPostUpdate += AfterFBBIK; if (ik.solver.rightHandEffector.target == null) { Debug.LogError("Right Hand Effector needs a Target in this demo."); } }
void IPeMsg.OnMsg(EMsg msg, params object[] args) { switch (msg) { case EMsg.View_Prefab_Build: BiologyViewRoot viewRoot = args[1] as BiologyViewRoot; m_AnimEffectCtrl = viewRoot.ikAnimEffectCtrl; m_IKAimCtrl = viewRoot.ikAimCtrl; m_IKFlashLight = viewRoot.ikFlashLight; m_FBBIK = viewRoot.fbbik; m_GroundFBBIK = viewRoot.grounderFBBIK; m_IKArray = viewRoot.ikArray; if (null != m_IKAimCtrl) { m_IKAimCtrl.SetSmoothMoveState(m_SmoothAim); } m_AutoCloseFBBIK = (null == m_GroundFBBIK); if (null != m_FBBIK) { m_FBBIK.Disable(); m_FBBIK.solver.iterations = 1; m_DefaultMappingValue = m_FBBIK.solver.leftArmMapping.weight; } if (null != m_GroundFBBIK) { m_DefaultSpineBend = m_GroundFBBIK.spineBend; } ikEnable = m_IKEnable; flashLightActive = m_FlashLightActive; enableArmMap = m_SpineMask.Count == 0; enableGrounderSpineEffect = m_SpineMask.Count == 0; break; // case EMsg.Battle_EnterShootMode: // enableGrounderSpineEffect = false; // enableArmMap = false; // break; // case EMsg.Battle_ExitShootMode: // enableGrounderSpineEffect = true; // enableArmMap = true; // break; // case EMsg.Battle_PauseShootMode: // if(null != m_IKAimCtrl) // m_IKAimCtrl.SetActive(false); // break; // case EMsg.Battle_ContinueShootMode: // if(null != m_IKAimCtrl) // m_IKAimCtrl.SetActive(true); // break; } }
public void Initialize(ArmsController controller) { armsController = controller; player = global::Utils.GetLocalPlayerComp(); ik = controller.GetComponent <FullBodyBipedIK>(); pda = player.GetPDA(); rightController = new GameObject("rightController"); rightController.transform.parent = player.camRoot.transform; leftController = new GameObject("leftController"); leftController.transform.parent = player.camRoot.transform; }
private static bool UpdatePrefix(FullBodyBipedIK __instance) { if (IkTweaksSettings.FullBodyVrIk && LastCalibrationWasInCustomIk && LastInitializedController.field_Private_FullBodyBipedIK_0 == __instance) { if (LastInitializedVRIK != null) { LastInitializedVRIK.Update_ManualDrive(); } return(false); } return(true); }
protected override void Start() { base.Start(); // Find the IK components aim = GetComponent <AimIK>(); ik = GetComponent <FullBodyBipedIK>(); // Disable the IK components to manage their updating aim.Disable(); ik.Disable(); fpsCamDefaultRot = firstPersonCam.transform.localRotation; }
private void Start() { this.ik = base.GetComponent <FullBodyBipedIK>(); Quaternion rotation = this.target.rotation; this.target.rotation = this.leftHandTarget.rotation; FixedJoint fixedJoint = this.target.gameObject.AddComponent <FixedJoint>(); fixedJoint.connectedBody = this.leftHandTarget.GetComponent <Rigidbody>(); this.target.rotation = rotation; this.rootRelativeToPelvis = Quaternion.Inverse(this.pelvisTarget.rotation) * base.transform.rotation; this.pelvisToRoot = Quaternion.Inverse(this.ik.references.pelvis.rotation) * (base.transform.position - this.ik.references.pelvis.position); this.ik.solver.leftHandEffector.positionWeight = 1f; this.ik.solver.leftHandEffector.rotationWeight = 1f; }
private float threshold = 0.03f; //can also use to adjust the pose will stuck somewhere or not void Start() { action = GameObject.Find("Surface").GetComponent <Actions>(); speed = action.userSpeed; task = action.task; dict = task.dict; //to get the right shoulder position ik = GameObject.Find("Assistant").GetComponent <FullBodyBipedIK>(); R_shoulderPos = ik.solver.rightArmChain.nodes[0].transform; R_hand = ik.solver.rightArmChain.nodes[2].transform; startTime = Time.time; }
// private void Awake() { FBIK = GetComponent <FullBodyBipedIK>(); // Body = FBIK.references.spine[BodySpineID]; BIK = FBIK.solver.bodyEffector; LFIK = FBIK.solver.leftFootEffector; RFIK = FBIK.solver.rightFootEffector; // LeftFoot = FBIK.references.leftFoot; RightFoot = FBIK.references.rightFoot; // LeftFootContact = new RaycastHit(); RightFootContact = new RaycastHit(); LeftToeContact = new RaycastHit(); RightToeContact = new RaycastHit(); LegLength = Vector3.Distance(LeftFoot.position, Body.position); }
private void OnVrmLoaded(VrmLoadedInfo info) { _ik = info.vrmRoot.GetComponent <FullBodyBipedIK>(); var spineBone = info.animator.GetBoneTransform(HumanBodyBones.Spine); _rightArmBendGoal = new GameObject().transform; _rightArmBendGoal.SetParent(spineBone); _rightArmBendGoal.localRotation = Quaternion.identity; _ik.solver.rightArmChain.bendConstraint.bendGoal = _rightArmBendGoal; _leftArmBendGoal = new GameObject().transform; _leftArmBendGoal.SetParent(spineBone); _leftArmBendGoal.localRotation = Quaternion.identity; _ik.solver.leftArmChain.bendConstraint.bendGoal = _leftArmBendGoal; _isInitialized = true; }