Disable Gravity for a specific object

does any1 know if there is a python function like setGravity but only for a specific object.
I need to set it up individually for cockroaches climbing walls and objects

oh yeah and suspend dynamic will not help because i still need to use collisions when they are climbing.

You can add an upward force equal to 9.8 to the objects, only when necessary - that will counteract gravity.

9.8 * mass of the cockroache that is.

Oh, yeah. That’s right - sorry about that.

Ah i just tried adding value to his dLoc. but i guess force works better.

but now I’m wondering, If the cockroach is climbing for example, and he is going up on his local forward dLoc movement. When I apply a force world value, does it only neutralize the gravity or will it also accelarate the current forward(up) movement.

because if he don’t move it seems fine, he is not falling, but staying sticky on the wall.
but when i apply a movement it seems now like maybe he is getting too fast

I can post an example, if it’s not clear…

I also noticed that i could give value 1 for damping translation. but, is it possible to access it through python?

dLoc is a teleport not a movement! You might get these sideeffects.

A constant force against the gravity should not effect the other speeds. Keep in mind the force must be gravity*mass.

Some more small notes:

You might want to produce a fake gravity towards the wall/roof/floor/whatever the cockroach sits on. So it ‘sticks’. Find the face normal and make a force towards the face and add that force to the ‘antigravity’ force then apply it.

Best to use velocity to control movement - because it will not interfere with the antigravity force. If You want to use force for movement You have to do everything in the movement script and apply movmentforce+stickforce+antigravityforce in one go - because only the last applied force matters.

well, I’m actually using now distance constraint for the stickiness, activated when ray-ground-sensor is true.

but maybe your solution can also be helpfull, i’ll try to give it a go as well.

What about:


xSpeed, ySpeed, zSpeed = obj.getLinearVelocity(True)
obj.setLinearVelocity((xSpeed,ySpeed,0),True)

That’s what I like to use, then I can have direct control over the objects movement on it’s local axis’ by adding or subtracting to xSpeed, ySpeed, or zSpeed before set.

actually
force = gravity * mass
was working out good for me.
Thanks for all the help