Helllo, I was trying to work with the friction properties of some static objects and came across some weird behavior. I swear I’ve used this property before without issues so I’m not sure if I am breaking a rule somewhere or if it’s something that needs to be reported as a bug.
In my real app the friction property doesn’t seem to have any effect at all, even if i jack it up to 10000. In my test app below the friction actually makes the object move faster instead of the friction causing the object to slow down.
The test app just has two static objects acting as a ground and two dynamic balls. One of the grounds has a friction of .9 while the other has it set to 0. I then apply a small, single impulse to both balls. You would expect the ground with friction would slow down or even stop the ball. Instead the ball is significantly faster.
You can copy the code below into a main.lua to see it
[lua]
local physics = require(“physics”)
physics.start();
–make ground with 0 friction, it is the grey one on the top
local groundNoFriction = display.newRect( 0, 100, 320, 25)
groundNoFriction:setFillColor(140, 140, 140)
–leave friction at 0
physics.addBody(groundNoFriction, {density=21, friction=0.0, bounce = 0.1})
groundNoFriction.bodyType = “static”
–make ground with friction. it is the pink on the bottom
local groundFriction = display.newRect( 0, 300, 320, 25)
groundFriction:setFillColor(240, 140, 140)
–set friction to some value
physics.addBody(groundFriction, {density=21, friction=0.9, bounce = 0.1})
groundFriction.bodyType=“static”
local ball1 = display.newCircle(0, 50, 20)
ball1:setFillColor(0, 255, 255)
physics.addBody(ball1, {density=1, friction=0.3, bounce = 0.1, radius=20 })
local ball2 = display.newCircle(0, 250, 20)
ball2:setFillColor(255, 0, 255)
physics.addBody(ball2, {density=1, friction=0.3, bounce = 0.1, radius=20 })
ball1:applyLinearImpulse(1, 0)
ball2:applyLinearImpulse(1,0)
[/lua]