Game Development Community

Fleeing robots

by Tasty Green Pees :-, · in General Discussion · 04/11/2006 (7:33 am) · 4 replies

Hey. got a question. I'd like my ai to move away from my player when within a certain distance from him.

I understand I would need to get the vector between them and use this vector to give the ai his direction when running away but how would I go about telling the ai to move in opposite direction from the vector.

In other words how do I get the vector direction between the ai and my player and reverse it to point away from my player and then tell my player to walk away?

Any help, much appriciated

#1
04/12/2006 (6:37 am)
Anyone got any ideas?
#2
04/12/2006 (6:48 am)
Well, if you know how to make him face the player, then you can try adding 180 deggrees to the Z-rotation, and tell him to move forward using the built in moving function.(this wasn't tested. I thought of it just now)

good luck,
Lee-Orr
#3
04/12/2006 (10:34 am)
[slaping my forhead about the 180 degree thing, Lee] but i don't know a function that tells the player to go forward. perhaps i could use a move to function. can anyone help me out with the math -- point me inthe right direction or something.

2 cents appricated.
#4
04/12/2006 (12:19 pm)
You could get the eye vector after rotating and use it to move it forward, but I was sure(I might be wrong) that there is something built in to the player(ai and not ai) that makes it walk or run forward.

good luck,
Lee-Orr