What is a 3D Vector and how does it differ from a

2019-02-16 13:39发布

Does a 3D vector differ from a 3D point tuple (x,y,z) in the context of 3D game mathematics?

If they are different, then how do I calculate a vector given a 3d point?

7条回答
男人必须洒脱
2楼-- · 2019-02-16 14:17

Does a 3D vector differ from a 3D point tuple (x,y,z) in the context of 3D game mathematics?

Traditionaly vector means a direction and speed. A point could be considered a vector from the world orgin of one time step. (even though it may not be considered mathematically pure)

If they are different, then how do I calculate a vector given a 3d point?

target-tower is the common mnemonic.

Careful on your usage of this. The resulting vector is really normal*velocity. If you want to change it into something useful in a game application: you will need to normalize the vector first.

Example: Joe is at (10,0,0) and he wants to go to (10,10,0)
Target-Tower: (10,10,0)-(10,0,0)=(0,10,0)
Normalize the resulting vector: (0,1,0)
Apply "physics": (0,1,0) * speed*elapsed_time < speed = 3 and we'll say that the computer froze for a whole 2 seconds between the last step and this one for ease of computation > =(0,6,0)
Add the resulting vector to Joes current point in space to get his next point in space: ... =(10,6,0)

Normal = vector/(sqrt(x*x+y*y+z*z))

...I think I have everything here

查看更多
登录 后发表回答