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 Saint34x · Apr 16, 2014 at 11:24 PM · movementinstantiatecollidermeshinfinite

why does Infinite Runner Terrain Collider break my game?

So I'm working on an infinite runner game in which the player stays still but the ground is constantly moving in his direction giving the feel of him running. heres the move script applied to the terrain

` using UnityEngine; using System.Collections;

public class MovementScript : MonoBehaviour { public float enviroSpeed = 10.0f; // how fast the player is moving public Vector3 moveDirection = Vector3.forward; // what direction the player is moving

 // Update is called once per frame
 void Update () 
 {
     transform.Translate(-moveDirection * enviroSpeed * Time.deltaTime); 
                                                                     


 }


}

there are 3 pieces on screen at a time once one moves behind the player it hits a collider that spawns another random prefab then destroys itself. right now i have 8 simple Prefabs that are made up of a colored ground box, a collider at the front that lets me know when its hit the destroyer box and then a spawn box that is the exact same size as the front collider box and exactly 3 ground cube lengths away from the front cube. my spawn script which is attached to my Prefabs is this using UnityEngine; using System.Collections;

 public class DestroyScriptAlt : MonoBehaviour {
 
     public Transform spawnPoint; // spot object will spawn new terrain at. Exactly 3 places away
     public GameObject[] obj;
 
 
     void OnTriggerEnter(Collider other)
     {
             if (collider.tag =="base" )
         {
         Instantiate (obj[Random.Range(0,obj.GetLength(0))], spawnPoint.position,Quaternion.identity);
         Destroy(this.gameObject);
         }
     }
 }

This all works just fine up until i add a forth piece to the Prefabs. in Maya i made interlocking terrain pieces that whose verts always start and end at exactly the same spot. so that no matter what combination of random pieces it gives me they will always fit. alt text this too works until i add the much needed colliders on these meshes. then it all goes crazy.

alt text

i get lots of mesh overlay it spawns more objects than needed i thought it might be detecting all objects entering the collider thats why i added that if tag == base part . it sometimes take a while for this to happen. but i have noticed the higher the terrain movement speed is set the fast it happens...any help on what I'm doing wrong would be greatly appreciated.

screen shot 2014-04-16 at 4.32.52 pm.jpg (81.8 kB)
screen shot 2014-04-16 at 4.48.54 pm.jpg (161.0 kB)
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

0 Replies

· Add your reply
  • Sort: 

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

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

Related Questions

mesh colliders moving when i press play 1 Answer

How to connect two spheres one to stay on top of another which is rotating moveing one (player body , head) 0 Answers

Problem with collision detection in an animated object 1 Answer

Player model physics doesn't seem to work properly. Gravity issues maybe? 0 Answers

Problem with the look direction after Instanciate/Rotate 0 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