Elements hitting each other with Physics

How would I go about asking Hype to fire off an action when one dynamic element hits a static element ?

For example, I want to drop a bomb and if it hits the object (car) the car blows up ?

Looking at my post, I guess it’s a little vague!

There are no docs on how elements collide, and I see no way in the UI to check if a dynamic physical element hits a static one. Whether it is a symbol or not, but this would be a reusable symbol.

I would also want to apply a dynamic setting to an object called ‘bomb’ depending on where the cloud is, as it floats by in the sky. Each time it moves across the screen it drops lower, ever decreasing. When a user taps, a rain drop falls from it.

This is my idea anyway. Is it possible I have just purchased Hype 3 Pro :smile:

There is not a collision detector built in as of yet.
However during beta lots of folks tried some javascript add-ons to test collision detection mainly with our pinball samples

You could in theory allow an item to interact with another item and then launch a new timeline with your exploding animation similar to the drag and drop example Daniel Morgan posted awhile ago in the forums. See the attached .Hype file.

drag_drop4.hype.zip (22.0 KB)

So combining some javascript and the physics engine and timelines you could get a nice collision method for your work.

Also there is a jQuery collision method that can be edited to work as well.
Look at GameQuery for examples.

Thank you Nick. I have looked online and seen a few Jquery scripts that check if one element overlaps another. But in my case I need something to fire, such as a timeline, when the bounce is fired.

I have looked at that script, downloaded, opened, and previewed, but it does not work, and so not draggable. Just seems static.

Would I need to put a listener on scene load on any class named ‘raindrop’ and so when it over laps another element it fires another function, timeline ? Lots of other scripts i have seen have other physics so not sure it would not just confuse things. When I purchased this, I thought it would of had collisions as a basic function to be honest. A little disappointed.

While a collision method would be a nice to have, devil’s advocate in me says the Hype folks were not trying to make a game development tool with this version. Hype is at the moment a great tool for making HTML 5 animation and allowing us to extend it with our own Javascript functions.

Physics is a great animation tool and yes it does push most of us to want the next step. Hopefully that will happen in the future.

So back to your challenge. Would you be able to post a .hype document so we could take a look at what you are doing. It can even be basic shapes no custom art if that is easier.

1 Like

I will post a project based on the canonball project which has certainly made some progress with my project.

I also hear what you are saying, but my point of being disappointed is that every Physic script library has collide as standard. So when I saw your update I did a little research, although not much on physics yet on the Hype Site, and purchased it.

But something must be able to capture, or fire, when a static object is hit by a dynamic one. Something fires to enable the bounce, for example. So I need to be able listen when two classes, in my case thats .rain and .car, collide. As the bounce functions works great I cannot help but think i am missing something simple to achieve this. That or I have no idea what physics is coding means :smile:

We were unsure in how folks would use Physics so wanted to be conservative with our initial release, but it is very clear to us that behaviors on collision is quite a vital feature for a future version!

6 Likes