Hello 🙂
I have the following code, to "shoot" a body to a specific point (in my case the mouse-cursor):
My problem is, that the body is moving with different velocities, depending on the position of the mouse-cursor. How can I handle a movement with constant speed?
I already tried setLinearVelocity() and applyForce(), but I couldn't figure out, how to move it to a specific point!
Thank you,
nor0x
I have the following code, to "shoot" a body to a specific point (in my case the mouse-cursor):
Code: Select all
function shootTouch(mousePosX, mousePosY)
{
var impulse = Qt.point((mousePosX - image.pos.x) * 3,(mousePosY - image.pos.y) * 3);
collider.body.applyForce(impulse, 0);
}
My problem is, that the body is moving with different velocities, depending on the position of the mouse-cursor. How can I handle a movement with constant speed?
I already tried setLinearVelocity() and applyForce(), but I couldn't figure out, how to move it to a specific point!
Thank you,
nor0x