I am trying to develop a rail grind mechanic using splines and having the player move along the spline. How can I make my player move along the spline at the point of contact?
{
t += Time.deltaTime * speed;
railGrindSparks.gameObject.SetActive(true);
playerMovement.getRigidBody2D().gravityScale = 0f;
var splinePosition = splinePath.EvaluatePosition(t);
var newPosition = new Vector3(splinePosition.x, splinePosition.y + offsetY, splinePosition.z);
transform.position = newPosition;
}
else {
DetatchFromRail();
}```