Quantcast
Channel: Question and Answer » libgdx
Viewing all articles
Browse latest Browse all 434

How to convert velocity (Vector) to m/s (Scalar)

$
0
0

I have a variable called velocity which I get from a dynamic body in Box2D. It is the velocity of a pirate ship and when I add torque to the ship I want that to be proportional to the speed (m/s – 10px = 1m). My problem is that I can’t divide/multiply a float (proportionalTorque) by the Vector2 quantity of the velocity so what I need is a way of getting the speed (m/s) from the velocity or if there’s any other way of multiplying a float by a vector that’d be useful too.


Viewing all articles
Browse latest Browse all 434

Trending Articles