Hi there,
I’m making a 3D free kick game in WebGL, and I am having some problems with the physics engine / collision detection. Let me show you the phenomenon (runs in Chrome):
A correct rebound:
http://dl.dropbox.com/u/14670704/correct/index.html
An incorrect rebound:
http://dl.dropbox.com/u/14670704/incorrect/index.html
It seems that the ball does not get out of the colliding state, so when there is a check for collisions for the second time, the ball gets wrong velocity values.
The ball gets updated every 15 ms - index.html
- line 305:
if (elapsed > 15) {
ball.update(0.015);
}
Collision check can be found in ball.js
and collision.js
.
I’ve found that changing it to 10 ms sometimes solves the problem, but not in all cases. Feel free to ask if you need more information!
Please help me solve this! I’ve been stuck with this for a while :\