- Home /
Duplicate Question
Calculating Velocity
So, before you say it, I know the equation, velocity = distance * time, my problem is that I don't know how to take those two float values, and turn them into a vector that I can use. To be specific, I am trying to work out the "Calculate new velocity" part of the diagram on this https://gamedevelopment.tutsplus.com/tutorials/swinging-physics-for-player-movement-as-seen-in-spider-man-2-and-energy-hook--gamedev-8782 page
Equation you wrote is for the speed. And it's a scalar entity. Speed = distance * time.
If you want to find a velocity (Which is a vector entity) you need to multiply time with the displacement. And you can do it by
velocity = transform.position * time; // from the Origin
or
velocity = (transform.position - referencePoint) * time;