Quantcast
Channel: Questions in topic: "follow"
Viewing all articles
Browse latest Browse all 536

Move the world or the obstacles?

$
0
0
Here is a question. (concerning and infinite side-scroller.. yes another one). Currently the only thing that truly moves, is my player. Of course the whole world moves with it. Everything except for the obstacles that is. So my player forward at a constant rate, The camera has a script that gets the players position every single update, and sets the camera position accordingly. This gets some pretty heavy use through out the game. Many things are then children of the camera. My graphical floor, the floor collider, the background, the intermediate background. The ceiling collider, basically my scene is a child of the Main camera. Then I have my obstacles, they are spawned from an Object pool at a specific distance ahead of the player, at a given time interval. The total obstacle has 3 parts, and then and audio source. My pool contains 6 prefabs, because no more than 5 are ever needed at one time (I put one more in there just in case.). Once the obstacle is off screen, it is added back to the pool. So my question, is it better (in this case) to have basically everything follow the player, (camera follow player, everything attached to camera); and my obstacles are stationary. OR should I let everything else be static, and have the obstacles, once they are active, move toward the player at some velocity? Sorry for the long question.

Viewing all articles
Browse latest Browse all 536

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>