Gravity issues

I’m trying to make a simple space game so at to familiarize myself with the BGE a bit more.
At the moment, all I have is a few planets (=spheres) and Susane. I’m having real trouble achieving something which at first I thought would be elementary but it turns out that it isn’t.
I’ve set the planets to be dynamic objects and of course when the game starts they fall and fall…and fall (hence gravity in the title). To get around this I have set them to be static physics objects and they fall no more. But then when Susane moves around the 3d space she simply passes through the sphere mesh which is kind of cool but ugly. If I change Susan’s physics type to dynamic or soft body she also drops due to gravity so that’s a no go.

It occurred to me to remove all gravity acceleration so I set gravity settings to zero. That worked in the sense that none of the objects (Susan, planets) fell any more. But when Susan collided with any of the planets she behaved as she was kicked real hard and pushed back in a spinning fashion. Again, the result was very ugly.
I’m sure there is a pretty logical explanation for this and I’m really looking forward to learning it.

So my questions to all of you BGE gurus out there:
(a) why is this happening? What am I missing here?
(b) what is the optimal way of designing such a space environment so as to handle gravity and spaceship movement(s)?

Any tips/pointers will be greatly appreciated.

Well you could try messing with the movement and rotation dampening on the physics tab located on the property panel. Also there is a force field setting in the material tab (enable material physics) wich can add force to objects if they collide . Things to consider.

spaceships usually move and do not teleport ;).

Therefore use Forces or Velocity rather then changing Loc. You might even have a look at the servo motion.

In space you usually do not have much gravity. So it it fine to set it to zero.

If you are able to collide suzanne with planets, the planets are just some balls. Planets are HUGE. They wouldn’t even recognize the impact of little suzanne :D. Balls do ;).

Like Redikann and Monster have said, do the following:

Set global (as in the game world) gravity to 0 as Monster suggests. This means all physics enabled objects will sit wherever you place them until a force acts on them.

Each smaller object must be set to dynamic or rigid body (such as spaceships) as they will then drift as they move forward in a different direction (as you would do in space).

Set planets to static- if you think about it, planets are massive in comparison to most fictional spaceships, so there is no benefit to having them set to dynamic or rigid body. Also set any planets collision hull to best accommodate its shape. Anyway, here is a blend that shows all that:

Controls are cursor keys to go up, down, left and right. Space thrusts forward. You can play with the settings to make the ship turn faster/ slower too.

Hope it helps.



space.blend (459 KB)

Hey folks, many thanx for the informative responses.

@Monster: if there’s one thing I like more than a good response is a good response with humor! :slight_smile:
I still haven’t got used to the fact that teleporting means travelling through the mesh of the object.
You’re also right in that the scale of the planets was not correct, they were bigger than Susan (spaceship prop) but not much. After the collision the planets did not move (static objects) but Susan did!

@Paul: thank you for the blend file and for explaining the rationale behind it.
Drifting might be realistic for space movement but I don’t really like it that much.
I couldn’t really navigate the ship using your default controls so I tried to tweak them a bit. I also parented a camera on the back of the spaceship to have a first person view and things got even worse navigation-wise.
Perhaps I need to consider other control options. Do you think that mouse-based control should be more fitting for this type of spaceship control?

What sort of controls were you thinking of? Something like this?

This control setup uses what Monster suggested: servo control. Its slightly more complicated to setup and understand (if in doubt look at the many references on Google. Essentially what servo controls do is allow you to define the maximum force needed to go forwards in that axis (on the logic brick look at the linear velocity setting). Below this you have minimum and maximum settings. These control the acceleration to the maximum linear speed set before.

Note that this thrust is set for the x axis only! The great thing about servo control is you can disable an axis (such as with this demo)- this allows the spaceship to thrust forward at the same rate without drifting as the y and z axis is disabled. Do note that once you stop pressing space you do drift!

Controls: THRUST = SPACE
Cursor Up- pitch up
Cursor Down - pitch down

PS: do check the manual for servo control… Its been a while since I talked about how it works so what I say may be a bit innacurate:o

Hope this helps!



space 2.blend (469 KB)

Gee, after several days I finally got down to it and it worked as expected! :slight_smile:
I’ve also made some “improvements” based on your proposed model in the unlikely event that anyone ever needs something like this.

Many thanx Paul!


space 2.blend (1020 KB)