- Home /
 
               Question by 
               FizzyBear · Apr 17, 2012 at 10:14 AM · 
                animationjavascriptmovementgameobject  
              
 
              Enemy circles player instead of attacking.
¬_¬ Delete this..
               Comment
              
 
               
              Answer by TheFrankman123 · Apr 17, 2012 at 10:55 AM
``When you have set the distance you have to be before attacking you can do something along the lines of this:
 var speed : float = 3;
 var diffVector: Vector3 = target - transform.position;
 
      var movement : Vector3;
     
         if(diffVector.magnitude > 1){
          movement = (diffVector.normalized * speed);
         }
This will prevent the enemy from slowing down when it gets closer to the target.
However in my own experience of enemyAI it's better to add a collider that is trigger then if the player is in that area you can start the animation playing etc.
Your answer
 
 
             Follow this Question
Related Questions
Interaction around an gameObject 1 Answer
Making changes to a terrian in game 1 Answer
scripting for animation 0 Answers
 koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                