At the moment I'm improvising a slingshot, the user can click and drag the projectile and let go. The force on the object is calculated by getting the distance between the vector of the slingshots two forks and the vector between where the user pulled it. However this will always result in a positive number and will not take into account the angle of the object relative to that of the slingshot. How can I make it fly out of the slingshot correctly?
float distance = mousePos.dst(pouchPos.x, pouchPos.y, 0); Vector2 d = new Vector2(pouchPos.x - mousePos.x, pouchPos.y - mousePos.y); object.setVelocity(d.nor().x * FIRE_SPEED, d.nor().y * FIRE_SPEED);