public void ToggleLeftHandTarget(Transform leftHandTarget) { Console.WriteLine("ToggleLeftHandTarget"); VRIK _VRIK = base.gameObject.GetComponent <VRIK>(); if ("RightHand".Equals(_VRIK.solver.leftArm.target.parent.name)) { _VRIK.solver.leftArm.target = this.LeftHandTarget; } else { _VRIK.solver.leftArm.target = leftHandTarget; } }
public void Start() { VRIK _VRIK = base.gameObject.GetComponent <VRIK>(); if (_VRIK != null) { _VRIK.solver.spine.headTarget = this.HeadTarget; _VRIK.solver.leftArm.target = this.LeftHandTarget; _VRIK.solver.rightArm.target = this.RightHandTarget; Type type = this.GetType(); FieldInfo[] fieldInfos = type.GetFields(BindingFlags.Instance | BindingFlags.Public); foreach (FieldInfo fieldInfo in fieldInfos) { string[] propertyName = fieldInfo.Name.Split('_'); var value = fieldInfo.GetValue(this); if (propertyName.Count() > 1) { if ("Spine" == propertyName[0]) { SetProperty(_VRIK.solver.spine, propertyName[1], value); } else if ("LeftArm" == propertyName[0]) { SetProperty(_VRIK.solver.leftArm, propertyName[1], value); } else if ("RightArm" == propertyName[0]) { SetProperty(_VRIK.solver.rightArm, propertyName[1], value); } else if ("LeftLeg" == propertyName[0]) { SetProperty(_VRIK.solver.leftLeg, propertyName[1], value); } else if ("RightLeg" == propertyName[0]) { SetProperty(_VRIK.solver.rightLeg, propertyName[1], value); } else if ("Locomotion" == propertyName[0]) { SetProperty(_VRIK.solver.locomotion, propertyName[1], value); } } } } }
public void CheckFullBodyTracking() { #if PLUGIN VRIK _VRIK = base.gameObject.GetComponent <VRIK>(); _VRIK.solver.spine.pelvisPositionWeight = 0f; _VRIK.solver.spine.pelvisRotationWeight = 0f; _VRIK.solver.leftLeg.positionWeight = 0f; _VRIK.solver.leftLeg.rotationWeight = 0f; _VRIK.solver.rightLeg.positionWeight = 0f; _VRIK.solver.rightLeg.rotationWeight = 0f; switch (CustomAvatar.Plugin.FullBodyTrackingType) { case CustomAvatar.Plugin.TrackingType.Hips: { _VRIK.solver.spine.pelvisPositionWeight = this.Spine_pelvisPositionWeight; _VRIK.solver.spine.pelvisRotationWeight = this.Spine_pelvisRotationWeight; break; } case CustomAvatar.Plugin.TrackingType.Feet: { _VRIK.solver.leftLeg.positionWeight = this.LeftLeg_positionWeight; _VRIK.solver.leftLeg.rotationWeight = this.LeftLeg_rotationWeight; _VRIK.solver.rightLeg.positionWeight = this.RightLeg_positionWeight; _VRIK.solver.rightLeg.rotationWeight = this.RightLeg_rotationWeight; break; } case CustomAvatar.Plugin.TrackingType.Full: { _VRIK.solver.spine.pelvisPositionWeight = this.Spine_pelvisPositionWeight; _VRIK.solver.spine.pelvisRotationWeight = this.Spine_pelvisRotationWeight; _VRIK.solver.leftLeg.positionWeight = this.LeftLeg_positionWeight; _VRIK.solver.leftLeg.rotationWeight = this.LeftLeg_rotationWeight; _VRIK.solver.rightLeg.positionWeight = this.RightLeg_positionWeight; _VRIK.solver.rightLeg.rotationWeight = this.RightLeg_rotationWeight; break; } } #endif }