One more silly problem: I’m degrading my velocities like this:
if (input.isKeyDown(Input.KEY_UP)) {
player.setXV(player.getXVelocity() +
Math.cos(Math.toRadians(player.getRotation())));
player.setYV(player.getYVelocity() +
Math.sin(Math.toRadians(player.getRotation())));
} else {
player.setXV(player.getXVelocity()*0.95);
player.setYV(player.getYVelocity()*0.95);
}
However, when I’ve just moved and my vehicle has gotton to the point of stopping, I see this is my terminal:
XVelocity: 1.8496787833130738E-16 YVelocity: 1.5520647848744412E-16
XVelocity: 1.75719484414742E-16 YVelocity: 1.474461545630719E-16
XVelocity: 1.6693351019400487E-16 YVelocity: 1.400738468349183E-16
XVelocity: 1.5858683468430463E-16 YVelocity: 1.3307015449317238E-16
XVelocity: 1.506574929500894E-16 YVelocity: 1.2641664676851377E-16
XVelocity: 1.4312461830258492E-16 YVelocity: 1.2009581443008806E-16
XVelocity: 1.3596838738745567E-16 YVelocity: 1.1409102370858365E-16
XVelocity: 1.291699680180829E-16 YVelocity: 1.0838647252315446E-16
XVelocity: 1.2271146961717873E-16 YVelocity: 1.0296714889699673E-16
XVelocity: 1.1657589613631978E-16 YVelocity: 9.781879145214689E-17
I’m also experiencing some “pulls” in the vehicle when it’s slowing down. For example, when moving diagonally down/left, it would suddenly drag the vehicle a lot more to the left than it would under normal physics. I think these two are related.
In my head multiplying something by 0.95 seems perfectly fine for degrading something slowly. Although it’s never hit zore fully… Meh…
Anyone got any other options on degrading, that doesn’t spawn weird bugs?
Thanks