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 Feb 06, 2015 at 11:18 AM by abi-kr01 for the following reason:

Duplicate Question

avatar image
0
Question by abi-kr01 · Aug 20, 2013 at 07:55 AM · terrainendless runner

Create an unlimited terrain

i have a terrain(named road) i want that terrain to repeat itself when my game object(car) reaches to some position on x direction.terrain must repeat itself just where the first terrain end so that my game object(car) will feel like, its running road where there is no end of road not on two different terrains.something like subway surfer ,(my basic requirement is to create endless runner )i am very new to unity so plz it will be grate help if u explain what to do and how to do.

Comment
Add comment · Show 1
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 dorpeleg · Aug 20, 2013 at 08:01 AM 1
Share

Please head to the forums with this kind of question.

UA is meant to help solve issues and not to ask "how to?"

2 Replies

  • Sort: 
avatar image
1

Answer by whydoidoit · Aug 20, 2013 at 08:01 AM

You need to:

  • Create several terrain tiles and map them together so that all of their edges are seamless joins (you could create one terrain and just instantiate it a few times, the easiest may be to have 9)

  • As you move you work out which tile you are on and either:

(1) move the other terrain tiles so that they surround the player - this has a problem when you end up a long way from the start due to the inaccuracies in floating point numbers.

     TTT
     T*T    Move the tiles so that the player is always in the middle
     TTT

(2) move the player and all other objects back to the relative position on the central tile when the player exits it by adjusting the x,z coordinates by the size of a tile.

     TTT
     T*T    Move the player when they exit the central tile so that they are back on it
     TTT
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 Canazza · Aug 20, 2013 at 08:08 AM

You should look into Instantiating Objects, and creating Prefabs. These are basic things that you'll be doing alot in Unity.

In your example you'd Prefab your Terrain, create a GameObject variable in whatever script you're using to control the game, then when you want to create the terrain, Instantiate the GameObject and set its transform.localPosition based on the scale of the terrain and how many of the terrains there are (ie, if this is the 5th terrain, and you're running on the Z direction, you'd set the localPosition to 0,0,NumTerrains * TerrainLength). You'll also need to keep track of the number of terrains and the last [b]two[/b] terrains created so that when you create your next terrain you can Destroy the terrain behind the one you're on.

I'd run through the Beginner Scripting tutorial which should cover everything you need to know to impliment this

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

Check if player is under or on an object 2 Answers

How to create endless terrain... 0 Answers

How do I generate an omnidirectional 2d terrain? 0 Answers

Make a simple tree 1 Answer

Can someone please help me solve this problem - When I duplicate my asset , why the original one stops working? 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