feat: Samyaza player controls

This commit is contained in:
Alexandre Coirier
2026-05-27 00:28:20 +02:00
parent ed0aadb6c6
commit ae1f5b3ae2
5 changed files with 329 additions and 101 deletions
@@ -30,6 +30,7 @@ namespace OctoCore.Components
[Range(.1f, 3)] public float LookAtSmooth = 1;
[Range(0, 1)] public float LookAtPoint = .5f;
public AnimationCurve DriveCurve = AnimationCurve.EaseInOut(0, 0, 1 , 1);
public AnimationCurve LookCurve = AnimationCurve.EaseInOut(0, 0, 1 , 1);
}
[System.Serializable]
@@ -109,7 +110,7 @@ namespace OctoCore.Components
public void ApplyMoveInfluence(Vector3 inMove, float delta, out Vector3 outMove)
{
if (!OctoPlayer.Instance || !OctoPlayer.Instance._FirstPerson.Camera)
if (!OctoPlayer.Instance || !OctoPlayer.Instance._FirstPerson.Camera || !_references.Target)
{
outMove = inMove;
return;
@@ -140,7 +141,7 @@ namespace OctoCore.Components
public void ApplyLookInfluence(float inYaw, float inPitch, float deltaTime, out float outYaw, out float outPitch)
{
if (!OctoPlayer.Instance || !OctoPlayer.Instance._FirstPerson.Camera)
if (!OctoPlayer.Instance || !OctoPlayer.Instance._FirstPerson.Camera || !_references.LookAt)
{
outYaw = inYaw;
outPitch = inPitch;
@@ -158,7 +159,7 @@ namespace OctoCore.Components
float lookAtPitch = Mathf.Asin(-lookAt.y) * Mathf.Rad2Deg;
_state.LookInfluence = Mathf.InverseLerp(_settings.LookAtPoint, 1, _state.MoveInfluence) * _settings.LookAtStrength;
float lookInfluence = _settings.DriveCurve.Evaluate(_state.LookInfluence);
float lookInfluence = _settings.LookCurve.Evaluate(_state.LookInfluence);
float t = deltaTime * _settings.LookAtSmooth;
_state.YawRange = Mathf.Lerp(_state.YawRange, Mathf.Lerp(180, 0, lookInfluence), t);