Closed brandonw closed 10 years ago
No there is nothing on ncollide to handle this.
I don't know if there is a "standard" method to deal with this but, here are some pointers. I am assuming that you have some kind of integrator, and you are using the time of impact (TOI) information to prevent the so-called "tunnelling effect" using "motion clamping" (i-e teleporting the ball at the exact position it should have had at a given TOI):
I hope this will help you to find some ideas to solve your problem.
You are exactly correct re: how I am using raycasting to prevent the tunneling effect.Thanks for the tips, I will try them out, and thanks for the great work on this library!
A little while ago, I spoke briefly with you in the rust-gamedev irc channel, and you recommended using a MinkowskiSum to test for a time of impact between a ball and a rectangle.
That is proven extremely effective, and I am using ncollide now just as you said. However, I have a scenario that plays out where a RayIntersection that is returned ends up computing the ball's position to be precisely adjacent to the block. For example, if the block's leftmost edge is at x = 0, and the ball's radius is 5, the RayIntersection will give me a time of impact such that the ball's updated position computes x to be precisely -5.
This causes the next update call to immediately detect an intersection with a very small time of impact, and the same normal as the previous intersection. The ball then "bounces" along the side of the block, as it repeatedly updates the ball's position to be directly adjacent to the block, and then moves it slightly away while updating the velocity to point back towards the block again.
ncollide is doing exactly what it is supposed to do, but I'm not sure exactly what the standard procedure is for dealing with this scenario. Is there a specific mechanism in ncollide that already handles this? Or should I be doing something differently?