surface gravity question

Hello guys
I have ANOTHER question! (sorry :P)
ok, so I know that you can change the gravity so that you can walk on a spherical world, or a planet. However, the problem with that is the center of the sphere is actually being the gravity source, so if you want to make the planet flat, like a plane, all the objects in the scene would be attracted to only the center of the plane, or if you want to move, let’s say, inside a planet/ball like in the game Super Mario Galaxy. SO! here is my question; is there a way to make each polygon the source of the gravity? or if there is another way to fix this problem?

If you apply gravity locally you can. Take the position of the object and apply a world space vector of - 9.81 (force) in the direction of the normal or the plane.

I’m not really good at python, I know a little bit of java, but you use WorldPosition, right? (obviously, I am not familliar with the API either) a .blend file explaining it would be GREATLY appreciated :stuck_out_tongue:

it says

down_vec = Vector(obj.getVectTo(own)[1])

how do I change the “own”? to the normal of the surface?

here you go
On collision “Planet” -------and apply force on a static ghost/invisible object
do you want orbit style gravity? I can do that as well, with Sdgeoff’s code+ an idea of mine
Here is a game that is about 40% done
feel free to inspect and learn, but don’t share without naming me as the orig author etc.

hello BluePrintRandom, I checked out your blend file but I could not understand how you did it. Also, it seems like your system does not work with planes either :c. If you can explain it that would be super great!
the blend file that I am using is the one provided by Goran (for the current time, of course) but I cannot get the “world space vector” that agoose77 mentioned to work. I searched the BGE API and I found getVectTo which might be what I am looking for, but I can’t figure out how to use it XD
help, please?!

Just under feet, make a block that is parented to model that collides with ground, but is ghost
Logic nodes
Collision with property “Level”---------and----------Motion <0,0,-9.8> Local

Add property “Level” to plane :slight_smile:

Here we go,
here is what you need my friend :slight_smile:


Example.blend (476 KB)