My problem is that at low speeds objects do not bounce at all. They loose speed (=0).
I updated to last daily build: 2015.2779 and looked around and found that solution should be to set Box2D engine parameter b2_velocityThreshold which coresponds to “velocityThreshold” in physics.setMKS( key, value )
So i did test with code:
[lua]local physics = require(“physics”)
physics.start()
physics.setGravity(0, 0)
print( physics.getMKS( “velocityThreshold” ) )
physics.setMKS( “velocityThreshold”, 0 )
print( physics.getMKS( “velocityThreshold” ) )
local bottomWall = display.newRect( 100, 200, 300, 10 )
physics.addBody(bottomWall, “static”, {density = 1.0, friction = 0, bounce = 1, isSensor = false})
– create a ball and set it in motion
ball = display.newCircle( 20, 100, 15 )
physics.addBody(ball, “dynamic”, {density = 1.0, friction = 0.0, bounce = 1.0, isSensor = false, radius = 15} )
ball.isBullet = true
ball:setLinearVelocity( 0, 30 )[/lua]
This results in ball “falling” on rectangle and not bouncing.
will not bounce : ball:setLinearVelocity( 0, 30 ), ball:setLinearVelocity( 50, 30 )
will bounce : ball:setLinearVelocity( 0, 31 ), ball:setLinearVelocity( 50, 31 ),
My observations and test show that setMKS is not working as expected. Am i doing some mistake here ?
Thanks in advance