How can i get a npc to attack from behind. Not a problem when his victim is facing away but otherwise he just moves straight at him and goes behind whereas i want him to circle round then move in.
Cheat. Set an empty GameObject up as a child of the victim. Place it behind the victim. Navigate to that. You can also use the dot product to compare facing.
Already tried that bored but as mentioned he goes straight for the point running into or just past the target i'm looking for a way to calculate a semi circle from 2 points and feed co-ords from that path to the npc every few frames.
Dont know what exactly you are doing but you could try messing with the example given in the Docs on Vector3.Slerp. http://docs.unity3d.com/ScriptReference/Vector3.Slerp.html
It is not trivial to make this work well, i think you need to play with the pathfinding and AI. 0. separate long-distance pathfinding from "combat range pathfinding" to handle step 3 below. 1. figure out the threat-zone or "sight zone" of the player which is probably some kind of cone or semicircle that moves with the player, and rotates with the player. (depending on your game type you may be able to use the camera frustum) 2. increase the cost of any pathfinding "step" that is in this zone so that the enemy npc will avoid walking through this area.(or increase some "threat value" of standing in that location, so the npc will want to move out of sight) 3. calculate new paths regularly as the player will be moving and turning around.(biggest performance hit probably) obviously this is not a one-line unity built in type function.(afaik
The vec 3 slerp is close to what i was thinking still haven't managed to get it right yet the speed settings are very fickle.