
The main problem of infinite movement will be the Unity coordinate space, which tied to variables of the float type, and accuracy will decrease with increasing coordinates. You can throw away obvious things with limited background sizes, which in any case, have to be solved. The first thing that comes to mind when someone asks you to make a ship that moves in space is to add a ship model, set a speed vector for it, attach a camera, put a background, and start moving the ship along the vector multiplied by ltaTime. As an example, let’s implement a model of a spaceship that moves across an infinite outer space background. In our case, we will complicate the task a bit and try to make an endless background for the top-down camera.

If you search the Internet for information on endless spaces for Unity, then one of the most popular tutorials will be about the creation of infinite background objects for sidescrollers. With this post, we open aĬycle in which we consider the elements that will help create such infinite worlds. Infinite movement implies infinite space available for the player’s movement, the creation of which is not an easy task, as it might seem at first glance. The main feature of this genre is an infinitely moving element (character or another object), which usually independently moves forward towards obstacles, and control is given only to avoid these obstacles. If you used public transport, you might have noticed that one of the most popular mobile game genres between passengers is the Endless runners, for example, Subway Surfers. I went on to make a number of tweaks to get things more situated and there's still a ways to go but at least this is big progress.In this post, we will look at how you can apply the Dark Matter Engine approach to create an infinite 2D background. Y = Mathf.Sin(phi) * Mathf.Sin(theta) * ER Īfter adding shader. X = Mathf.Sin(phi) * Mathf.Cos(theta) * ER position for 3d tiles phi = keyY / ti * pi
#Unity screen wrap tiles code#
I modified to the code to look like so: // convenience helpers ti = tilesInfo // basically the amount of tiles across either axis ti2 = ti / 2 The code that helped me the most was found with a question about generating a sphere in python. Now I'm stuck on the correct rotation of the tiles.
#Unity screen wrap tiles how to#
I've figured out how to get the tile position correct.

I'm mostly using Mathf.Sin and Mathf.Cos to figure out position & rotation so far.y axis 0 is the bottom of the globe while y axis 15 is the top.in the attached screenshot I'm at zoom level 4 (64 tiles).Using just the TMS coordinates of my tile (0,0 - 63,63) how can I calculate the tile's xyz "earth" position as well as its xyz rotation?

I'm trying to turn a downloaded tile's x,y coordinates (2d) into a 3d position & rotation.I have to load / unload tiles for memory management as level 10 can receive over 1 million 512x512 tiles.I'm using the angle of Camera.main to figure out which tiles should be viewed at any moment (seems to be working fine).

Currently I'm using tile x,y to try and figure out where the tile should appear on my earth "sphere" and it's becoming quite tedious, I assume because of the differences between Euler angles and quaternions. So far I'm able to load in all the TMS tiles based on their x & y coordinates and zoom level. New tiles are asynchronously loaded in from the web while a user pans the camera around the globe. I'm using unity c# to re-invent a google-earth like experience as a project.
