It is currently Fri Dec 06, 2013 12:06 pm

 All times are UTC

 Page 1 of 1 [ 5 posts ]
 Print view Previous topic | Next topic
Author Message
 Post subject: Physics with variable gravityPosted: Tue Oct 12, 2010 5:45 am
 Rookie

Joined: Tue Oct 12, 2010 5:32 am
Posts: 2
Sorry about the length! It's late, and I get quite verbose when I get tired.

I am thinking about making a game which would, at least in part, take place on a space station. In my opinion, the best way to create an artificial gravity for this would be to have the station rotate. I would like to know if it is possible to find a physics engine that would allow for gravity of varying strength (less as the player approaches the center of rotation) to pull in a changing direction (directly away from the axis of rotation). The ideal situation would include real-time calculations, so the player would be able to jump across the center of the station and land on the opposite side of the room. I have seen some suggestions elsewhere recommending that, essentially, a constant gravity be used and just changing the direction of the force, but I would really like to have a more realistic system. The closest I have found is a suggestion of using a cylindrical force field with a calculated falloff, but I have no idea what engine(s) would be able to to that. Does anyone know of anything that would let me do anything with this? Thanks!

Top

 Post subject: Posted: Tue Oct 12, 2010 12:25 pm
 Corpse Bride

Joined: Tue Jul 01, 2008 11:44 pm
Posts: 2221
Location: England

The artificial gravity of rotating things isn't as simple as a force pointing outward (centrifugal force). There is a coriollis force too, which is felt as things move radially in or out. If you have things jumping across the station, the coriolis force becomes rather important.

Constant gravity is with a vector (0, 0, -g), where g is the force of gravity.

When we're dealing with central force fields from rotating frames of reference, we first derive this equation for acceleration:

The r.Ã

_________________
I ain't pushing no moon buttons.

Top

 Post subject: Posted: Tue Oct 12, 2010 2:29 pm
 Game Programming Guru

Joined: Sun Aug 15, 2004 6:20 pm
Posts: 1091
Your physics engine should allow you to apply your own forces. You can turn off the engine's default typical gravity and instead apply your own gravity force to each object during every physics step.

_________________
Heard in #gpwiki: <wzl> is there some serious grammar fail in your line or am i just too intelligent for your logic

Top

 Post subject: Posted: Wed Oct 13, 2010 1:35 am
 Rookie

Joined: Tue Oct 12, 2010 5:32 am
Posts: 2
Thanks for the help!

Jasmine: I was forgetting about the effect of moving laterally. Thanks for the equation and the pointers; I'll try to work them in!

sdw: I haven't even gotten that far, yet. Once I get out of the planning stage, though, I'll make sure that whatever engine I use will allow me to create custom fields. It's nice to know that it shouldn't be to difficult to find.

Top

 Post subject: Posted: Wed Oct 13, 2010 7:39 pm
 Level 22 Norse Warrior-Librarian

Joined: Mon Sep 04, 2006 5:25 pm
Posts: 517
Location: U.S.
This sort of thing can get kind of complicated, or so I hear, but I think in your situation it shouldn't be too bad, since you only want one source of variable gravity. I believe the people who made Prey built their own engine, in part because they wanted to be able to have several sources of gravity acting on things at the same time.

As Jasmine and sdw said, your best bet is probably going to be to turn off the default gravity and calculate it yourself. If you look in the internals of most physics engines, all they do for gravity is just loop through every object and add a downward force, every frame. Some physics engines don't even have functions for gravity, as it's considered to be an unnecessary bloat to the code

_________________
Worlds at War (Current Project) - http://www.awkward-games.com
Ganadu'r, The Eternal Sage (Other Current Project) - http://rpg.naget.com
Programming tutorials and web-design services: http://www.wyrmmage.com

Top

 Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending
 Page 1 of 1 [ 5 posts ]

 All times are UTC

#### Who is online

Users browsing this forum: No registered users and 2 guests

 You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forum

Search for:
 Jump to:  Select a forum ------------------ Forums    Forum Rules and Posting Guidelines Wiki Discussion    Help    Content Issues Game Programming Discussion    C and C++ Game Programming    Java Game Programming    Language Agnostic Programming    .NET Game Programming    VB Game Programming    Mobile Game Programming    Web-Based Game Programming    Other Languages    OpenGL Development    Direct X Development Game Development Discussion    Game Design    Game Media Off-Topic Discussion    Announcements    Off-Topic    Community Projects    News