I want my physics object to move to target at exact direction. However, when I use applyForce() or applyLinearImpulse() it only moves nearly right my target direction.
I find that it move exactly when I set object density = 0.0, however if I do so there will be no rotation.
local strength =0.5local xVect =(targetX - objX)*strength
local yVect =(targetY - objY)*strength
obj.body:applyForce(xVect, yVect, targetX, targetY)
It didn't work, I don't make game like billiard pool. I want to throw an object in exact direction like shooting a bullet, and it can drop because of gravity.
Comments
Ultimate Games on Appstore
Ultimate Games on Google Play
Or have an enterFrame that keep giving Force to the object?
local vx,vy = x:getLinearVelocity()
if vx < 10 then
--- apply force
end