chandlerprall / Physijs

Physics plugin for Three.js
MIT License
2.76k stars 455 forks source link

Breakout Example, Restitution Behaviour #67

Closed m4d3 closed 11 years ago

m4d3 commented 11 years ago

Hi, i coded this little Example using Physijs (Ammo Branch) and TypeScript. The ball doesn't bounce right, no matter what values i use for the restitution. I changed the SphereMesh to ConvexMesh, seemed to help a bit but still the bounce behaviour isn't right.

If someone could look into this, that would be very kind. Link: http://ewaya.de/breakout/

P.S.: i wrote a physi.d.ts definition file, it's far from complete but works for my example

chandlerprall commented 11 years ago

Yep, I tried making a breakout example but gave up pretty quickly. Couple of reasons: 1) Bullet/Ammo have something weird going on with spheres and restitution 2) breakout doesn't follow the laws physics, except maybe the angle of reflection during contact.

m4d3 commented 11 years ago

Mh, i did this example for learning purposes, maybe i'll just switch to box2d then. thank you

chandlerprall commented 11 years ago

To be honest I don't think any physics engine is going to do what you want for the 2nd reason I gave above. Most likely you will need to write your own collision detection for box/sphere (which isn't too bad) and the collision response (box is removed, sphere bounces).