creating a 3D object on a mouse click

HELP!!
How can i create a 3D object on a mouse click depending on the perspective and the viewing??
I am creating a 3D modelisation software…