Hi everyone!
I’m working on an accelerometer controlled game where the player controls the gravity to move an object around.
How a left & right controllable environment works:
[lua]
local function onAccelerate( event )
if event.yGravity > 0.1 then
physics.setGravity(-15, 10)
else if event.yGravity < -0.1 then
physics.setGravity(15, 10)
else
physics.setGravity (0, 10)
end
end
end
[/lua]
Pretty simple, now what happens is that the object decelerates before changing direction, which is logical as we’re talking about physics. But my question is: would it be possible to make the shift of direction instant? I’m thinking some sort of temporary directional velocity added to the object in question, but would need a helping hand here.
Thanks in advance [import]uid: 56195 topic_id: 37607 reply_id: 67607[/import]