Please help request!

As the title says, i need a object having a constant speed in the X axis!
I leave an attachment example.
Constant speed cube would have to be 480, but no.
I hope you help me!

Code: Select all
love.update(dt)
object.x = object.x + distancePerSecond * dt
object.y = 500
end
try your code, this is the result.Beelz wrote:Not getting into collisions... This will move you along at a constant rate:Code: Select all
love.update(dt) object.x = object.x + distancePerSecond * dt object.y = 500 end
it can be improved? Thanks!
Code: Select all
love.update(dt)
local lvx, lvy = object:getLinearVelocity()
object:setLinearVelocity(10, lvy)
end
Thanks, but I want to respect collisions!ivan wrote:If you don't want your body to respond to collisions but move at a constant rate you can make it a "kinematic" body and set its velocity.
Kinematic bodies push other objects but do not respond to collisions themselves.
it can be improved? Thanks!Code: Select all
love.update(dt) local lvx, lvy = object:getLinearVelocity() object:setLinearVelocity(10, lvy) end
Not really, he just needs to do a few things every frame:Doctory wrote:switch from the love.physics, it is impossible to get a constant velocity in love.physics without screwing something up
Code: Select all
print( type(love) )
if false then
baby:hurt(me)
end
1.you set the linear velocityZ_ReC wrote:This respects the collision, but no speed!![]()
Users browsing this forum: No registered users and 6 guests