# Making an object "float" (like a floating rock)

Hi all!
Anyone seen any examples of floating physics. Like a rock that is floating in space, but that when a character jumps on it, it reacts like someone has jumped on it in space. Eg: it moves down a bit and restabilizes to its original position.

I realize there’s no such thing as floating rocks, so maybe this kind of thing doesn’t exist in a physics engine? But maybe a balloon that is floating up - and will react to a pulse on its way up?

I only see global gravity in PG examples - like this one, where its possible to set gravity on the world (so everything can float), but not for an individual object - where just a balloon or individual rock might float. (negative mass doesn’t seem to do anything). Ideas?

`physicsEngine.setGravity(new BABYLON.Vector3(gx, 1, gz));`

The difference between a rock in space and a rock on earth is gravity. There are other forces that are considered neglictable like pressure of air. In movement, the air pressure becomes more visible (called damping in physics engine). This also can be emulated with a force in counter direction.
low density gas filled balloon move up compared to higher density gas balloon. This is emulated with 2 different forces applied.
for object that moves a bit when interacting with something and then moving back to its ‘place’, that can be emulated with just a force computed to move the object toward that place.

What I want to say here is you can have any behavior you can imagine, it will also be a force that is applied to an object. So, just like in highschool, list all the forces their direction and strength and 80% of the job is done.

And I thought we were in the digital Obviously, in reality, a floating rock would require a very low gravity.
Unless, it looks like a rock, tastes like a rock but is not a rock. Rather a carton replica of a rock. Just like the ones used in elementary school in a theatre play . In which case you give it a mass that is more one of a piece of paper or carton. In which case it will float, simply applying some forces/perturb to it.

4 Likes