# Bullet physics mass/gravity problem

Hello everyone,

I’m making a game prototype in BGE that will require altering physical properties of some objects, namely their mass. I know it is impossible to reference this in reality, because objects can’t possibly alter their mass, so im not surprised bullet failed here.

I set up simple scene where a cube falls to the ground being affected by gravity. Then i used a simple code on it like: “own.mass += 4”
with true level triggering on keypress. So when it starts falling I start increasing its mass, an the weird thing happens right there. The cube starts to slow down and at some point it even stops!

And you know the laws of physics state that objects of any mass still fall at the same rate. Even so, I think that this slowing down could be believable, because acceleration still has to be applied to this new amount of mass, but this is what bullet doesn’t do.
And the object most definitely should not stop.
Any way to solve this?

P.S: I don’t really know if this is problem of bullet or its implementation or just a matter of applying the value to be recalculated.

I can just asume that setting the mass makes something reset at the objects physics.

The problem is not that you increase the mass. The problem is that you set the mass all the time.
Just modify your test: Assign 100 to mass all the time = slow fall. If you do it only once = normal fall (maybe except the one frame after setting)

Another test:

``````
own.mass = 100
own.mass = 1

``````

this makes the object fall slower as well (just one trigger!)
even

``````
own.mass = 100
own.mass = 100

``````

produces such results
while

``````
own.mass = 1
own.mass = 100

``````

(running once) seems to be fine.

My conclusion … do not change the mass or at least only one time!

Thank you Monster, when the cube is falling this seems to be working right.

However, the effect i wanted to achieve was a continuous increase in mass until one
object is able to outweigh some other object.

Here is a quick scale scene i set up. Pressing space makes the lighter object to
become heavier.
broken_scales.blend (367 KB)

When you release space this object still has its mass but is outweighed by the
lighter one!? Afterwards it is catapulted in slow-mo and stops in mid air with its
mass still remaining to be heaviest in the scene…

As continuously changing the mass does not work that well, I suggest to constantly replace the object and set the mass at the new one. Setting the mass once seems to be fine.

Unforunatly it makes the whole thing a bit more complicated.

The object’s mass
Type : float
Note:
The object must have a physics controller for the mass to be applied, otherwise the mass value will be returned as 0.0.

This must be my problem for stopping. What is this physics controller? Sorry im really a newb at scripting, but im trying to learn.

ok this i haven’t noticed before. there is an actuator for setting mass. But still it would be nice to have it continuosly changing when i fire my “sci-fi mass shifting gun thingy” upon it.

I do not know what a physics controller is. Maybe contoller is a term of bullet. I do not think this is the BGE controller.
You might continously activate the actuator to set the mass.

Maybe there is a difference

I suggest you make a gravity script that multiplies the mass b the force applied. BGE+ Bullet give you: Heavier objects are less affected by gravity. It might be true in an astronomical scale, but not in a linear gravity contest. So your first test was probably working fine, only bullet messed it up for you. I personally am planning on using a custom gravity script for my game!

Thanks torakunsama, I was also considering just having mass as a property, in some cases that is enough 4me, or I will try getting around by adding linear velocity(or force) with multiplyer instead. Eh… I guess workarounds just give you more control over things.

Ill leave this thread open for a lil while.
Thanks again Blendin buddies