ошибки поворота, прицела
This commit is contained in:
1 parent
202a894140
commit
da648df1d9
200 files changed
+31969
-629
No files matched your search
@@ -10,7 +10,7 @@ public static class SetupPlayerAnimatorLayers
|
||||
private const string IdleFbxPath = "Assets/Kevin Iglesias/Human Animations/Animations/Male/Idles/HumanM@Idle01.fbx";
|
||||
private const string WalkFbxPath = "Assets/Kevin Iglesias/Human Animations/Animations/Male/Movement/Walk/HumanM@Walk01_Forward.fbx";
|
||||
private const string SprintFbxPath = "Assets/Kevin Iglesias/Human Animations/Animations/Male/Movement/Sprint/HumanM@Sprint01_Forward.fbx";
|
||||
private const string AttackFbxPath = "Assets/Brawler Animations/Animations/Atk_P_1.fbx";
|
||||
private const string AttackFbxPath = "Assets/Brawler Animations Sample/Animations/Atk_P_1.fbx";
|
||||
private const string GunAimFbxPath = "Assets/Kevin Iglesias/Human Animations/Animations/Male/Combat/Gun/HumanM@Gun_Aim01.fbx";
|
||||
private const string GunShootFbxPath = "Assets/Kevin Iglesias/Human Animations/Animations/Male/Combat/Gun/HumanM@Gun_Aim01_Shoot01.fbx";
|
||||
private const string GunReloadFbxPath = "Assets/Kevin Iglesias/Human Animations/Animations/Male/Combat/Gun/HumanM@Gun_Reload01.fbx";
|
||||
@@ -80,7 +80,7 @@ public static class SetupPlayerAnimatorLayers
|
||||
locomotionState.motion = blendTree;
|
||||
baseSm.defaultState = locomotionState;
|
||||
|
||||
// Создаем Melee Attack State
|
||||
// Создаем Melee Attack State в Base Layer
|
||||
var attackClip = FindClip(AttackFbxPath);
|
||||
if (attackClip != null)
|
||||
{
|
||||
@@ -98,8 +98,12 @@ public static class SetupPlayerAnimatorLayers
|
||||
fromAttack.exitTime = 0.85f;
|
||||
fromAttack.duration = 0.15f;
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogError($"[SetupPlayerAnimatorLayers] Attack clip not found at path: {AttackFbxPath}!");
|
||||
}
|
||||
|
||||
// 3. UpperBody Layer (для удержания оружия, выстрела, перезарядки)
|
||||
// 3. UpperBody Layer (для удержания оружия, выстрела, перезарядки и рукопашного удара при оружии)
|
||||
var upperMask = AssetDatabase.LoadAssetAtPath<AvatarMask>(UpperMaskPath);
|
||||
if (upperMask == null)
|
||||
{
|
||||
@@ -128,9 +132,11 @@ public static class SetupPlayerAnimatorLayers
|
||||
var gunShootClip = FindClip(GunShootFbxPath);
|
||||
var gunReloadClip = FindClip(GunReloadFbxPath);
|
||||
|
||||
AnimatorState gunAimState = null;
|
||||
|
||||
if (gunAimClip != null)
|
||||
{
|
||||
var gunAimState = upperSm.AddState("Gun_Aim", new Vector3(250, 150, 0));
|
||||
gunAimState = upperSm.AddState("Gun_Aim", new Vector3(250, 150, 0));
|
||||
gunAimState.motion = gunAimClip;
|
||||
|
||||
// Empty <-> Gun_Aim
|
||||
@@ -179,6 +185,34 @@ public static class SetupPlayerAnimatorLayers
|
||||
}
|
||||
}
|
||||
|
||||
// Также добавляем Attack в UpperBody Layer, чтобы при удержании оружия (вес UpperBody=1) анимация удара не блокировалась
|
||||
if (attackClip != null)
|
||||
{
|
||||
var upperAttackState = upperSm.AddState("Attack", new Vector3(500, 0, 0));
|
||||
upperAttackState.motion = attackClip;
|
||||
upperAttackState.speed = 1.15f;
|
||||
|
||||
var toUpperAttack = upperSm.AddAnyStateTransition(upperAttackState);
|
||||
toUpperAttack.AddCondition(AnimatorConditionMode.If, 0f, "Attack");
|
||||
toUpperAttack.duration = 0.08f;
|
||||
toUpperAttack.canTransitionToSelf = false;
|
||||
|
||||
if (gunAimState != null)
|
||||
{
|
||||
var toAimAfterAttack = upperAttackState.AddTransition(gunAimState);
|
||||
toAimAfterAttack.AddCondition(AnimatorConditionMode.If, 0f, "HasGun");
|
||||
toAimAfterAttack.hasExitTime = true;
|
||||
toAimAfterAttack.exitTime = 0.85f;
|
||||
toAimAfterAttack.duration = 0.15f;
|
||||
}
|
||||
|
||||
var toEmptyAfterAttack = upperAttackState.AddTransition(emptyState);
|
||||
toEmptyAfterAttack.AddCondition(AnimatorConditionMode.IfNot, 0f, "HasGun");
|
||||
toEmptyAfterAttack.hasExitTime = true;
|
||||
toEmptyAfterAttack.exitTime = 0.85f;
|
||||
toEmptyAfterAttack.duration = 0.15f;
|
||||
}
|
||||
|
||||
controller.layers = layers;
|
||||
|
||||
EditorUtility.SetDirty(controller);
|
||||
|
||||
Reference in new issue
Block a user