• Nextbot- How to move away from an enemy by X distance ?
    3 replies, posted
Trying to make a function that has my bot move away from its enemy by a certain distance. not sure how to approach this.
what code do you have? you have the RunBehaviour where you can see if the bot HasEnemy and if so then you can simply move away from the player
[QUOTE=Busan1;47839799]what code do you have? you have the RunBehaviour where you can see if the bot HasEnemy and if so then you can simply move away from the player[/QUOTE] my issue is i'm not sure how to get a point that is "away" from the enemy.
find the normalized vector between your entity and the enemy, then multiply that by the distance you want to go back, and add it to your entity's position. in psuedolua: local vec = entity:GetPos() + (entity:GetPos()-enemy:GetPos()):GetNormal()*dist
Sorry, you need to Log In to post a reply to this thread.