Why collision event begin is late?

Why the collision began event is late.

local physics = require( "physics" ) physics.start() physics.setGravity( 0, 0 ) physics.setDrawMode( "debug" ) local staticLine = display.newLine( 0, 100, 1000, 100 ) staticLine.strokeWidth = 1 physics.addBody( staticLine, "static", {isSensor = true}) local ball = display.newCircle( 40, 300, 20 ) physics.addBody( ball, {radius = 20, isSensor = true} ) ball:setLinearVelocity( 300, -300 ) ball:addEventListener( "collision", function(event) if (event.phase == "began") then physics.pause( ) end end ) 

physics pauses when at position  1.png

But I want to pause it at position  2.png

How can I solve it?

Thanks!

You might be better off removing the velocity from the ball when the collision happens, rather than pausing physics completely. Also, certain physics APIs need to be set via a timer, because the “game world” is essentially locked when physics calculations are taking place. See the below thread for more information

https://forums.coronalabs.com/topic/52605-strange-behaviour-when-changing-velocity/

You might be better off removing the velocity from the ball when the collision happens, rather than pausing physics completely. Also, certain physics APIs need to be set via a timer, because the “game world” is essentially locked when physics calculations are taking place. See the below thread for more information

https://forums.coronalabs.com/topic/52605-strange-behaviour-when-changing-velocity/