-
-
Notifications
You must be signed in to change notification settings - Fork 121
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The mechanical world stops updating after 524,288 seconds when using f32
precision
#252
Comments
It might make sense to convert the time related values to use |
Hi! What exactly do you mean by "the mechanical world stops ticking correctly"? What behavior are you observing and what is your setup? While nphysics does maintain the total elapsed time in the |
Ok so I am using let start = time::Instant::now();
...
while mechanical_world.integration_parameters.t < start.elapsed().as_secs_f32() {
let real_elapsed = start.elapsed().as_secs_f32();
let sim_elapsed = mechanical_world.integration_parameters.t;
if real_elapsed - sim_elapsed > 0.5 {
warn!("Jerk to catch up - real: {:?}, sim: {}", real_elapsed, sim_elapsed );
}
mechanical_world.tick(...);
} So when |
Oh, I see. In that case we should change |
I can make a PR. pub struct Duration {
secs: u64,
nanos: u32, // Always 0 <= nanos < NANOS_PER_SEC
} Is this good enough or should it just be changed to an |
Mmh, it is right that nphysics is free of units. I also think that using So after some thought I think it is best to simply deprecate Edit: I've seen the discord conversation just now. It appears the removal of t has been suggested by other contributors too. |
I have created a simulator based on nphysics and I've noticed that after 6 days the mechanical world stops ticking correctly. This seems to be a floating point precision issue regarding the parameters
t
anddt
. Using the defaultdt = 1.0/60.0
then the simulator stops at exactly 524,288 seconds.While it would be possible to change the simulator to run on
f64
values, nothing apart from the time requires that precision.The text was updated successfully, but these errors were encountered: