Hey All,
I’m creating a 3d space-game. I need a way to wrap space around itself. Here’s the idea:
The universe I made now is a perfect cube (let’s say 500 by 500) when your spaceship exceeds one edge of the universe (say, x = 501), it is automatically placed in the other side (x = -500), preserving orientation and velocity. This is great except for one huge problem:
The camera is a child of the space ship. When the camera is toward the edge of the universe looking outward, it sees nothing but empty space. Then, the moment it warps around, it sees all sorts of content instantly pop into view. Observe:
= spaceship facing right
X = content
| = universe border
|XXXXXXX>XXXXXX| ship is in the middle of the universe and sees content in the direction its facing
|XXXXXXXXXXXXX>| ship approaches edge of the universe and sees no content
|>XXXXXXXXXXXXX| ship warps around and suddenly sees tons of content
Though the programming is smooth, the visual experience is actually really disorienting. The easy way to solve this problem in two dimensions would be to use the third dimension: For example, I could make a 2d character run towards the right around a pole on the y-axis and film it in such a way that the 2d character looks like he’s running in one straight line, but he actually winds up where he started.
Does anyone have any ideas of how I could do this in three dimensions?
Before anyone talks about simulating this, yes, I’ve thought about using multiple cameras. There are some serious problems with that (specifically, that solution would only work on one axis and only if the camera is facing the same way the ship is moving). Also, it can only simulate what it is that I’m really trying to do. I’ve also thought of warping the universe around the player instead, but as I intend to make this a multi-player game, that can’t work (there would also be a lot of processor problems). Any thoughts?
Thanks,
Vincent