Waypoints work in iphone unity3D Is it possible

Hi all,
my two question related to my Racing car game.

  1. Waypoints work in iphone unity3D Is it possible
  2. In my Racing car game hot to make traffic with car, obstacles, any more things

so my logic is i making a traffic with waypoints in my game.
IS IT POSSIBLE ???

Thanks in advance.

Sure it’s possible. As with all things, if you want it, you program it.

–Eric

Thanks

but give me some solution particularly scripting side

I’ve finished a system that uses built-in arrays and basically just points toward it and applies various amounts of force. Works’ a treat, another array is kept that keeps ‘speed’ properties which is so i can force the AI to slow down in some areas.

However, since its the backbone of a fairly expensive title, I’m probably not going to share code :slight_smile:

i want to know how to make way point should i rum my car automaticaly by the waypoints

A waypoint is simply a navigation point for your vehicle to drive through. The simplest system would simply make your vehicle “lookat” the next waypoint like this:

     Car.transform.LookAt ( Waypoint.transform.position );

then move it forward by a certain speed per frame, until it’s close enough to move to the next waypoint, like so:

     if ( Vector3.Distance ( Car.transform.position, Waypoint.transform.position ) < 1.0f )
          Car.transform.position += Car.transform.forward * CarSpeed;
     else
          // Find next waypoint

This is basic, to demonstrate the theory behind it. This will always look very “angular” (kinda like the light bikes in TRON), but it’ll do the job.

The next thing to do is to use transformpoints on the car (look up transformpoint and inversetransformpoint), decide where you want to steer your car, create a rotation which would send your car in the right direction, then Quaternion.Slerp toward the right direction, whilst moving your car forward.

Unity doesn’t “do” this out of the box (as in, there’s no built in solution) but it’s pretty easy if you put your mind to it.

Have fun! :slight_smile: