Hi Everybody,
in my ground distance calculator I do a simple while loop where I calculate the distance from my last known position to my actual position with <vector1> <function> <vector2> where <function> is set to "dist". In general this works fine, but after serveral thousands of kilometers it gives back a verctor like (1,1.012,0) instead of a distance in meters. I couldn't figure out why this happens. Sometimes it looks like it has something to do with tabbing out of the game and back in.
So my idea was now, just skip the calculation, when the result is something else than a float value. But i there any function in vizzy, which can get the data type?
@YaMomzBox420 you are very close to what I do. As program it is like:
traveleddistance=0
lastposition=positionnow
while(true){
traveleddistance=traveleddistance + format{0:f3}(lastpostion - positionnow)
lastposition=positionnow
}
I didn't use round, as the craft always wobbles a little. So I used format{0:n3} to cut the number. But format{0:n3} adds a thousands separator. My new version with format{0:f3} doesn't add a thousands separator and works fine.
The unexpected problem comes up, when you add two numbers, one without and one with a thousands separator. This results in a vector. For example you do 1200.5 + 1,200.5 = 2401.0 ... I would be fine with 2,401 or 2,401.0 or 2401 or 2401.0 but instead it results in vector(1, 200.5, 0) ... so it is not even a number anymore.