Skip to content

Commit

Permalink
left right left right left etc etc ice skating controlls
Browse files Browse the repository at this point in the history
  • Loading branch information
bozmir committed Dec 18, 2024
1 parent d6f7249 commit 89b6641
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions Assets/Scripts/KerstSpecial/RaceController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public class RaceController : MonoBehaviour
private float camLerpSpeed = 3f;
private float camFollowSpeed = 3f;
private float camYawDelta = 0;
private float rotationSpeed = 60f;
public float rotationSpeed = 60f;
public float playerSpeed = 10f;
private float slipFactor = 0.99f;
public float jumpForce = 10;
Expand Down Expand Up @@ -157,6 +157,7 @@ private void FixedUpdate()
}
}


private void Update()
{
CheckNextCoordinate();
Expand Down Expand Up @@ -190,12 +191,13 @@ private void Update()

if(isReadyForStart)
{
camYawDelta = Mathf.Lerp(camYawDelta, rotationDelta, Time.deltaTime * rotationSpeed);
if (Mathf.Abs(camYawDelta) > 0.02f)
{
{
freeCam.transform.RotateAround(player.transform.position, Vector3.up, camYawDelta);
freeCam.transform.LookAt(player.transform);
}
camYawDelta *= 0.5f;
rotationDelta *= 0.5f;

float distToCam = Vector3.Distance(player.transform.position, freeCam.transform.position);
float factor = Mathf.Max(0, distToCam - playerDistToCamera) / playerDistToCamera;
Expand Down Expand Up @@ -252,14 +254,16 @@ private Quaternion GetCameraStartRotation()
return freeCamRotation;
}

private float rotationDelta = 0;
public void MoveHorizontally(float amount)
{
camYawDelta += amount * Time.deltaTime * rotationSpeed;
rotationDelta -= amount * Time.deltaTime * rotationSpeed;
playerMoveVector += Vector3.forward * playerSpeed * Mathf.Clamp01(amount);
}

public void MoveForwardBackwards(float amount)
{
playerMoveVector += Vector3.forward * playerSpeed * Mathf.Clamp01(amount);
//playerMoveVector += Vector3.forward * playerSpeed * Mathf.Clamp01(amount);
}

public void MoveUpDown(float amount)
Expand Down

0 comments on commit 89b6641

Please sign in to comment.