Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by thatnewguy · Jan 24, 2013 at 12:30 AM · aiwaypoint

how to create waypoints for a car to follow?

so i am making a racing game, but i cant seem to create a waypoint for the AI Cars. i have itween visual editor but since i am a noob at this i cant seem to find a waypoint script in the files. is there a script in there i am just too blind to see, or is there a script i have to create and put in?

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

2 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by cdrandin · Jan 24, 2013 at 02:03 AM

I took this from Unity's FPS tutorial. Even though it is for a FPS, it isn't too difficult to transfer the idea to your unique game. http://download.unity3d.com/support/old-resources/files/FPS_Tutorial_3.pdf First section is "Waypoints", you will have to download the FPS_Complete and look up the script to see it.

Comment
Add comment · Show 4 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image thatnewguy · Jan 25, 2013 at 01:38 AM 0
Share

and where can i download it??

avatar image cdrandin · Jan 25, 2013 at 02:32 AM 0
Share

fail... http://unity3d.com/support/old-resources/files/FPS_Tutorial_Completed.zip

avatar image thatnewguy · Jan 25, 2013 at 03:44 AM 0
Share

Its not a fail if it doesnt explain it to a total noob like me

avatar image Meher21188 · Jan 09, 2015 at 06:50 AM 0
Share

please provide me pdf link as above link is not working..:-(

avatar image
0

Answer by sam32x · Jan 25, 2013 at 02:29 AM

create a few empty gameobjects and label them waypoint1, waypoint2 etc. then make another empty gameobject and put a collider on it and check the trigger box, then put this script on the trigger

 var waypoint1 : Transform;
 var waypoint2 : Transform;
 var waypoint3 : Transform;
 //extend this if you want
 var waypoint = 1;
 
 function Start () {
 transform.Position = waypoint1.position;
 }
 
 function Update () {
 // extend this part too if you extended the top
 if(waypoint == 2){
 transform.Position = waypoint2.position;
 }
 if(waypoint == 3){
 transform.Position = waypoint3.position;
 }
 }
 
 //im assuming your car has a collider
 function OnTriggerEnter () {
 waypoint += 1;
 }


then put this on the AI car

 var trigger : Transform;
 //make sure you assign the objects to the script in the editor
 function Update () {
 transform.LookAt(trigger);
 }

note that this wont look very realistic because the car will turn instantly. you could try RotateTowards but i didnt use it because i have never been able to get it to work

Comment
Add comment · Show 5 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image thatnewguy · Jan 26, 2013 at 04:08 AM 0
Share

is this java or C+?

avatar image thatnewguy · Jan 26, 2013 at 04:59 AM 0
Share

And what colider?

avatar image Zarkow · Jun 16, 2018 at 03:01 PM 0
Share

Writing conditional code with so many if-statements is a horrible practice.

avatar image ShadyProductions Zarkow · Jun 16, 2018 at 03:03 PM 0
Share

No need to wake up posts from 2013..

avatar image Zarkow ShadyProductions · Jun 16, 2018 at 05:51 PM -1
Share

This post comes up as one of the first when googling, so it WILL be getting a lot of hits.

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

12 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Random Running and Follow at Certain Distance 0 Answers

I need to instantiate a empty gameObject 2 Units right/left of a 'Enemies' Transform? 3 Answers

Incredibly high speed tweening/enemy movement 0 Answers

AI Pathfinding 1 Answer

How to make enemy attack multiple unit rather then single?(updated) 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges