Why use a vector to represent speed in a game?

Speed ​​= length / time

So why is the vector (x, y, z) used to represent it?

0


a source to share


5 answers


Because speed is not length / time. This is the first derivative of the position. Position is a vector, so its derivatives are vectors as well.



+13


a source


Technically speaking, length divided by time gives you speed, not speed. Speed ​​does not tell you which direction you are traveling, while speed does. In 3D space, to describe where you are going and how fast, you need to specify three values: the direction and the speed you are in, in each of three main directions (commonly called axes and called x, y, and z). But you can refer to them as forward / backward, sideways and up / down if you like. For example, if you are traveling at 5 km / h upwards, the vector might be (0,0,5). Traveling 5 km / h down, your speed will be the same, but the vector will be (0,0, -5). Traveling at 5 km / h at an angle of 45 degrees forward, the SPEED along each of the x and z axes will be the square root of 5, so the vector will be (approximately) (2,2,0,2,2). Etc.



+14


a source


Most likely, the change in three-dimensional space for the object will be measured.

The magnitude of the vector should be as fast as you expect, and as the direction of the object changes, the vector components are likely to change.

+2


a source


You would use a vector because you can have velocity in 3 dimensions. In other words, 3D speed is a combination of distance / time in all three dimensions. It might be better to name the variables xPrime, yPrime, and zPrime so that the vector more clearly represents velocity rather than position.

+2


a source


Perhaps it is the speed of an object in each direction in 3D space that does it in such a way that you can extrapolate the direction of motion after all the speed is moving with direction.

0


a source







All Articles