Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | GreyMiller |
I’m making a wheel that can stick to walls and ceilings (in 2D), for that I apply force to the wheel towards the wall. I’ve tried two ways of doing this (both are used within _integrate_forces function because I need the wheel’s “state” to detect contact point):
A: _apply_central_impulse function. The code looks nice, but Godot docs insist that I use impulse functions only for single impacts, “use the “_force” functions otherwise”, they say.
B: setting applied_force equal to some value. This makes my code a bit awkward because I have to manually reset it every time I want the wheel to fall. And force still needs to be recalculated every time because wheel should roll along the walls which are curvy.
The behavior seems to be pretty much the same in both cases.
So the question is, what actually is the difference in physics between force and impulse (apart from that impulse value should probably be multiplied by delta) and why is it recommended not to use impulse for long-time forces? Because I would rather use impulse in my case
Also, is there a way to use delta and state in one function? When exactly is _integrate_forces called?
OR maybe everything is way easier and Godot has sticking to surfaces feature implemented in its engine?