Need help/advice about little game with Physics

Hello, I’m building a very little game with Physics and I don’t find the way to have the static charriot basket empty. I mean the dropping elements stay on top of my PNG basket, not inside…
Thanks in advance !

ManuelTest Chariot.hype.zip (718.3 KB)

My first hunch was to say group a vector shape and the chariot and use the vectorshape to determine collision using the group to move them. But Hype doesn’t update the position and the pgysics engine and Hype don’t stay in sync. Seams to be a bug @jonathan . So you would need to use a Mutation Observer or Animation Frame to sync the cariot and the vector shape

There is a bug where vector shapes don’t get properly updated if their parent group moves. However, you can work around this by making a vector shape that has the boundary and the chariot both as sibling elements at the top, and then use a bit of javascript to keep their position together with the drag.

Here’s a sample document that does this:

Test Chariot-fixed.hype.zip (718.3 KB)

I’ve kept the vector shape boundary partially opaque, but you’ll want to bring the opacity to 0% in a final version.

1 Like

@jonathan That fixes it for me as long as the game is structured around dragging the chariot. Otherwise, the Mutation Observer should be pretty efficient for general sync. Couldn’t this be fixed by recursively triggering an update on all child elements that are partaking in the physics engine? Interesting case as I had a similar experience with a workshop participant that was building a robot with grouped container and the robot hand wouldn’t hold the ball we picked up with it. But we move the group containing the physics object. This much simpler case make the problem clear. Hope this will be fixed as it is essential for skinning physics games as it fails kind of weird and silently if physics debug isn’t enabled.

1 Like

Thank you ! I will use this without thinking too much on how is doing because I’m in a hurry for a project. Do you think an future update can make this more simple to obtain ?
Thanks again, Jonathan an Max !

Manuel

Yes, this would be the solution. The main reason it isn't done now is that there'd need to be some sort of caching for which groups have children with physics, because otherwise having a group always scan through children would cause performance problems. It is more of a current missing feature than a bug, even though it manifests itself as such!

1 Like