animate front hand with curve

This commit is contained in:
DPS2004
2022-08-18 14:23:33 -04:00
parent bf77deb6ac
commit 30ad89c32a
2 changed files with 179 additions and 2 deletions

View File

@ -53,14 +53,29 @@ namespace HeavenStudio.Games
Tween bgColorTween;
Tween fgColorTween;
[Header("References")]
public GameObject frontHand;
[Header("Animators")]
public Animator handAnimator;
[Header("Curves")]
public BezierCurve3D handCurve;
public PlayerActionEvent cowbell;
public int driverState;
public float handStart;
public float handProgress;
private void Awake()
{
instance = this;
@ -70,16 +85,26 @@ namespace HeavenStudio.Games
private void Start()
{
driverState = 0;
handStart = -1f;
cowbell = null;
}
private void Update()
{
if (PlayerInput.Pressed() && !IsExpectingInputNow())
if (PlayerInput.Pressed()) //&& !IsExpectingInputNow())
{
HitCowbell();
handStart = Conductor.instance.songPositionInBeats;
}
//update hand position
handProgress = Math.Min(Conductor.instance.songPositionInBeats - handStart, 1);
frontHand.transform.position = handCurve.GetPoint(handProgress);
}
private void LateUpdate()