However, that can be buggy: If the player tumbles a full rotation or more, the self-uprighting will try to flip it all the way back over again, rather than just upright. How can I fix this?
Last edited by Taehl on Sat Jan 16, 2010 12:04 pm, edited 1 time in total.
Earliest Love2D supporter who can't Love anymore. Let me disable pixel shaders if I don't use them, dammit! Lenovo Thinkpad X60 Tablet, built like a tank. But not fancy enough for Love2D 0.10.0+.
local angle, avelocity, damp = player.b:getAngle(), player.b:getAngularVelocity(), 1.7
local n = (angle + math.pi) % (2 * math.pi) - math.pi
player.b:setAngularVelocity( avelocity + (-n * damp)
Is there anyone here familiar enough with radians to double-check that for me? It appears to work, but I'd like to be sure.
Earliest Love2D supporter who can't Love anymore. Let me disable pixel shaders if I don't use them, dammit! Lenovo Thinkpad X60 Tablet, built like a tank. But not fancy enough for Love2D 0.10.0+.