# Disable gravity for a single dynamic object in the BGE?

I have a sphere which I use to restore dynamics on objects it collides with (by expanding to cover the shards over the course of the animation); the collided objects are "shards" of a crystal, and the sphere is a ghost so it does not affect any part of the crystals except the state of their dynamics. I have a collision node set to detect collisions with the material of the sphere, but that requires it to be a dynamic object.

I need to make the sphere unaffected by gravity during physics simulation, since there is no way to set the mass to zero, and collisions will not be detected with static objects.

This question has a similar problem, but setting the sphere to a character simply made it glitch out and not expand correctly.

• To lock rigid bodies/dynamic bodies in place you could use rigid body joints or use "Lock Translation" in the physics panel. Interestingly you cant lock dynamic bodies with the latter which looks like a bug. But a rigid body joint (generic 6 DoF) should work in both cases. Since "no gravity" and locking something in place is something different let me know if this is a solution for you. May 9 '14 at 7:10
• Tried that one too but it just didn't like it. Also, the sphere's animation requires moving along the z-axis slightly, so even if it did lock it might not work. May 9 '14 at 8:01
• You could also parent it to a no collision object (without any constraint). May 9 '14 at 9:11

## 2 Answers

In order to make an object "not have" gravity, you can move the object up at the same speed gravity pulls it down.

Connect an Always sensor to an And controller and this last one to a Motion actuator, with a value of 9.8 * mass (where mass is the value for Mass, set in the Physics tab of the Properties window) for the Z axis.

• In the future, please explain your answers better and use images if relevant; see my edit and make your answers in that general format. Mar 8 '15 at 0:45
• Sure thing, I will snap a screen shot or use a paragraph? Mar 8 '15 at 1:03
• I found a workaround a while ago, but I tried this just now and it worked too. Mar 10 '15 at 23:23

Or you can just take the easy way out, and move your objects along the Z axis as well as the Y and X ones too, giving the ¨Zero Gravity" effect.

This is also great for making a space themed game, easy and fast! :D