I don't know that Vector is really useful on game development. 😌
I've learned Vector addition, substraction, multiplication, dot, and cross.
Addition: Imagine you have a red box on Vector3(0, 100, 0) and you want to put a green box above it. You can simply add the red box position with Vector3(0, 0, 100).
Substraction: It's useful when you want to make the vector direction. Imagine you want to make a vector direction from a zombie located in A to attack a random human located in B. You could simply substract B-A and add it with zombie location ( A + (B-A) ). You could make a velocity or something with this vector. B-A means the A direct to B, A-B means B direct to A.
Multiplication: Extend/Scale the Vector Magnitude. YES! we can scale the vector using multiplication.
Dot: You can use it for checking are you facing the object or not. Imagine you have a zombie NOT FACING you. So, he can't chase you.
Cross: You can use It for make a vector that perpendicular from 2 vectors. It can be usefull to make a face direction.
0 comments:
Post a Comment