# Changing Gravity Direction in BGE

Hello Guys,

I’ve been working on a bender game in my spare time to improve my python & other skills.
Its a little 3rd person game based on one of my favourite games, Ratchet & Clank.

So i was wondering if there is a way i can change the direction of gravity as done in RAC, to walk up the hexagon walls.

here are some images of my base level (hexagon platforms are the gravity direction i need).
http://imageshack.us/photo/my-images/703/hbnm.png/
http://imageshack.us/photo/my-images/692/qgxm.png/

Matt Beker

Yes. Look up planetary gravity. Goran has a good tutorial on this. This basically sets the direction of gravity to the origin if I remember correctly but you can just as easily have it set to an empty. Then you will just need to have a trigger that sets which empty to use as the direction of gravity.

The latter part being the hardest I think. Hard to make it smooth but not impossible.

Planetary Gravity Tutorial

ok, to eliminate gravity, turn it off in the scene settings,

then

Always apply force 9.8 *mass in alignment with the direction of gravity,

you can use track to + apply force to do a nice “gravitational body system” but it only works with spheres.

See the BGE API -> setGravity()

Here is normal gravity

cHECK IT yOUr sELF bEfOrE YOU wreckt yourself

### Attachments

Fixed (1).blend (445 KB)

Bump
bump
bump

If you want to affect the main character only I’d go for a strong local linear velocity in -z direction on your player like in this spider example on blendswap:

If that’s all you have for your base level- then it’s way too hi-poly. The hexagons can easily be faked with texture maps- same way insomniac does it. I mean 75,000 verts? And you want to push animation, logic, and lighting? At the same time…
Yeah, just use texture maps. A handy way of seeing if extra geometry is useful or not is by looking at its silhouette.

Maybe this may be helpful too: Normal_gravity_08.blend (105 KB)