After a collision between several circle bodies I notice that their X and Y position coordinates are still been updated and could be causing my p5.js image() sprite to appear blurred, as it is still moving.
ball.js:21 x: 479.428463622992 y: 267.41821547997995
ball.js:21 x: 479.4284636229892 y: 267.4182154799828
ball.js:21 x: 479.42846362298644 y: 267.41821547998563
ball.js:21 x: 479.42846362298366 y: 267.4182154799885
ball.js:21 x: 479.42846362298087 y: 267.4182154799913
ball.js:21 x: 479.4284636229781 y: 267.41821547999416
Now I could be barking up the wrong tree here and it could be to do with another issue entirely. Is there a way to just stop the speed and velocity (they are read only) manually once below a certain threshold?
After logging the speed of the bodies after a few minutes of rest, they still have speed values between 1 and 5. Although they do 'appear' static. Why is it not going down to 0?
I will keep trying to fix the issue in the mean time and create a test case.
Thanks.
Just to confirm, there will always be small fluctuations in position even at rest. So in this case it might be best to Math.round the position to avoid the blurring (maybe only when body.speed is very low otherwise motion might not be very smooth).
Hey, I'm having the same issue right now and I was thinking of just rounding the position and checking it against the previous rounded position. Still I was really curios to know why does the library use 14 decimals for position and velocity? It really seems like overkill, especially on today's high DPI devices.
Internally the engine uses the full precision available, there's no benefit in using any less! As far as rendering goes, it's up to you to decide how you handle representing this on screen, whether it be sub-pixel interpolation or rounding.