-
3D collisions
Hi
I've got two 3D cubes moving freely around in 3D space. I've worked out a hit test routine but I'm not sure what to do with the cubes once a collision is detected.
The cubes are made of points so it is just a case of determining whether one/any of the points of one cube are inside the other .... but I haven't found a suitable model for collision resolution.
One way is to 'rewind' the point to a safe position - which is good but what should I do with the rest of the cube. Should the other points similarly recoil - which looks crap and doesn't produce a natural spinning effect you often get when cubes colllide. Should the points bounce away - fine as long as the cubes are not in freefall travelling in the same direction with one just clipping the other .....
Any advice or examples of what could/should be done would be most gratefully recieved ....
-
Ha ..
Moving the point back to its earlier position - (I'm using verlet) outside the other cube - AND taking away a small percentage of the amount moved from each point on the second cube's current and previous position seems to work ok.
Any other (proper) solutions welcomed though ... ;-)
-
If the cubes are moving along the floor, then it's a simple 2d matter, and you could use any 2d physics engine to model the reaction.
If the cubes are moving through space, then they can react in 3d, so I would suggest checking some of the source of WOW.
-
will check it out ..
thanks :-)