Sphereical earth
Sphereical earth
This is just a theoretical question:
How would I (If it is possible) create an earth-like simulation,
I.e - Whereever you walk it would seem to you that you are rightsideup,
so that all objects would be attracted to the center of the earth,
Basically changing everything from the traditional plane- to sphere-
How would I (If it is possible) create an earth-like simulation,
I.e - Whereever you walk it would seem to you that you are rightsideup,
so that all objects would be attracted to the center of the earth,
Basically changing everything from the traditional plane- to sphere-
I have recently discovered that both the Flu and my Algebra teacher have exact the same effect on my health: it quickly degrades.
-
- Posts: 275
- Joined: Fri May 12, 2006 6:37 pm
- Location: Germany
f32's have 23 bits worth of value, 1 bit of sign, and 8 bits of scale, so you have 8 million whole numbers to play with in any direction at any given scale.
the radius of the earth is 6300 km, so you've only got accuracy to around a metre.
so, you'll need to work out a new coordinate system before you can attempt an earth sized map.
the radius of the earth is 6300 km, so you've only got accuracy to around a metre.
so, you'll need to work out a new coordinate system before you can attempt an earth sized map.
-
- Admin
- Posts: 14143
- Joined: Wed Apr 19, 2006 9:20 pm
- Location: Oldenburg(Oldb), Germany
- Contact:
Hmm, I thought that it was a question of how to make a world feel like it was a real (and thus large) planet. Which can be achieved by simply doing everything on a plane and just tell others that it's a sphere. Because on each place the gravity is straight down and you can move on two axes there is no difference. Only some effects which might occur with long distance views could be hard to model.
Maybe you should give a better description of your problem as everyone seems to understand this question different.
Maybe you should give a better description of your problem as everyone seems to understand this question different.
-
- Posts: 275
- Joined: Fri May 12, 2006 6:37 pm
- Location: Germany
I want to make a world where everything radiates from the center, to be able to walk completely around the world going in any direction... Just to do simulation of what is happening in the real world: The world is a sphere and everything radiates from the center of it.
Hopefully you can understand that...
Hopefully you can understand that...
I have recently discovered that both the Flu and my Algebra teacher have exact the same effect on my health: it quickly degrades.
Hehe, you mean like Populous 3 or Magic Carpet, right? Yeah, you need to know a lot of math and geometry to be able to do this.
If you just want to walk around on it, it shouldn't be too difficult, but it's a lot of trigonometry. Whenever a node moves, calculate its change in position as you would in 2D, then calculate the length of this vector. Now you're mapping this manifold onto a spherical surface, so first convert the 3D original position of the node into spherical coordinates, then take the length of the 2D vector as an arc-length and convert that to an angle change. Now decompose that angle change into polar and azimuthal components, then add those angle changes to the spherical coordinates and project it back into 3D space. And finally rotate the node using the new spherical coordinates so that its feet lie properly on the surface.
It's probably easiest if you cache the spherical coordinates for all objects (you only need to cache the polar and azimuthal components; assuming you have elevation changes, the radial component will need to be recalculated anyway). This way you can write all movement speeds in angles instead of normal motion, so you'd only need to project things one way.
If you want to align a grid to the sphere so you can build buildings and things, well that's a heck of a lot more complicated. You need to tesellate the world into an geosphere, find a polygon grouping that completely subdivides the sphere into quads, figure out some indexing method...
If you just want to walk around on it, it shouldn't be too difficult, but it's a lot of trigonometry. Whenever a node moves, calculate its change in position as you would in 2D, then calculate the length of this vector. Now you're mapping this manifold onto a spherical surface, so first convert the 3D original position of the node into spherical coordinates, then take the length of the 2D vector as an arc-length and convert that to an angle change. Now decompose that angle change into polar and azimuthal components, then add those angle changes to the spherical coordinates and project it back into 3D space. And finally rotate the node using the new spherical coordinates so that its feet lie properly on the surface.
It's probably easiest if you cache the spherical coordinates for all objects (you only need to cache the polar and azimuthal components; assuming you have elevation changes, the radial component will need to be recalculated anyway). This way you can write all movement speeds in angles instead of normal motion, so you'd only need to project things one way.
If you want to align a grid to the sphere so you can build buildings and things, well that's a heck of a lot more complicated. You need to tesellate the world into an geosphere, find a polygon grouping that completely subdivides the sphere into quads, figure out some indexing method...
You may want to take a look at the post here by AutoDMC -- http://irrlicht.sourceforge.net/phpBB2/ ... ght=#37288 -- I have done sphereical worlds in one of my projects using this method and it should work just fine for you if I am understanding what you want correctly.