After seeing this video… https://www.youtube.com/watch?v=vlUTlbZT4ig …and this video… https://www.youtube.com/watch?v=6dTyOl1fmDo …on YouTube, I wondered if that Physics experiment could be done with Hype.
I got it to work when the elements were the same size and same density. It's three bounces. But changing anything else yielded quite unexpected results.
Here's the template…
pi-test.zip (13.9 KB)
That's when I started wondering about the conversation here… Ideas For Hype 5 Features… - #54 by Photics …is Matter.js the right match for Hype?
I tried to do this manually, with just Matter.js and I got unexpected results. I'm not quite sure where's the problem. Is it with Hype, is it with Matter.js, or are some Physics settings missing?
I tried lots of different things… setVelocity vs applyForce, Density vs Mass, slop, rectangles vs circles, bigger box vs same size box.
Then I'm reminded of the current issue in Hype, where Physics elements either run out of energy (when they shouldn't) or bounce out of the scene (when they shouldn't). I noticed that in this example. If I simply put two walls, and move the lefty block out of the way, the righty block would eventually bounce out of the scene. (That's the Constant Collision Detection issue.)
This hurts Hype because I was psyched… oh cool, I can make a new video about Hype for Pi Day. Unfortunately, it didn't work.
Perhaps this information could still be useful. Maybe it's a benchmark of what's good Physics. This shouldn't be complicated. It's a theoretical scenario, with no loss of energy in the system. So, why isn't it working? Where's that extra energy coming from, or where is it going if it's being lost?