Sphereical earth

Discuss about anything related to the Irrlicht Engine, or read announcements about any significant features or usage changes.
Post Reply
RustyNail
Posts: 168
Joined: Fri Jun 02, 2006 1:49 pm
Contact:

Sphereical earth

Post by RustyNail »

:roll: 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-
:?: :?:
I have recently discovered that both the Flu and my Algebra teacher have exact the same effect on my health: it quickly degrades.
TheGameMaker
Posts: 275
Joined: Fri May 12, 2006 6:37 pm
Location: Germany

Post by TheGameMaker »

offcurse its possible.... yous do your gravetie vector from
vector(0,grav,0)

to

vector(earthCenter-ObjPos);
vector.Normalize;
vector*grav

that easy....but you would hav to mak your objekts stuck on the planet the right way etc....
bitplane
Admin
Posts: 3204
Joined: Mon Mar 28, 2005 3:45 am
Location: England
Contact:

Post by bitplane »

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.
Submit bugs/patches to the tracker!
Need help right now? Visit the chat room
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

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.
TheGameMaker
Posts: 275
Joined: Fri May 12, 2006 6:37 pm
Location: Germany

Post by TheGameMaker »

i think he means something like the samll asteraid in the Pray demo....
Quall
Posts: 154
Joined: Mon Mar 07, 2005 10:16 pm

Post by Quall »

Prey is the Shiznit

Except you don't get a story.
RustyNail
Posts: 168
Joined: Fri Jun 02, 2006 1:49 pm
Contact:

Post by RustyNail »

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.
:oops: 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.
Vuen
Posts: 25
Joined: Tue Jul 11, 2006 8:03 am

Post by Vuen »

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...
sh1ny
Posts: 21
Joined: Mon Jul 17, 2006 6:21 pm

Post by sh1ny »

He also has to figure when to eat and stuff, rrright ? :shock:
AlexL
Posts: 184
Joined: Tue Mar 02, 2004 6:06 pm
Location: Washington State

Post by AlexL »

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.
RustyNail
Posts: 168
Joined: Fri Jun 02, 2006 1:49 pm
Contact:

Post by RustyNail »

:roll: Ouch.... Seems too hard for me... :(
Need...more.......education...
I have recently discovered that both the Flu and my Algebra teacher have exact the same effect on my health: it quickly degrades.
Post Reply