Prevent dragging the dynamic object off the screen

Hi everyone. I have a draggable object controlled with dynamic physics. Even though I have static borders, my object flies off the screen when I drag it fast. Is there a way to prevent this?

Thank you

Yes,
You need to adjust the bounce and density settings
I find that if you have it “too bouncy” over halfway on the slider it becomes unstable and shoots outside of your container.

Also if the static elements are really thin and your dynamic object’s width is wider than the static object it can go through.

So just like real physics find that fine balance. :wink:

Thank you for the reply Nick :slight_smile:
I have set bounce in 0.00, density in 10.0, also air drag in 0.7. I have a thick rectangle as a border and a very small object.

Now it works much more better. However the object still goes off the screen if I drag it very fast.

I don’t have much hope, but would it be possible to reset the element’s position automatically when it’s off the screen, without any extra interactions?

Not sure…because essentially once it leaves the confines of a static element wall it is flying off into space.
I know this has been a problem with the Physics engine since it came out.
Just a thought did you increase your density on the static object?
Try pushing that up to 10 and see if it helps.

Already tried that. Guess I’ll have to put a reset button. Thanks a lot :slight_smile: