# surface gravity question

**URL:** <https://blenderartists.org/t/surface-gravity-question/561629>\
**Category:** Game Engine Support and Discussion\
**Created:** [January 6, 2013, 11:32pm UTC](https://blenderartists.org/t/surface-gravity-question/561629 "2013-01-06T23:32:33Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![ehabcharek](https://blenderartists.org/user_avatar/blenderartists.org/ehabcharek/32/18469_2.png) [@ehabcharek](https://blenderartists.org/u/ehabcharek)\
**Post date:** [January 6, 2013, 11:32pm UTC](https://blenderartists.org/t/surface-gravity-question/561629/1 "2013-01-06T23:32:33Z")

</div>

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](http://static.gamesradar.com/images/mb/GamesRadar/us/Games/S/Super%20Mario%20Galaxy%202/Everything%20Else/A-Z%20of%20Super%20Mario%20Galaxy/WII49.pre_galaxy.gr_11--article_image.jpg). 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?

---

<div class="post-metadata">

**Author:** ![agoose77](https://blenderartists.org/user_avatar/blenderartists.org/agoose77/32/442949_2.png) [@agoose77](https://blenderartists.org/u/agoose77)\
**Post date:** [January 7, 2013, 12:19am UTC](https://blenderartists.org/t/surface-gravity-question/561629/2 "2013-01-07T00:19:35Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![ehabcharek](https://blenderartists.org/user_avatar/blenderartists.org/ehabcharek/32/18469_2.png) [@ehabcharek](https://blenderartists.org/u/ehabcharek)\
**Post date:** [January 7, 2013, 1:42am UTC](https://blenderartists.org/t/surface-gravity-question/561629/3 "2013-01-07T01:42:13Z")

</div>

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 😛

---

<div class="post-metadata">

**Author:** ![ehabcharek](https://blenderartists.org/user_avatar/blenderartists.org/ehabcharek/32/18469_2.png) [@ehabcharek](https://blenderartists.org/u/ehabcharek)\
**Post date:** [January 7, 2013, 10:45pm UTC](https://blenderartists.org/t/surface-gravity-question/561629/4 "2013-01-07T22:45:49Z")

</div>

it says

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

```

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

---

<div class="post-metadata">

**Author:** ![BluePrintRandom](https://blenderartists.org/user_avatar/blenderartists.org/blueprintrandom/32/598195_2.png) [@BluePrintRandom](https://blenderartists.org/u/BluePrintRandom)\
**Post date:** [January 7, 2013, 10:45pm UTC](https://blenderartists.org/t/surface-gravity-question/561629/5 "2013-01-07T22:45:53Z")

</div>

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

[http://www.pasteall.org/blend/18711](http://www.pasteall.org/blend/18711)  
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.

---

<div class="post-metadata">

**Author:** ![ehabcharek](https://blenderartists.org/user_avatar/blenderartists.org/ehabcharek/32/18469_2.png) [@ehabcharek](https://blenderartists.org/u/ehabcharek)\
**Post date:** [January 7, 2013, 11:22pm UTC](https://blenderartists.org/t/surface-gravity-question/561629/6 "2013-01-07T23:22:35Z")

</div>

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](https://www.youtube.com/watch?v=xeH5F6JoKfQ) (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?!

---

<div class="post-metadata">

**Author:** ![BluePrintRandom](https://blenderartists.org/user_avatar/blenderartists.org/blueprintrandom/32/598195_2.png) [@BluePrintRandom](https://blenderartists.org/u/BluePrintRandom)\
**Post date:** [January 7, 2013, 11:27pm UTC](https://blenderartists.org/t/surface-gravity-question/561629/7 "2013-01-07T23:27:21Z")

</div>

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 🙂

---

<div class="post-metadata">

**Author:** ![BluePrintRandom](https://blenderartists.org/user_avatar/blenderartists.org/blueprintrandom/32/598195_2.png) [@BluePrintRandom](https://blenderartists.org/u/BluePrintRandom)\
**Post date:** [January 7, 2013, 11:47pm UTC](https://blenderartists.org/t/surface-gravity-question/561629/8 "2013-01-07T23:47:48Z")

</div>

Here we go,  
here is what you need my friend 🙂

### Attachments

[Example.blend](https://blenderartists.org/uploads/default/original/3X/1/f/1f90534581c8213b6ad6367fc93d775a424d3a34.blend) (476 KB)
