Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I'm experimenting with Unity3D and colliders. Unfortunately I still don't have Unity Pro version and I can't use the profiler.

Consider the following situation:

  • mobile devices (ios, iphone 3GS).
  • an infinite runner game (consider something like agent dash or temple run). The player run along its path collecting bonuses and possibly hurting obstacles.
  • the number of objects along player's path is very high.

The first simple approach is to use a rigidbody with a collider attached to the player (let's say it could be even a shere collider) and use a collider for each object in the scene (coins, obstacles, bonuses,...) .

AFAIK, using hundreds of colliders could have a serious impact on performances,specially on mobile devices, am I right?

So here's some questions:

  • In the situation described above, is that feasible use collider to detect objects collectable by a player running along a path?
  • Could be a better idea to store the location of the collectables objects inside some kind of data structure and completely avoid to use Unity collision detection?
  • What's a reasonable average number of RigidBody/Sphere Collider that can be used in a single scene on a mobile device?

Does anyone has implemented something similar? Could you suggest me the right way to go?

share|improve this question
    
Only check collision whith that you see, nothing else. especialy in an "Infinite" level. you cant have an unlimited amount of collision chekcs every frame. you have to generate it from what you have on screen. and how you store that information is probably not so important as this will generate more of a cpu overhead rather than memory. –  Tordin Jan 15 '13 at 10:34
    
@Tordin: could you clarify a little bit? –  Heisenbug Jan 15 '13 at 10:42
1  
For the tempel runner idea, You only have to check collision ten feet ahead, or even less. And not even more than one feet behind the character. and you can even free the collision when it´s one feet behind the character, since you are never going back there again, ever. So you can then use thos to create new collision objects from the geometry in your game. –  Tordin Jan 15 '13 at 10:50
    
@Tordin: the data struct I use for eventually sort the object have impact on the CPU too, since I have to iterate over it. I don't think I can create colliders at runtime, because it will affect the collider tree structure causing performance issues, am I wrong? –  Heisenbug Jan 15 '13 at 10:52
    
Not necessarily, you could have a pool of say, 100 collision objcets, that you just reuse over and over again. Same thing with your objects, when they are out of screen, you just "move them" to the top of the level. And i am not sure how unity solves it collision and how the performance impacts are with unity. –  Tordin Jan 15 '13 at 10:55

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.