[SOLVED] Questions on some physics parameters: Gravity, Damping and Friction

Hi, I have general ideas on how Gravity/Damping/Friction works in physical space but I need to be more clear to make a better simulation in my game:

setGravity(Vector3f) - so what’s the exact nature of this gravity vector? Something has the same unit as the Gravity Constant does in the real world so the value should be same for all objects as long as they’re in the same world? Or it’s a force which means in order to allow a hammer and a feather fall with the same speed (when there’s no damping/friction from air!), I have to multiply it with the mass before set it.

The confusion here is that:

  • If I apply a small vector (0.98 on Y axis as I’m trying to simulate a micro-gravity environment) to 3 objects with different mass: 0.1, 1 and 60, the two lighter objects seems fall correctly while the heavy object falls extremely slow.
  • If I apply it with the multiplication of mass and the above small vector, objects which has mass 1 and 60 seems fall correctly but the one has mass 0.1 falls much slower.

setFriction(float) - is it works only when collision happens? My understanding is that I can use setDamping(float, float) to slow down a ball when it’s flying through space. So to me, the friction is only used to reduce momentum when collision happens, especially a continuous one like the ball is rolling on the ground. Am I correct?

Thanks!

1 Like

Gravity has units of distance per second squared; it’s an acceleration not a force.
It’s typically the same for all objects in the world, but you can override this.

If I apply a small vector (0.98 on Y axis as I’m trying to simulate a micro-gravity environment) to 3 objects with different mass: 0.1, 1 and 60, the two lighter objects seems fall correctly while the heavy object falls extremely slow.

Simulating microgravity is possible. Perhaps there’s a bug in your code, or perhaps there are other forces (such as damping) at work. If I were seeing this issue, my first step in debugging would be to use PhysicsBody.getGravity() to verify that the parameter is set correctly on each object.

setFriction(float) - is it works only when collision happens?

Yes. Friction only affects bodies that are in contact with other bodies.

A couple generic recommendations:

  1. If you are using jme3-bullet, I recommend switching to Minie as soon as possible.
  2. I recommend working through the Minie tutorials, particularly the tutorial on rigid-body physics, which answers some of your questions.
2 Likes

Thanks for the answers and recommendation. Indeed I’m using Minie as you suggested in my last topic :slight_smile: .

1 Like

You’re right on the gravity constant issue, I reviewed my code again and found the root cause. The big mass object is actually the player which has linear velocity set in every update loop according to the keys pressed. So the most effect of the micro-gravity is cancelled out by the Y value in the linear velocity which brings a feeling that the player falls extremely slowly.

1 Like