Player is origin 0,0,0

I've been having a problem with Floating point inaccuracy, where as the player moves beyond the world 0,0,0, by to much he starts to shake. I've come across a youtube video where the uploader mentions that he has fixed the floating point issue by making the world refrence the player as 0,0,0.

"FP-precision fix is implemented by translating every physics object in the scene such that the player becomes the origin (0,0,0)"

I know you can override some rigidbodies physics properties in script by.

function Awake()

gravity = 0;

rigidbody.mass = somenumber;

rigidbody.drag = somenumber;

so the rigidbody.drag and .mass are script over rides. Is there a physics.origin over ride?


function FixedUpdate()

physics.origin = transform.Translate(player)

Is there some documentation on doing this?

The phenomena is known as "Spatial Jitter" here is a paper explaining the problem and possible solutions:

In short:

change [the] system from moving [the] person through the solar system to moving the solar system around the person

I figured I would be encountering this problem sooner or later on my current project so I wrote some code. This script detects when the camera is further than 'threshold' units from the origin and moves everything so that the camera is back at the origin. I also set the physics to disable beyond a certain threshold as well. That part of the code is quite crude, I'm not sure if there is a better way to disable physics. When testing I discovered the particles weren't getting moved so I had to do them separately. Hopefully this is useful.

Please let me know if it can be improved.

Not the solution you're looking for, but depending on your needs it might be easier: Have you considered just scaling everything down? Probably by a factor of 10 or 100. Unity generally works best if you assume 1 unity unit = 1 meter, so if your character is a lot larger than that you might run into level FP issues sooner than if he was smaller.