How to: make this flower stay within the window?

Hello guys! I’ve been playing around in Hype professional with the physics and I’m curious if there is a way to prevent an object from leaving a specific area. If you take a look at my test I have set up a window with a flowerpot which is draggable. However, it keeps falling out from the window if you drag it outside it’s borders.

I want the flowerpot to stay in position, and if you try to move it outside the window it should stay inside.
I know this function is working if the area is the same as the scene size but there should be a way to lock it when a scene is bigger than the window in this case.
flowerpot_test-1.0.hype.zip (2.7 MB)

Also, since this is a test only and will not be used in anything, it would be fun if you guys could implement more physics function. Why not make a room with different things like a lamp chained from the ceiling? :slight_smile:

2 Likes

You could use another timeline and then apply a motion path from the Edit menu to restrict movement.

Here's a sample that restricts movement within the parent box horizontally...
containment.hype.zip (11.0 KB)

2 Likes

This seems to conflict with the physics…

1 Like

It does seem to conflict with physics, jQuery draggable does too.

And why is that Greg?

It was because I had not checked the “Continue after drag” check box. It works as expected with it checked.

1 Like

ah I see, great demo btw! Thanks for sharing!