Gravity

I’m wanting the gravity to have less effect on one item and for everything else to have the set world gravity. How would I do this?

Afaik, the Bullet physics engine does not provide such an option for game objects within the BGE.

However, you can set global gravity to zero, and then simply apply a proper downward force for each object in question. The simple script for that would look like this:


import GameLogic as GL 
scene = GL.getCurrentScene() 
 
for obj in scene.objects: 
    if "gravity" in obj: 
        obj.applyForce([0, 0, obj["gravity"]]) 
    else: 
        obj.applyForce([0, 0, -9.8])

So, to change the gravity forces that act on individual objects, you just add a float property and set it to whatever value you want (positive numbers would make the objects fly upward), smaller (in absolute terms) negative values (like -1) would make the object fall slower.

Example attached:

Attachments

custom_grav.blend (138 KB)

A Simpler solution would be for the one object you want lighter to have a constant force being applied on the +Z axis.

Thanks Social that did the trick