Sir, in the code there is this variable mcm( an [color=blue]int[/color] type) but I'm not sure what is it for, :-\ and the part where the collision is detected is at what code sir?

Oh yeah n one more thing sir, what technique did u use, in order to get the proper collision detection or what technique/s is involved to create this simulation, in the physics aspect as well( I don't want to know how to create the simulation from the EJS though-not yet), thx :)