When the rigidbody is at high speeds, It will clip into the floor. I suspect the issue is from my custom physics settings to allow for changes in gravity. Does anyone know if theres a way to fix my code (or if theres a better way to implement changing gravity)?
Rigidbody2d clipping into ground
Is there a way to implement Continuous CD in code? As i dont think that option does anything with custom physics...
Why do you need a custom integrator for this? You could just change rigid body's gravity scale property.
xyz Would that allow for gravity to be left and right as well?
- Edited
SuperMatCat24 No. In that case you can use add_central_force()
. When gravity needs to flip, just add the opposite of the current gravity force to nullify it, and then add the new one.
xyz
So would this work to change the gravity?
Using set_constant_force seems to work, but the marble is still being affected by gravity...
Don't forget to zero-out the default gravity.
xyz Thats what im stuck on...
SuperMatCat24 Body's gravity multiplier should be 0
- Edited
xyz Doing that and setting constant y to 980 makes slopes and other things feel really jittery. Is there a way to set the global gravity while running?
SuperMatCat24 You should change the gravity force only once, not perpetually and try to use *_central_force()
insted *_force()
. Alternatively you could apply central impulse every frame but that'd make the behavior frame-rate dependent.
What version of Godot are you using?
This is a known issue in 4.0
https://github.com/godotengine/godot/issues/72674
davek 4.0. Thanks for notifying me of the bug!