HelpProgrammingPhysics
As the title says, I need help setting all the forces on the block after clicking restart to 0, because for some reason they still work even after I do this
I’m not quite sure that I understand _integrate_forces, but just to have confirmation of what I’m thinking, does using _integrate_forces need me to make my own physics by adding gravity, friction and things like that?
If I try using _integrate_forces everything just stops moving and the docs say that it stops all physics process and makes the rigid body moved by a script
I might be wrong for this but, last time i tested, it just work properly as like basic physics 2d rigidbody (it still has gravity). give it a try at least
also as you can read, you can just turn off the custom_integrator if you need it behave normally until you really need to change its position, you turn it back on.
i dont know if just switching on and off the custom_integrator will let you stop any additional force before you move it manually like your code do.
Ok, I think the mistake was that I replaced _physics_process(delta) with _integrate_forces(state).
As for now, I have both the functions inside my block, and it almost works.
The block doesn’t maintain any type of forces and stops moving after restarting (this includes gravity that stops working).
On the other hand, after restarting another time OR getting hit by another block, the block starts moving without any force left, perfectly reset like I need
If you have any idea on how to simulate a contact between 2 blocks, I could simply add that inside the resetBlock() function and call it a day.
Any other solution is still appreciated