Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.
Posted 04 April 2011 - 10:42 PM
Posted 05 April 2011 - 02:08 AM
Posted 05 April 2011 - 02:27 AM
The dot-product is a tool that uses 2 difference vectors (not position vectors). Which difference vectors do you want to use?
Do you need an explicit angle at all? You can compute the difference vector from the current enemy position to the current (or predicted) player position. With it you have both the total distance and (after normalization) the direction of movement (assuming that pathfinding didn't play a role here).
If not yet known: Usually one is directed to look at Steering Behaviors and its open source counterpart OpenSteer for such kinds of things.
Posted 05 April 2011 - 04:00 AM
The OP asked for "on how people might go about this", and OpenSteer demonstrates such a thing. The OP is free to pick the theory only, look at the implementation, find references to other solutions, or else decide to directly use OpenSteer; I haven't made any suggestion to actually use OpenSteer but just directed him to a place where some research can be done.Why would one go about using OpenSteer? That's just steering one away from actually learning how to do the real work.
Also, that is hard to do....Very hard.
Posted 05 April 2011 - 04:14 AM
The OP asked for "on how people might go about this", and OpenSteer demonstrates such a thing. The OP is free to pick the theory only, look at the implementation, find references to other solutions, or else decide to directly use OpenSteer; I haven't made any suggestion to actually use OpenSteer but just directed him to a place where some research can be done.Why would one go about using OpenSteer? That's just steering one away from actually learning how to do the real work.
Also, that is hard to do....Very hard.
Posted 05 April 2011 - 07:12 AM
Posted 05 April 2011 - 07:29 AM
Posted 05 April 2011 - 08:13 AM
Don't confuse 'normals' (vectors at right angles to things) with 'normalizing' (making a vector have a length of 1).Thank you very much Simon, I can see how that works.
I would still like to understand the process of using normalization, I am not quite sure how it would return the direction because I was under the impressing there were 2 normals, not 1.
Posted 05 April 2011 - 08:13 AM
The term "normalization" in the context of vectors means that the vector is divided by its length, yielding in a vector of the same direction but with unit length (i.e. its length is 1). Although any vector (with length > 0) can be used for a specific direction, the unit vector is usually favored. The difference vector between 2 points encodes both the distance of the 2 points and the direction from the one to the other point.I would still like to understand the process of using normalization, I am not quite sure how it would return the direction because I was under the impressing there were 2 normals, not 1.
Posted 05 April 2011 - 09:36 AM
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'.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?
Posted 05 April 2011 - 04:46 PM
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.
GameDev.net™, the GameDev.net logo, and GDNet™ are trademarks of GameDev.net, LLC.