I am still very new to odin, as in installed it yesterday, and i am rewriting code that worked in c++
it just seems werid that the velocity is reporting back as nonzero, despite the lack of movement, I could just be creating the fuctions wrong, I had already done the update fuction as a pass by reference and was experiencing the same problem
#Weird math stuff(solved)
1 messages · Page 1 of 1 (latest)
visually what is going on here
there is also a period where the difference in position exceeds velocity
Object starts at the center
Sorry, need for coffee
You check the collision every frame, right?
In if block, put na.pos a bit further from the edge
Like max_x - a.rad - 0.5 or smth
i had done max_x - a.rad - 2
still gets stuck
Again its not repeadedly going into that if block, because if it did, it would be printing out right edge every frame
it also doesn't get stuck if the x component of the velocity is set to 1
and if i set velocity of x to 0.49 it gets stuck before the edge
Because it rounds to 0
when i set v to 0.51 again no problems
It doesn't get stuck at all?
Does it get stuck at the edge when it's 0.51?
nope
There is also a region of the screen where the distance gained it double expected
f32 doesn't have the bug
I guess It fell into a werid pocket of the f16 data range
Try using math.round() function
I mean it fits with some of the other behavior where the gained position was double of expect, during the floating point addition operation, it just shifted out the additional bits
na.pos += math.round(na.vel)
Weird math stuff (Solved)
Weird math stuff