postCollision reports abnormally large force

It seems that postCollision sometimes reports unusually large force. Here is an example of this behaviour:

It’s a simple physics scene with one dynamic box and static walls. Additionally there are two circles that are just buttons that push the box left or right. My code prints the collision forces to the terminal. When I bounce the box around I normally get values between 0.1 - 1.0. But if I slowly slide the box from the lower right corner to the left and over the step the collision force will sometimes be exactly 12 (when the box slides over the step). That feels insane. I think it happens especially if I accelerate a little just before the step. How such a large force is possible and why the force is exactly 12? Any ideas? Here is a working example code:

[code]
local physics = require “physics”
physics.start()
physics.setGravity( 0, 3 )
physics.setScale( 60 )

box = display.newRect(800,600,80,80)
physics.addBody( box )

button1 = display.newCircle(70,710,40)
button2 = display.newCircle(170,710,40)

floor1 = display.newRect(0,748,1024,20); physics.addBody( floor1, “static” )
floor2 = display.newRect(405,720,600,30); physics.addBody( floor2, “static” )
wallLeft = display.newRect(0,0,20,768); physics.addBody( wallLeft, “static” )
wallRight = display.newRect(1004,0,20,768); physics.addBody( wallRight, “static” )

local button1Active = false
local button2Active = false

local function ForceLeft(event)
if event.phase == “began” then
button1Active = true
end
if event.phase == “ended” then
button1Active = false
end
end

local function ForceRight(event)
if event.phase == “began” then
button2Active = true
end
if event.phase == “ended” then
button2Active = false
end
end

local function ForceHandler()
if button1Active == true then
box:applyForce( -1, 0, box.x, box.y )
end
if button2Active == true then
box:applyForce( 1, 0, box.x, box.y )
end
end

local function PostCollision( event )
if (event.force > 0.1) then
print(event.force)
end
end

button1:addEventListener(“touch”, ForceLeft)
button2:addEventListener(“touch”, ForceRight)
box:addEventListener(“postCollision”, PostCollision)
Runtime:addEventListener( “enterFrame”, ForceHandler)
[/code] [import]uid: 13507 topic_id: 9850 reply_id: 309850[/import]

Could someone test my code and confirm the weird behaviour? Is this a bug or am I missing something? Ansca staff, any ideas? [import]uid: 13507 topic_id: 9850 reply_id: 37795[/import]

Anyone? Please help! This behaviour is really hurting my game. Is there something wrong with my code or is it a bug? Any ideas for a workaround? (How to calculate proper collision/friction force to determine the amount of damage a collision should do?) [import]uid: 13507 topic_id: 9850 reply_id: 38975[/import]

For me when I slide slowly over the ledge, the force is less than 0.1 because it prints nothing. I actually have a hard time even getting it over 1 most of the time even making it go full force. I am testing in the android simulator on windows. [import]uid: 31262 topic_id: 9850 reply_id: 38978[/import]

Yes, it’s difficult to get it over 1.0. And that’s why 12 feels insane. I don’t get 12 everytime I go over the ledge, just sometimes. But it tends to happen if I accelerate a little just before the ledge. Could you try it a few times more? Thank you aaaron for testing this! [import]uid: 13507 topic_id: 9850 reply_id: 39011[/import]

I have a similar problem, after recreating a tower in my game I will get a massive spike in forces about 10 seconds and causing my tower to fall before any character has the chance to act upon it.

Here is my log:

wrl wrl 0.094905853271484  
wrl wrl 0.094905853271484  
wrl wrl 0.053727984428406  
wrl wrl 0.053727984428406  
wrl wrl 0.34201526641846  
wrl wrl 0.34201526641846  
wrl wrm 0.02984893321991  
wrm wrl 0.02984893321991  
wrl wrl 0.018279168754816  
wrl wrl 0.018279168754816  
srl srl 0.043215777724981  
srl srl 0.043215777724981  
wrl wrm 0.00070037692785263  
wrm wrl 0.00070037692785263  
srl srl 0.070140682160854  
srl srl 0.070140682160854  
srl srl 0.033342085778713  
srl srl 0.033342085778713  
wrl srl 7.9850025177002  
wrl PIECE IS INSTA KILL WITH FORCE OF 7.9850025177002  
srl wrl 7.9850025177002  
srl PIECE IS INSTA KILL WITH FORCE OF 7.9850025177002  
wrl srl 0.28090924024582  
srl wrl 0.28090924024582  
wrl srl 0.23386335372925  
srl wrl 0.23386335372925   

Can someone say something about this? [import]uid: 54716 topic_id: 9850 reply_id: 64152[/import]

Hey guys,

Apologies for not seeing this sooner - I tested the code (thanks for providing plug and play) and see what you mean.

Have you filed a bug report? #? [import]uid: 52491 topic_id: 9850 reply_id: 64219[/import]

Initially I thought this was the bug report, but apparently it’s not. I also mentioned this to Carlos, so maybe he did file a real bug report. I’m not sure. Cool avatar peach! [import]uid: 13507 topic_id: 9850 reply_id: 64231[/import]

Where can I check to see if this has been turned into a real bug report? And if it hasn’t how do I make one? [import]uid: 54716 topic_id: 9850 reply_id: 64321[/import]

Submit bug here; http://developer.anscamobile.com/content/bug-submission

See filed bug reports here; http://bugs.anscamobile.com/

Peach :slight_smile:

PS - Thanks re the avatar. [import]uid: 52491 topic_id: 9850 reply_id: 64452[/import]