I am trying to do a collision test where if a cube mesh does not go outside of triangular mesh. the cube mesh should stay inside that triangular mesh. I have attached an image to show what iam looking for.
the green box is the cube mesh and the grey part is the triangular mesh.
I am creating that shape with the help of three triangles. is that the right way or is there another way to do that.
but the major part i want help in is the collision. so when you drag the green object i have to make sure that it does not go outside of the grey triangular mesh.