So what is the best way to replicate the default gravity in c++?
I tried adding forces but then the object never enter sleep as long as I keep applying force. No matter If its on the ground standing still. This became a performance issue and produces too much shaking. Any tips?
Bump, cant find the engine implementation
An object that is sleeping, by definition, cannot have gravity applied to it. Generally you only sleep an object when it’s resting on the ground or is in some stable position and then wake it when something interacts with that object.
Gravity is applied as a normal force. You can see this in the CharacterMovementComponent or just search in the engine for “Gravity”. You likely want to detect if the object hasn’t moved for a couple of frames and then sleep it and forget about it till you need to wake it up again.
The problem with that approach is that if the object is upon another rigidbody I cant put it to sleep until all the objects touching are sleeping. For example in a seesaw.