I want 64 bit vectors because 32 bit floating points don’t have enough precision to make accurate physical systems. While programming a lot of times I find myself needing to divide the end calculation by some magic number like 1.1 because after so many calculations, the precision is so lost that it ends up adding energy to the physical system in some cases leading to unstable numbers and infinite numbers which could’ve been easily avoided with something like Vector3float64
.
I know this is pretty much against Roblox’ policy for keeping simple a API that 13 year olds can understand easily. But Roblox also needs to realize that the “grownups” whom create the majority of the games can deal with complicated APIs.
For example I had to do:
EngineCF.UpVector * ((math.sign(BackForce:Dot(EngineCF.RightVector)))*BackForce.magnitude*CarDistToBackTireFromCOM/1.3)
instead of:
BackForce:Cross(EngineCF.LookVector*CarDistToBackTireFromCOM)/1.8
to keep a bit more precision in some edge cases. Constantly thinking about the implications of using 32 bit numbers is tiresome and annoying. Identifying when this is an issue is even harder.
Before anyone argues that 32 bit is enough, it is NOT. There are some solutions to the problem but both of them are not as good as just adding this library: Creating a Vector3 library in pure Lua is quite inefficient. Typing out every x,y,z variable and doing the calculations that way is very cumbersome.
Edit because people wanted more examples:
While creating my 2D physics engine, 32 bits were not enough because I couldn’t get rigid bodies to come to a rest efficiently, they would randomly add or lose energy from collisions. I had to read tens of physics sim articles and hundreds of forum posts to find an efficient solution. I could not find an efficient solution and decided to use individual numbers while calculating instead.
In my custom particle engine, sinking through objects effect is way more pronounced than it should’ve been due to 32 bit .
In a game that calculates the lift force on individual wings/propellers, the small mistakes that floating point rounding made used to add up and destabilise the vehicle. This was because a small perturbation in the velocity would add even more perturbations since the forces acting on the object scaled exponentially. The solution was to average it in a couple frames, clamp the values and add magic numbers to divide the last equations so that the system overall would lose energy that it would’ve gained.
Calculations with objects that are far away from the center just becomes so bad that making large worlds also becomes cumbersome. The more you let the engine handle the calculations, the more you lose the control over the behaviour of the objects.
When constantly changing a position relative to another position, unless you store the initial state, they start to drift apart from each other.