schteppe / p2.js

JavaScript 2D physics library
Other
2.64k stars 330 forks source link

To repair the new body, its sleepstate status is sleepy #147

Closed joneszhuchinagd closed 9 years ago

joneszhuchinagd commented 9 years ago

To repair the new body, its sleepstate status is sleepy . Body.js have modified somewhere.

schteppe commented 9 years ago

I guess this solves it, but why not just do this.idleTime=0; in the Body constructor?

joneszhuchinagd commented 9 years ago

You are right, I hope you can improve in the latest version.I just let you aware of the problem。

joneszhuchinagd commented 9 years ago

I have thought of your solution, but I'm afraid influence to the robustness of the code

joneszhuchinagd commented 9 years ago

You know, the p2 is going to hot up in China, because of the introduction of the physics engine egret game framework.I made a table tennis game with p2, and found a lot of collision detection is not accurate.If too fast, it will affect the judgment of collision detection.So I made some before the collision detection.

schteppe commented 9 years ago

"influence to the robustness of the code"? How? Did you test it? I will push the constructor fix in a minute.

Regarding the inaccurate collision detection: The best solution for that is Continuous Collision Detection (CCD), but it's unfortunately not available in p2 yet. I have some ideas on how to implement it though. What you can do for now is make the time step smaller.

Very happy to hear about the Egret engine! Cool :D

schteppe commented 9 years ago

See https://github.com/schteppe/p2.js/commit/02ecb382868861374006b81d1027bb2380066088

joneszhuchinagd commented 9 years ago

nice~