Thank you both very much for explaining that!
So to move away from the player I would calculate the distance between the two, normalize this and then reverse it to give me the opposite direction?
Moving away from or towards the player
Thank you both very much for explaining that!
So to move away from the player I would calculate the distance between the two, normalize this and then reverse it to give me the opposite direction?
Pretty much, but it's 'calculate the vector between the two, normalize this (using the distance) and then reverse it to get the opposite direction'.
Just looking for a bit more added advice here.
I'm adding behavior for the AI to detect if it is too close to another ai, and move accordingly. My problem is that if I happen to get two opposite movement vectors, after I add them the result will be 0. How should one respond in this situation? (for my simulation the ai will simply explode, but I mean this as a broader question, if I were doing simulation for example)
I'm adding behavior for the AI to detect if it is too close to another ai, and move accordingly. My problem is that if I happen to get two opposite movement vectors, after I add them the result will be 0. How should one respond in this situation? (for my simulation the ai will simply explode, but I mean this as a broader question, if I were doing simulation for example)
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement