How to: make this flower stay within the window?


(Markus Bjerre) #1

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:


(Andrew) #2

(Greg) #3

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)


(Mark Hunte) #4

This seems to conflict with the physics…


(Greg) #5

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


(Markus Bjerre) #6

And why is that Greg?


(Greg) #7

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


(Markus Bjerre) #8

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