An object passes through another at zero speed

Hello, I need help. I created a ball and a platform, assigned a static body type for the platform, and a dynamic one for the ball. When the ball has any speed and crashes into the platform, it does not pass through it, but if the ball falls on the platform and gradually starts to stop, then if you move the platform, it will pass through it. At the same time, this does not happen at the moment when the ball is in motion with absolutely any speed not equal to zero. In the picture I showed how the ball passes through the platform. In this case, I have enabled the display of physical bodies. I don’t understand how to fix this problem. I would be very grateful if anyone can help me!

I will add, I tried to put the bullet body type, but it didn’t help either. It doesn’t work without this type either.

local widget = require("widget")
local physics = require("physics")
physics.setDrawMode( "hybrid" )
local object = display.newRect(display.contentCenterX, display.contentCenterY, 100, 10)
object:setFillColor(0.02, 1, 0)
object.alpha = 0.9
local ball = display.newCircle(display.contentCenterX, display.contentCenterY / 5, 20)
ball:setFillColor(1, 0, 0)

physics.addBody( object, { density=1.0, friction=0.3, bounce=0.1 } )
physics.addBody( ball, { radius=20, density=1.0, friction=0.3, bounce=0.7 } )
object.bodyType = "static"
ball.bodyType = "dynamic"
ball.isBullet = true
object.isBullet = true
local slider

-- функция обработчика для слайдера
local function sliderListener(event)
    print("Slider at " .. event.value .. "%")
    object.rotation = event.value
    slider.rotation = object.rotation
    slider.x = object.x
    slider.y = object.y

slider = widget.newSlider(
        x = object.x + object.width / 5,
        y = display.contentCenterY,
        width = object.width / 2,
        value = 0,
        listener = sliderListener
![bandicam 2023-11-17 00-34-56-930|video](upload://bBlBVTCInEeTVeNTWLYI0NjXSqn.mp4)


You would probably want to make the object type kinematic as opposed to static and then move the object with physics using velocity as this will register the collision. moving the object with translating the x, y, r does not play nice with the physics system.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.