void HillUpdate() { hill.speed *= 1.01f; hillPoint += hill.speed; if (hillPoint > 1) { rb2D.isKinematic = false; rb2D.velocity = hill.endForce; hill = null; } else { Vector2 P0 = hill.GetPoint(hillPoint), P1 = hill.GetPoint(hillPoint + 0.01f), P2 = P1 - P0; transform.rotation = Quaternion.Euler(0, 0, -Mathf.Atan2(P2.x, P2.y) * (180.0f / Mathf.PI)); transform.position = P0; } }