Jump to content

Shift to 0,0,0 -- Floating Point Fix / Error!


Bill Pomidor

Recommended Posts

Been having a lot of success after having upgraded to the Pro versions of both Gaia and Gena; lots of features and a pretty seamless workflow; it's even (more or less) bug-free (so far) in Unity 2023.1!

My terrain/world has a 4x2 array of 1024x terrain tiles (IOW 4096 x 2048).  Everything had been working fine until I brought a motorcycle into the scene, with cameras controlled via Cinemachine.  At that point, a very frustrating bug popped up.

What happens is that, whenever my motorcycle transits across one of the terrain-tile edges (tiles 3 to 4 in the bottom row), the motorcycle seems to "fall through" the terrain and to reappear at 0,0,0.  I had activated the floating-point fix earlier in the project, back when the terrain was 8192 x 4096 (a size that will probably be needed once we get beyond the alpha).  I had totally forgotten about the floating-point issue, though.

For folks who don't know about the floating-point issue, the problem would intuitively seem to be caused by a glitch in the terrain loader, or maybe a mismatched terrain collider in one of the tiles.  That was my main theory, but there were lots of other theories along the way (I've wasted a couple of weeks on the problem, at least, and delayed a planned demo release, twice).

I finally noticed that the problem did NOT occur when I used Gaia's built-in 3rd-person character setup - which made no sense if it was a terrain-tile/loader problem.

I gradually took apart the motorcycle character/rig -- dropping the animated driver, shifting to the simple main Gaia camera, and finally removing EVERYTHING except the motorcycle's main/parent object (which holds all the anim/physics/control components).  To my astonishment, the problem STILL occurred -- even though the motorcycle had been reduced to a simple mesh with no animations or drivability or cameras; to "drive it" in play mode, I had to gradually drag the "motorcycle" eastward until it reached the junction/edge of the adjacent terrain.  *Even then,* my motorcycle "statue" instantly managed to zap itself back to the 0,0,0 point in the world.

That's when I noticed that the motorcycle still had the "floating point fix" component aboard and active.  When I deactivated the FPF component, everything worked perfectly (even with an actual motorized, drivable motorcycle!).

I'm describing this in detail for a couple of reasons.  Mostly, I'm hoping to save another solo developer like me from wasting days or weeks trying to solve a terrain-loader problem that doesn't exist!

I'm also describing this in the hope that the next Gaia/Gena updates will include an optional (checkbox-activated) debug warning that posts a message to the Console whenever the floating-point fix sends an object/player/vehicle back to the zero point.   Despite having deep debugging turned on, detailed logging, etc., the floating-point-fix never sent any kind of warning/alert to the Console to announce that it was responsible for my player's instant transfer from an island road to the middle of the bay.  I've added a couple of lines of my own to the script to send the warning, but of course those will be overwritten next time I update Gaia. 

Like I said, I really need to double or even quadruple the map size for the game to play the way it should -- but I'll wait until I have a better handle on the floating point issue..  Speaking of which, there's an excellent/recent article that explains the problem and why the FPF is needed:

 

Link to comment
Share on other sites

Thank you for the feedback and information that you provided. 
Please note that it's normal that the floating point fix resets the player to 0,0,0. 
You may need to investigate why the character controller is making it fall through the floor. 
However, from the Floating Point Fix, this is what is supposed to happen. 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Tell a friend

    Love Canopy - Procedural Worlds? Tell a friend!
  • Need help?

    We work with some of the biggest brands in global gaming, automotive, technology, and government to create environments, games, simulations, and product launches for desktop, mobile, and VR.

    Our unique expertise and technology enable us to deliver solutions that look and run better at a fraction of the time and cost of a typical project.

    Check out some of our non-NDA work in the Gallery, and then Contact Us to accelerate your next project!

×
×
  • Create New...