public static bool IsInThirdPersonPostureFilters(ThirdPersonPosture posture) { for (var i = 0; i < _thirdPersonPostureFilters.Length; ++i) { if (_thirdPersonPostureFilters[i] == posture) { return(true); } } return(false); }
private void StableUpperBody(float upperBodyOverlayWeight, ThirdPersonPosture type) { if (upperBodyOverlayWeight > 0 && !ExcludePostures.Contains(type)) { Quaternion untouchedRotation = GetUntouchedRotation(type); var rotation = Quaternion.Inverse(_pelvisP3.localRotation); // spineP3父亲的旋转为 newPelvis = (1 - t) * (当前pelvis旋转) + t * (默认idle的pelvis旋转),t为上半身层的权重 rotation = rotation * SlerpRotation(_pelvisP3.localRotation, untouchedRotation, upperBodyOverlayWeight); _spineP3.localRotation = rotation * _spineP3.localRotation; } }
public static PostureInConfig ConvertToPostureInConfig(ThirdPersonPosture pos) { PostureInConfig ret = PostureInConfig.Null; switch (pos) { case ThirdPersonPosture.Stand: ret = PostureInConfig.Stand; break; case ThirdPersonPosture.Crouch: ret = PostureInConfig.Crouch; break; case ThirdPersonPosture.Prone: ret = PostureInConfig.Prone; break; case ThirdPersonPosture.ProneTransit: ret = PostureInConfig.ProneTransit; break; case ThirdPersonPosture.ProneToStand: ret = PostureInConfig.ProneToStand; break; case ThirdPersonPosture.ProneToCrouch: ret = PostureInConfig.ProneToCrouch; break; case ThirdPersonPosture.Swim: ret = PostureInConfig.Swim; break; case ThirdPersonPosture.Dive: ret = PostureInConfig.Dive; break; case ThirdPersonPosture.Dying: ret = PostureInConfig.Dying; break; default: break; } return(ret); }
private Quaternion GetUntouchedRotation(ThirdPersonPosture type) { Quaternion ret; switch (type) { case ThirdPersonPosture.Crouch: ret = _pelvisUntouchedCrouchRotationP3; break; case ThirdPersonPosture.Stand: ret = _pelvisUntouchedStandRotationP3; break; default: ret = _pelvisUntouchedStandRotationP3; break; } return(ret); }
public static bool ActiveIK(ThirdPersonAction action, ThirdPersonPosture posture) { return((action == ThirdPersonAction.EndOfTheWorld) && !IKFilter.IsInThirdPersonPostureFilters(posture)); }