This commit is contained in:
magn9775
2024-04-19 11:31:12 +02:00
parent ffcdd2df66
commit 8f6e3ffa21
3 changed files with 15 additions and 83 deletions

View File

@@ -12,9 +12,15 @@ public class GameUI : MonoBehaviour
public GameObject car;
private float carVel;
public Rigidbody carRB;
public TextMeshPro speedometer;
// Start is called before the first frame update
void Start()
{
if (speedometer == null)
{
speedometer = new TextMeshPro();
}
if (carRB == null)
{
carRB = GetComponent<Rigidbody>();
@@ -25,7 +31,7 @@ public class GameUI : MonoBehaviour
void Update()
{
carVel = (math.abs(carRB.velocity.x) + math.abs(carRB.velocity.y) + math.abs(carRB.velocity.z))*5;
print(carVel);
//print(carVel);
speedometer.SetText(carVel.ToString());
}
}