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 GamingNewBie · Dec 13, 2012 at 06:09 PM · pathdynamicgeneration

Generate players path on the Fly

"I have different junctions i.e turn right, turn left etc. i want to connect these junctions randomly on the fly. so that the user have an illusion of endless running track. Secondly the player(with Third person camera) is just animating like its running but actually its not, rather the junctions are moving towards the player. I am new to Unity and Game Development. Please advice me the best possible approach to achieve this. Its more like Temple Run i hope you guys know about it."

Updating Since i get no help so i started it. I have started creating the Junctions recursively at 0,0,0 also applying translation to z-axis of the junction by 0.01f. As soon as this junction reaches 0,0,2.3. i call in for the new Junction and place it at 0,0,0.

The problem is i see a flickering line between the two junctions, Also the transition is not smooth enough for the illusion that the player is running.

I appreciate if some body can help.

Code below is applied on Junctions i.e Tiles

public class Translation : MonoBehaviour {

// Use this for initialization void Start () {

}

// Update is called once per frame void Update () { transform.Translate(new Vector3(0f,0f,0.01f)); } }

Below is the code applied to an emptyGame object as GameManager

public class TileHandler : MonoBehaviour {

// Use this for initialization static GameObject objTile; static Vector3 spawnPosition=new Vector3(0f,0f,0f); // Tile's Spawn Position static Queue stkGameobject=new Queue(); Vector3 previousTilePosition; void Start() { ChangeTile(); } public void ChangeTile() { // Get a new Random Junction Tile t= TileGenerator.GetTile(); objTile=Instantiate(t.TileObject, spawnPosition, Quaternion.identity) as GameObject; // Destroying un needed Junctions that have passed the player. stkGameobject.Enqueue(objTile.gameObject); if (stkGameobject.Count>3) { Destroy(stkGameobject.Dequeue()); } } void Update() { //Create New Tile When the previous tile reach this position Vector3 v3=new Vector3(0.0f,0.0f,2.3f); if (objTile.transform.position == v3) { ChangeTile(); } } }

Please do share if you guys have any better idea to do it.

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

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by kashiftasneem · Feb 25, 2013 at 05:54 AM

What i feel is in temple run is a static environment with various turns which always end up in that environment. You cant create new junctions at every turn as it will be very memory consuming. You can do is that place random small objects on turns which gives the effect of new turn. For the player movement, create an empty game object with two children camera and player object. player object will be a collider and a rigid body. It will have one child which will be player running animation object. Apply force to rigid body to move the player

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

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

10 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

Related Questions

Creating a mesh and assigning a material during edit time. 1 Answer

Generate random path in grid 1 Answer

Best way to dynamically generate textures? 0 Answers

iTween change orienttopath mid path? 0 Answers

Resources.Load dynamic path 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