0 votes

Hope you are doing great. My problem is I cannot get milliseconds from "Timer" as it doesn't run accurately when I set the wait time to 0.01 because of insufficient FPS rate. I also tried "OS.getticksmsec()", it runs the timing well, but this time I have another problem - I cannot reset it every time the car crosses the finish line. I also need resetting every time "ms" reaches 1000 (if > 999) to dial-up "sec" and start from zero.

My question is - are there ways to "restart" OS.getticksmsec(), and if not, how would you implement lap timing? I need 3 digits of "millisecond" value.

Thank you!

in Engine by (327 points)

1 Answer

0 votes
Best answer

You will have to make your own timer class:

in it set the start time and when the lap is over subtract the two numbers, something like this

var start_time

func start():
     start_time = OS.get_ticks_msec ( )

func end():
     return OS.get_ticks_msec ( ) - start_time
by (95 points)
selected by

Thanks, I'll try that!

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.