Hello!
I’ve made an object that moves at constant speed (by setting linear velocity each frame) and have two sensors - one detecting if the object is touching the ground and one for detection of collision with walls. Then I’ve made a level where some squares are in line (they all have the same Y coordinate). The problem is that the object SOMETIMES stops as seen in the screenshot. Is it something I made wrong? Is there any way to prevent that?
This is how I add the dynamic object:
physics.addBody(player, "dynamic", { density = 1.0, friction = 0, bounce = 0}, { shape = {20, 0, 20, 40, -20, 40, -20, 0}, isSensor=true }, { shape = {35, -20, 35, 20, 0, 20, 0, -20}, isSensor=true } ) player.isFixedRotation = true
This is how I add level tiles:
local bodyMaterial = { density = 1.0, friction = 0, bounce = 0 } local obj = display.newRect(x \* 64, y \* 64, 64, 64) physics.addBody(obj, "static", bodyMaterial) camera:add(obj, 1) -- Im using Perspective lib, player object is in the same layer.
Button touch event (began):
player:applyLinearImpulse(0, -120, player.x, player.y)
Thanks in advance.