As my bodies are colliding fine, I move the window by dragging the title bar, This seems to pause the graphics rendering, But upon stopping the drag, The physics seem to display awkward behaviour as if it had continued simulating the physics whilst i was dragging, but it had failed to do collisions as such.
I would like to elaborate more but i was hoping maybe somebody had already experienced this before and could maybe post a solution because i couldnt find anything via search
Thanks much
Physics Pause Simulation
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
- athanazio
- Citizen
- Posts: 96
- Joined: Fri Apr 10, 2009 3:12 am
- Location: Rio de Janeiro - Brazil
- Contact:
Re: Physics Pause Simulation
I had the same problem,
and for any reason it seems that the position of the physical objects are related to the screen itself instead of related to the current window, When I was doing my water simulation I saw that behavior like shaking the objects around when dragging the window
EDIT
try to run this sample and shake the window ...
http://love2d.org/forum/viewtopic.php?f=5&t=686
the balls will get crazy !!
and for any reason it seems that the position of the physical objects are related to the screen itself instead of related to the current window, When I was doing my water simulation I saw that behavior like shaking the objects around when dragging the window
EDIT
try to run this sample and shake the window ...
http://love2d.org/forum/viewtopic.php?f=5&t=686
the balls will get crazy !!
Nothing is simple but everything is possible.
Re: Physics Pause Simulation
When you drag the window, everything stops except the timer. When you release the window, a lot of time may have passed since last frame, and so the timestep supplied to World:update(dt) is possible huge.
I remember looking into this some years ago, and I think I found out that SDL has no way of detecting when windows are being moved (but please prove me wrong). The only solution available now is to not drag the window and/or use love.system.grabInput(true) to restrict the mouse to the window area.
Haha, I certainly hope that is not the case.athanazio wrote:the physical objects are related to the screen itself
I remember looking into this some years ago, and I think I found out that SDL has no way of detecting when windows are being moved (but please prove me wrong). The only solution available now is to not drag the window and/or use love.system.grabInput(true) to restrict the mouse to the window area.
- bartbes
- Sex machine
- Posts: 4946
- Joined: Fri Aug 29, 2008 10:35 am
- Location: The Netherlands
- Contact:
Re: Physics Pause Simulation
The following lua code could be used (and possibly included in LÖVE, in lua or C):
@rude: I did find a page where they said 'video expose' events are sent during dragging (and after) and (of course) active events (because mouse leaves and enters) surrounding those. Here it is
Code: Select all
maxdt = 1 --1 second, maybe, experiment with this
function update(dt)
while dt > 0 then
local tempdt = dt --you should rename this to something more useful, but for the sake of examples
if tempdt > maxdt then tempdt = maxdt end
--do your update stuff with tempdt instead of dt
end
end
Who is online
Users browsing this forum: Bing [Bot], Google [Bot] and 3 guests