Hi all,
I’m having an issue with a repeated transition on one object, effecting the getLinearVelocity on another.
I’m using applyforce and linearDamping on an object (let’s call it object1) which I then use the following code with:
local vx, vy = object1:getLinearVelocity()
if vx == 0 and vy == 0 then
print (“Object1 has stopped”)
end
This works fine and I find that once the object stops moving, it will print “Object1 has stopped” to the console.
However, on a another separate object I’m using the following code to animate it.
local function Animation()
local part2 = function()
transition.to( object2, { time=1000, x=280, onComplete=Animation } )
end
transition.to( object2, { time=1000, x=230, onComplete=part2 } )
end
__
Animation()
end
I’m finding that when running the animation code, the objects1 linear velocity starts at 0 when the applyforce is applied. However, when I don’t run animation, object1’s linear velocity starts with a number based off the applyforce (i.e greater than 0) and then once it has stopped due to linearDamping, it will run the top code and print (“Object1 has stopped”).
Does anyone have any inclination as to what might be causing this?
It’s melting my brain so any help would be greatly appreciated.