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 JBak96 · Dec 04, 2012 at 05:14 PM · generationautomatictrackendless

How to create an endless track?

Hello everybody!

I'm creating a game where i need an endless track. I've got a object, which moves always in z-direction. Now the script should generate a track for the object to move on. It should work similar to this project: http://catlikecoding.com/unity/tutorials/runner/ how the background is generated, but in JavaScript.

I hope that anyone can help!

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 Landern · Dec 04, 2012 at 05:21 PM 1
Share

Doooode, that tutorial most likely has everything(though primitive) that you would need, just not in Java/Unityscript, i would suggest that you take a stab at converting it, actually follow the tutorial to understand why things are what they are.

It's like someone putting gold out for anyone to take it, but you don't want it because it's square, not rectangular.

1 Reply

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by azmat786n · Dec 04, 2012 at 05:22 PM

 //object prefab for clone
 public var platform : GameObject;
 
 //take this object into Camera you can do it (Drag this object drap onto Camera.
 //object for spawn object
 public var spawnPosition : Transform;
 
 //one more position where platform going to destroye.
 //also take this object in main Camera to
 public var destroyPosition: Transform;
 
 //set distance for next spawn
 public var spawnDistance : float;
 //this is automatic access do not change
 private var lastPlatform : GameObject;
 
 function Start() {
     //Instantiate on start
     lastPlatform = Instantiate(platform, spawnPosition.position, Quaternion.identity) as GameObject;
 }
 
 function Update() {
     //make distance between 2 platforms
     if (lastPlatform.transform.position.y + spawnDistance < spawnPosition.position.y)
             {
                 //call one more function to getrate platforms
                 InstantiatePlatform();
             }
     //destroye if platform position lower then screen height
     if(lastPlatform.transform.position.y < destroyPosition.position.y) {
         //Destroy object 
         Destroy(lastPlatform);
     
     }
 }
 function InstantiatePlatform()
         {
             lastPlatform = Instantiate(platform,new Vector3(Random.Range(-13,13) * 0.2f,spawnPosition.position.y,1),Quaternion.identity) as GameObject;
         }
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 azmat786n · Dec 04, 2012 at 05:25 PM 0
Share

if you want this like runner you have to change some thing in above script like y position to go on x position move your spawnPosition game object onto x position ... but not difficult you can change.

this is for jumping game script platform generator where character jumping.

hope this is helpful to you

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

11 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

Related Questions

How can I detect collision with a text mesh without manually creating a polygon collider? 3 Answers

Rendering only when player is nearby. 1 Answer

(Editor Scripting) Is it possible to generate MenuItems? 2 Answers

Problem with Auto instantiating in X seconds in C# 1 Answer

How To Endlessly Make Land in a 2D Topdown game 2 Answers


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