Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

[Question] WayPoint Circuit - Standard Assets?

Discussion in 'Editor & General Support' started by CelticKnight, Aug 1, 2017.

  1. CelticKnight

    CelticKnight

    Joined:
    Jan 12, 2015
    Posts:
    378
    Hello All,

    I wave been working through a YouTube tutorial series using the Car packages in the standard assets. It was quite good until I got the Tutorial 6 when an error was introduced and so had to start modifying the project quite a lot to eliminate it.

    And at tut 7 another error was introduced and although the script in the tut worked and the car was following his own waypoint system, there was an error occurring every frame. So I started looking at how to use the Waypoint AI system for the enemy car - and I couldn't find any video on YouTube or on the forum that answered my question.

    Now in the CarWayPointBased prefab there two script that are calling objects that I don't know where they should be pointing too to solve the errors:

    1. In the "Car AI Control" there is a Target object that needs to be set in the Inspector what exactly should it be pointing to?
    2. In the "Waypoint Progress Tracker", there is a Circuit object what should this be set to? And furthermore there is also a Target Object as well what should this be pointing to?
    To anyone who can help here is a big thankyou in advance!

    Regards.
     
  2. CelticKnight

    CelticKnight

    Joined:
    Jan 12, 2015
    Posts:
    378
    I seem to have found the solution in the following post on the forum:

    I had no idea of how to create the WayPoint Circuit or how to go about using the script. Without this post I never would've figured it out on my own :oops:.
     
  3. johnnyshumway

    johnnyshumway

    Joined:
    Jul 29, 2020
    Posts:
    7
    I have been trying to figure this out myself, quick question though... I have setup the Waypoint Circuit for my game, but the AI won't follow the circuit. Do I need to set some specific target in the AI Controller Component? Here is what I have so far:

    upload_2021-1-7_17-42-25.png

    And...

    upload_2021-1-7_17-43-18.png

    Oh and yes, I do have a Car Controller attached to the AI as well. The Waypoint Circuit is on a separate game object from the AI itself. Please help, thank you.

    Here is what I have tried:
    - I set the first Waypoint (W1) as the target in the 'Car AI Control' Component. The AI drove to the Waypoint then circled around that one point.
    - I set 'Car AI Control' component target as the Waypoint Circuit Game Object (The Parent Object of all the Waypoints) and the AI does the same as the previous test.
    - I set the 'Car AI Control' Component target to None and the AI just stays there not doing anything.

    Am I forgetting something? I looked in the scripts comments, but didn't find anything. I also looked through the guidelines, it says to view the 'Waypoint Circuit Guidelines' but there aren't any documents named that?

    upload_2021-1-7_17-50-25.png

    Oh I forgot to mention this earlier but I read the part about the 'View the Waypoint circuit guidelines..." in the 'Car Guidelines' document:
    upload_2021-1-7_17-52-16.png

    Thanks ahead-of-time.
     
  4. johnnyshumway

    johnnyshumway

    Joined:
    Jul 29, 2020
    Posts:
    7
    I just figured it out :D

    I set the Targets on both the 'Waypoint Progress Tracker' and 'Car AI Control' to the first waypoint (W1) and then turned of the 'Smooth Route' option in the 'Waypoint Circuit' Component (which is on the 'Waypoint Circuit' game object).

    Have A Great day!

    upload_2021-1-7_18-7-53.png

    upload_2021-1-7_18-8-13.png

    All I need to do now is mess with the value to get the desired behavior I want :)!