Hi,
I am trying to figure out if a certain transform is behind or in front of another transform. I attempt doing this with myAngle = Vector3.Angle(targetDir, forward); and then checking if the myAngle < 90. But for some reason this doesn’t always seam to work. What is the best way of checking of for instance two missiles moving which missile is behind which. Note they are not always moving in the same direction so they could also be moving away from each other.
Any ideas?
If you are doing a racing game where you race around a track. You need to look at it as a waypoint/lap system.
I wrote a piece on it a while back HERE
The world is randomly generated not at all like a race track. It’s to make the behaviour of certain agents change when another agent is behind them or in front of them. Like attack or run away. that sort of thing. The dot product seems to work nicely but I am wondering if the matf.Angle() does exactly the same.
Yes and no, the Dot function is the best for your your application. Its quicker computationally.