Still, but falling, dynamic objects start sleeping. Bug or feature?

I don’t know if this is a bug or working as expected so I have to ask.

I have zero gravity with objects having zero dampening so they float. When I make them fall by restoring gravity and both linear and angular dampening they freeze after ~2.5 seconds if they are still while falling down. This does not happen if they manage to hit ground or get some angular apply_force juice. :beverage_box:

Also, it seems like if I apply linear force to a “floating sleeper”, they fly to the moon. Gravity escapee.

1 Like

Could you please share a repro project?

2 Likes

I had a feeling I forgot something. :eyes:

phys30gravity.zip (8.8 KB)

1 Like

Thank you!

Hmm, enabling and disabling objects should do what you want to achieve, I guess. Why do you do it via setting gravity? This dice.lua module is used by all dice instances, and they all control gravity for all of them, which I don’t think is intended design for gravity :smiley:

When I changed this to just enabling/disabling collision objects it looks like it works, here’s the diff:

You can also increase the damping slowly in the update and cap it, e.g.:
go.set(self._cobj, "angular_damping", math.min(angular_damping + 0.002, self._angular_damping + 0.25))

2 Likes

Oh my actual use-case is a floating dice that rotates in air. I made this thread only because I wasn’t sure if I found a bug or not. :smiley:
I’m kinda not convinced that a live physics object that is currently being affected by gravity, but has 0 angular velocity, is supposed to start sleeping. Then again I know very little about physics engines.

Old code oopsie. Yeah I do not need to touch gravity since changing the dampings is enough.

Useful, thanks! :heart:

1 Like