- Home /
How Accurate is Unity Physics?
I've heard a lot that floating point calculations aren't extremely precise, and Unity's transforms and physics uses floats. How accurate then, can Unity's physics be? On a small scale world where positions go up to only 3 digits and physics are run at .1 timestep, can it be accurate enough for a deterministic game? I ask this because I need determinism for a lockstep game that can span up to 1 hour lengths.
Answer by jpthek9 · May 09, 2015 at 12:28 AM
After tinkering around for a while, I managed to create a deterministic physics engine. Check out the thread here: http://redd.it/358hl6 if you're interested.
Answer by Eric5h5 · Jan 14, 2015 at 12:20 AM
The physics aren't deterministic, and can have different results when the same scene is run multiple times.
Yes, but how deter$$anonymous$$istic can it get? I'd think that physics on a large universe would be considerably less deter$$anonymous$$istic. Also, I'm thinking of rounding the results of the physics outputs (I need to interpolate between .1 timesteps anyways) to maybe the first decimal place. From personal experience, do you think something like that could work?
I don't think it will work because the built-in physics is inherently not deter$$anonymous$$istic, and that's not something that can be bolted on afterward; it needs to be designed in from the beginning if you want any guarantees.
Oh, thanks. I'll find some kind of other solution. Thanks :)
I'd like to open up this question again to ask one more related question: Is collision detection decently accurate? I understand how physics inaccuracies can pile up but can I simply map my own movement calculations to the rigidbodies and calculate interactions with OnCollisionEnter? Also, will using 2d physics help with this task?