mirror of
https://github.com/DerTyp7/defrain-shooter-unity.git
synced 2025-10-29 20:52:10 +01:00
Procedual Animation Hand Fix
See "Procedual Animation Hand Fix" issue
This commit is contained in:
@@ -5,6 +5,14 @@ using Mirror;
|
||||
|
||||
public class ProcedualAnimationController : NetworkBehaviour
|
||||
{
|
||||
[Header("Hand Settings")]
|
||||
[SerializeField] private Transform rightHandREF;
|
||||
[SerializeField] private Transform leftHandREF;
|
||||
[SerializeField] private Transform gunRightHandREF;
|
||||
[SerializeField] private Transform gunLeftHandREF;
|
||||
[SerializeField] private Vector3 defaultRightHandPosition = Vector3.zero;
|
||||
[SerializeField] private Vector3 defaultLeftHandPosition = Vector3.zero;
|
||||
|
||||
|
||||
[Header("Step Settings")]
|
||||
[SerializeField] private float stepAmplitudeWalking;
|
||||
@@ -99,6 +107,28 @@ public class ProcedualAnimationController : NetworkBehaviour
|
||||
playerAnimator.SetFloat("x", playerController.localVelocity.x / playerController.currentMaxSpeed);
|
||||
playerAnimator.SetFloat("y", playerController.localVelocity.z / playerController.currentMaxSpeed);
|
||||
}
|
||||
|
||||
public void handPositioning()
|
||||
{
|
||||
if (gunRightHandREF != null)
|
||||
{
|
||||
rightHandREF.position = gunRightHandREF.position;
|
||||
rightHandREF.rotation = gunRightHandREF.rotation;
|
||||
}
|
||||
else
|
||||
{
|
||||
rightHandREF.position = defaultRightHandPosition;
|
||||
}
|
||||
if (gunLeftHandREF != null)
|
||||
{
|
||||
leftHandREF.position = gunLeftHandREF.position;
|
||||
leftHandREF.rotation = gunLeftHandREF.rotation;
|
||||
}
|
||||
else
|
||||
{
|
||||
leftHandREF.position = defaultLeftHandPosition;
|
||||
}
|
||||
}
|
||||
public void OnSwitchWeapon(GameObject currentWeapon)
|
||||
{
|
||||
if (isLocalPlayer) {
|
||||
@@ -141,7 +171,7 @@ public class ProcedualAnimationController : NetworkBehaviour
|
||||
if (isLocalPlayer)
|
||||
{
|
||||
walkAnimation();
|
||||
|
||||
handPositioning();
|
||||
CmdAim(Input.GetButton("Aim"));
|
||||
}
|
||||
/*-----Aiming-----*/
|
||||
|
||||
Reference in New Issue
Block a user