Spherical Gravity and the End of Time Bandits

Posted By: Anonymous

Spherical Gravity and the End of Time Bandits - 11/01/03 05:40

Has anyone tried to script gravity based on a sphere shaped planet as oppose to a flat plane? This doesn't seem too hard, and would make sense in any fantasy based environment as it would allow the user to walk across the entirety of a planet instead of running into invisible barriers (as in Terry Gilliam's Time Bandits).


Posted By: fastlane69

Re: Spherical Gravity and the End of Time Bandits - 11/01/03 06:28

I've toyed around with the idea, but scripting gravity manually, even "linear" gravity, seems to foul up the Physics Engine. I've had problems with the Physics engine and constant contact (ie standing on the ground)

In one test, I set the PE gravity to zero and added centralforces to my entity to emulate gravity. The MOVEMENT was flawless and looked good BUT upon collision with the ground, the entity seemed to have the "shakes". My explenation is that that something about the contact point(s) on the gound makes the entitys slightly unstable which would normally not be a problem, but since the PE is still applying the central force (gravity), these instabilites lead to the shakes.

I'm guessing that using more than just one force spread on an entity (instead of one central force tugging at your center of gravity) and/or adjusting the entity geometry by attaching extra, dummy entities as stabilizing blocks might help, but I don't know.

In principle, if you can resolve the constant contact problem with the ground, there is no reason why you can't build a LARGE sphere and have accurate gravity.
Posted By: Doug

Re: Spherical Gravity and the End of Time Bandits - 11/04/03 06:36

Coding the physics wouldn't be too hard, but editing "spherical levels" would be tricky at best. Each item would have to be rotated according to its placement in the world. And, unless the level was very big (i.e. Earth size) the visible curve would be very noticeable (cool looking, but probably not what you want).

The good news it, you don't need to make your world spherical in order for it to behave that way. If your world is large enough you can split it into sections (either levels or a "treadmill"of map entities). Each section can be flat. When the player exits one part of your world they will enter another part (i.e. using level load). You can link these levels into a loop so, when the player leaves the left side of level 'A' the will enter on the right side of level 'B', when they leave the left side of level 'B' they enter back on the right side of level 'A'.
Posted By: Anonymous

Re: Spherical Gravity and the End of Time Bandits - 11/04/03 08:32

Interesting,

That kind of reminds me of Morrowind, those transitions were really well done.

Thanks,
Posted By: fastlane69

Re: Spherical Gravity and the End of Time Bandits - 11/05/03 12:33

Doug, using the PE, couldn't you use a modified slider contraint conecting the center of the planet with the bottom of a person?

Wouldn't this automatically take care of orientaion
Posted By: Doug

Re: Spherical Gravity and the End of Time Bandits - 11/06/03 07:04

Maybe, with some slight modifications to the physics engine, but I think this falls into the region of "overkill".

A big enough world (like Earth or even the Moon) behaves like a flat world in all but the extreme cases.
Posted By: Marco_Grubert

Re: Spherical Gravity and the End of Time Bandits - 11/06/03 09:28

You could do a ball+slider constraint which tries to keep an object on a sphere at a certain radius. This method however does not guarantee constant acceleration as would be required for gravity.
Posted By: fastlane69

Re: Spherical Gravity and the End of Time Bandits - 11/06/03 13:06

Manually adding a mass dependent force always in the direction of the contraint would solve the constant accel issue.

Doesn't feel like overkill....
Posted By: Doug

Re: Spherical Gravity and the End of Time Bandits - 11/07/03 03:25

It isn't overkill for one object, but I was thinking back to the editing issue. Everything (cars, houses, walls, trees, mailboxes) would have to be rotated depending on it's place in the level. You could make everything a physical object, but that would be overkill.
Posted By: fastlane69

Re: Spherical Gravity and the End of Time Bandits - 11/07/03 07:49

Ahhh, yeah I was thinking from an individual point of view.

If only the PC's are physical it's not overkill (hint hint can be done). But if you want the whole damn mess to be physical, shoot, even the Havok engine might complain!!!

Posted By: Teelo888

Re: Spherical Gravity and the End of Time Bandits - 02/17/04 05:49

I would REALLY like to know how to set the gravity inside of a sphere, that would be so freaking cool... fastlane do you think you could post up how you did it? It would be much appreciated!
Posted By: fastlane69

Re: Spherical Gravity and the End of Time Bandits - 02/17/04 09:38

inside a sphere?
-Gravity inside a hollow sphere is zero.
-Gravity at a certain radius inside a solid sphere depends on how much mass is contained within that radius.

In order to set Gravity in spheres in such, it's best to think in spherical coordiantes (rho, theta, phi). In this case, gravity will be constant in (theta, phi) and have the classic 1/(rho) squared behaiviour. Now you can convert this to Cartesian Coordinates to align them with the levels absolute coordinate

Posted By: Teelo888

Re: Spherical Gravity and the End of Time Bandits - 02/17/04 12:43

ummmmmmm, im really sorry but i didnt really catch much of that... I just would like to know how to make a sphere(a planet) on a game pull objects in twards it, much like earth, so you could just run around it and what-not. Me and my friends are making a game and we would like to know how to do that.
Posted By: fastlane69

Re: Spherical Gravity and the End of Time Bandits - 02/17/04 12:50

Hate to burst your bubble but making a spherical world will be challenging even without messing with these levels of maths. If the above doesn't make sense to you, you may be a bit over your head as regards a spherical environment.

Long story short, there is no quick and easy way to do this in 3DGS that I'm aware of. It can be done I think, but would require alot of coordiante transformation work and thus if you aren't comfortable with sperical, polar, and cartesian coordinate, then my advice is to "fake" the spherical world as has been suggested.

Posted By: Teelo888

Re: Spherical Gravity and the End of Time Bandits - 02/17/04 13:58

Ok man, thanks for your help, lol if you want to, you can add me to your msn or aim list. My name on aim is teelo888 and the msn email address is teelo888@msn.com. Hopefully you can help me with some other problems im having, if you cant, thats ok too.
Posted By: fastlane69

Re: Spherical Gravity and the End of Time Bandits - 02/17/04 14:09

Not big into the IM scene.
Just come by and ask here in the forums anytime you want!!
We'll be here!!


© 2024 lite-C Forums