Hi Unity Community!
Any tutorial regarding vehicle AI gives the following code for getting the steering magnitude (-1 to 1) to the next waypoint:
Vector3 pos = transform.InverseTransformPoint(nextWaypoint.position);
steerMagnitude = pos.x / pos.magnitude;
But since this involves the Sqrt operation, is there a more efficient method? Because I plan on having about minimum 50 vehicles in the scene at a time. But that can even increase to 100 - 200 vehicles. Or is the Sqrt operation fast enough for **mobile devices** to cope with 200 vehicles using this code each FixedUpdate? I also have other code like OA, etc.
↧