Yesterday, 12:06 PM
(This post was last modified: Yesterday, 12:13 PM by josemendez.)
(Yesterday, 11:48 AM)Qriva0 Wrote: Yes it's natural, but when I push rod via velocity, then hitting obstacle will stop rod, while my input depth still goes up.
That simply descyncs rod with input, so I need to either pin particle to certain position (but that breaks physics) or use velocity method with offset (like spring) to account for difference between current and actual input depth. (by depth I mean how far rod is pushed)
I still think I don't understand your use case at all... if you just want to make the rod follow input "depth" (whatever that may mean in your game) while following physics, calculating and adding an acceleration is the proper way to do it.
(Yesterday, 11:48 AM)Qriva0 Wrote: Yes, but the difference is that previously I just added force equal to movement delta
If you literally mean force = movement delta, it doesn't make any sense: F = ma, so the resulting acceleration depends on mass. Depending on the mass of your rod, using movement delta as a force could result in an absurdly high (or low) acceleration.
What you want is to use movement delta to calculate acceleration regardless of mass - that is, a spring.
Using a damped spring will typically give better results as it avoids overshooting, and it's not much more complicated to implement: just subtract current velocity times some "damping" parameter: F = -kx-vd, or F = stiffness * (current pos - desired pos) - velocity * damping.
kind regards