- Home /
How to fix wobbling float when away from spawn?
I am currently working on my own airplane game. I have the problem that if I fly for about 3 minutes, or have flown a certain distance from spawn, everything starts to wobble. unfortunately there are no tutorials that help me or that have the problem. here are the pictures for demonstration
Video:
https://drive.google.com/file/d/1HUWrG33bHph8A5gnmoFZoF9miJXseBh1/view?usp=sharing
Answer by Captain_Pineapple · Nov 25, 2021 at 06:42 PM
You wont like this answer but in general it boils down to: "You simply don't go that far"
Why is that? Because Unity uses float precision to handle positions. If you want to know why that happens what you see you should learn how floats work. The short version is: The larger your number the less space your variable has to calculate precise decimals. So the best thing in your case would be to either scale everything down by a factor of 10 so that everything is basically closer to the origin.
OR: (and that is probably the better and proper solution) Change your frame of reference. Instead of moving your plane, move the world. This way you always stay close to the origin and can (in theory) have an infinitly large world.
So, basicly... you can't do anything. I can't scale this down, because it's already small and if I make it smaller, physics are very weired. But how are other flight sim doing this?
I already wrote this issue, and someone came up with this: but I don't understand how to use it. https://answers.unity.com/questions/1864691/camera-starts-shaking-after-2-$$anonymous$$-of-gameplay.html?childToView=1866009#comment-1866009
Well this is exactly what i meant by "change your frame of reference". Just place the plane at Vector3(0,height,0)
and move every other object by Vector3(-xspeed, 0, -zspeed)
Your answer
Follow this Question
Related Questions
Float sets itself to zero 1 Answer
Multiple Cars not working 1 Answer
How do I stop the player from gliding while in the air? 1 Answer
Distribute terrain in zones 3 Answers
Float bug... no errors. 1 Answer