Hi
I’m having a very hard time finding resources to help me learn about working with directions as Vectors. I know that Up or North is (0,1), and Northwest would be (0.5,0.5), but I can’t find any resources on what sort of math would be needed to work with any sort of directions other than this (Say halfway between northwest and west.)
What I’m trying to do is create a context map for my AI’s decision making. I want to be able to divide the world up into a set amount of directions (in relation to where the enemy is,) and have it make decisions based on which direction seems the most desirable to achieve it’s current goal. I’ve read all sorts of papers and other resources on Context Steering (the exact thing I’m trying to implement,) but I’ve never been very math smart and can’t wrap my head around the division of the directions.
Ideally what I’d achieve is a function that I could call that would return a list of Vector2 directions, and would take an input for the amount of directions I want to turn the world into (So if I called it for 4 directions it would return Vector2.up, vector2.down, etc.)
The reason I specifically want to be able to choose the amount of directions through a function, rather than do the math myself and hardcode it in ahead of time, is for performance reasons. Just having 4 or 8 directions, while easy, looks very rigid when I lock my steering behaviors to them. I want to be able to tweak to see exactly how much I can get away with, and have certain enemies have more circular movement than others.
I don’t need somebody to write the function for me per se, but math was never my strong suit, and I’ve only ever needed to alter already determined directions before (steer away from an obstacle, etc.) I have no idea what the field of math is even called, and when I try to google it I don’t find what I’m looking for because I don’t have the right words apparently. Any help even finding the resources to understand this would be much appreciated!
I’ve tried searching up Vector Directions, c# dividing circles, etc with no avail so I’m really hoping somebody here can at least point me in the right direction.