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 /
This question was closed Oct 09, 2013 at 01:22 PM by AlucardJay for the following reason:

Question is off-topic or not relevant

avatar image
0
Question by Blink123123 · Oct 09, 2013 at 10:19 AM · waypointspathfollowing

Paths / Waypoints

I am making a game that requires a car to follow a PRECISE track. I will start by making a world editor/maker in which I will create every level. The road will be split into pieces that can be built together to make a full road. So how to assign to each block a path to follow? PS: Each parts will have two parallel roads, and the car needs to travel in curves also. So how is this possible? can anyone point me to any resources?

In short is it possible to make a Prefab with a path assigned to it that can be combined with other prefabs to make 1 whole path? And what is that resource?

Comment
Add comment · Show 6
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 Sisso · Oct 09, 2013 at 12:42 PM 0
Share

You can't ask to model your solution. You need to simple get in to the code and make it work.

avatar image Tomer-Barkan · Oct 09, 2013 at 01:07 PM 1
Share

He's asking for help solving an actual problem that he has and doesn't know how to do. That's exactly what this site is for. I for one would also be interested as to how this can be done in unity.

avatar image Blink123123 · Oct 09, 2013 at 01:12 PM 0
Share

Thanks tbkn :) I have posted my approach that I have thought of in case anyone has another approach please do tell me :)

avatar image Sisso · Oct 09, 2013 at 01:12 PM 0
Share

Ok... for me, it get into item A) of http://answers.unity3d.com/page/newuser.html

But I will love to see your answer @tbkn. Give it a try :P

avatar image Blink123123 · Oct 09, 2013 at 01:13 PM 0
Share

I didn't ask for you to write any code :) $$anonymous$$y question was a logic question. What was the approach to do so :)

Show more comments

3 Replies

  • Sort: 
avatar image
0
Best Answer

Answer by Tomer-Barkan · Oct 09, 2013 at 01:20 PM

Here's an idea, but it is a bit limiting:

You can pre-create several road "tiles", say for instance vertical road, horizontal road, and the 4 curves (bot/right, bot/left, top/right, top/left). Then for each one of the tiles, you'd define the location of the car in relation to the entry point for that tile. For example, a straight line would have the following function:

(x, y)(d) = (d, 0.5)

As in, the X coordinates equals D, which is the distance travelled from the leftmost point of the tile, while the Y coordinates are a constant 0.5. You can define the function as a script:

 public Vector2 GetPositionInTile(distance) {
     return new Vector2(distance, 0.5f);
 }

Then as the car is travelling the road, you calculate the distance as a function of the car's speed and time, and then depending on the tile that the car is in, you calculate X and Y using the tile's function, and move the car to the correct position every frame.

Comment
Add comment · Show 1 · 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 Blink123123 · Oct 09, 2013 at 01:27 PM 0
Share

Well I am splitting the game into a World Creator and the actual game. So I think it is better that the Builder uses this logic to combine the whole paths into one that way there is less computing time in the actual Game. But still thanks for your answer :D

avatar image
0

Answer by Sisso · Oct 09, 2013 at 12:42 PM

So how is this possible? can anyone point me to any resources?

Yes, almost everything is possible and have a infinite way to do. Here is a good starting resource:

http://docs.unity3d.com/Documentation/Manual/Scripting42.html

Comment
Add comment · 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
0

Answer by Blink123123 · Oct 09, 2013 at 01:11 PM

I have found a solution to use iTween script located here: http://pixelplacement.com/2010/12/03/visual-editor-for-itween-motion-paths/ Now I am trying to figure out how to make a grid based terrain to add these paths dynamically. The best approach in my opinion is that every part has a script that indicates the path's behavior on it (starts on X relative to the cube and so on). Then when the whole terrain is created the code should create a whole new complete path according the the combination. I answered my own question I guess :P

Comment
Add comment · 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

Follow this Question

Answers Answers and Comments

18 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 avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Make player follow a waypoint path but still be able to control player movement 1 Answer

Make object move backwards/reverse on array of waypoints 0 Answers

Waypoint System 1 Answer

AI Character spins around Waypoint 1 Answer

Need Help With My AI Script 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