   Problem With Rotating around an axis
  Hey All.I've loaded a model and I'm Rotating it with my own function but I have some problems.I want some of the meshes to rotate around themselves so I've thought the soultion would be to find the center of that mesh and then decreasing each vertex and normal with that point (So the center point would now be at (0,0,0)) To rotate the object , and then bring each vertex back to the point it was.For some reason my Meshes are rotating around the wrong place and not around themselves. Also the normals are not what they suppose to be and add the model a Light he doesnt have.Here is the code of the function "matrix" each vertex and normal which is being drawn is firstly being transformed in this function:point Model::Matrix(point TempPoint2, int WMesh){point TempPoint;TempPoint.x = TempPoint2.x-Meshes[WMesh].Center.x;TempPoint.y = TempPoint2.y-Meshes[WMesh].Center.y;TempPoint.z = TempPoint2.z-Meshes[WMesh].Center.z;point NewPoint;int flag=0;if (Meshes[WMesh].Zangle!=0){float TheCos=Meshes[WMesh].cosin[4];float TheSin=Meshes[WMesh].cosin[5];NewPoint.x = TempPoint.x*TheCos+TempPoint.y*TheSin;NewPoint.y = TempPoint.y*TheCos-TempPoint.x*TheSin;NewPoint.z = TempPoint.z;flag=1;}if (Meshes[WMesh].Yangle!=0){float TheCos=Meshes[WMesh].cosin[2];float TheSin=Meshes[WMesh].cosin[3];if (flag==1){point NewPoint2;NewPoint2.x = NewPoint.x*TheCos - NewPoint.z*TheSin;NewPoint2.z = NewPoint.z*TheCos+NewPoint.x*TheSin;NewPoint2.y=NewPoint.y;NewPoint = NewPoint2;}else{NewPoint.x = TempPoint.x*TheCos-TempPoint.z*TheSin;NewPoint.z = TempPoint.z*TheCos+TempPoint.x*TheSin;NewPoint.y = TempPoint.y;}flag=1;}if (Meshes[WMesh].Xangle!=0){float TheCos=Meshes[WMesh].cosin[0];float TheSin=Meshes[WMesh].cosin[1];if (flag==1){point NewPoint2;NewPoint2.y= NewPoint.y*TheCos + NewPoint.z*TheSin;NewPoint2.z= NewPoint.z*TheCos - NewPoint.y*TheSin;NewPoint2.x=NewPoint.x;NewPoint=NewPoint2;}else{NewPoint.y= TempPoint.y*TheCos + TempPoint.z*TheSin;NewPoint.z= TempPoint.z*TheCos - TempPoint.y*TheSin;NewPoint.x=TempPoint.x;}flag=1;}if (flag==0){TempPoint.x = TempPoint2.x;TempPoint.y = TempPoint2.y;TempPoint.z = TempPoint2.z;return TempPoint;}else{point Ju = Meshes[WMesh].Center;NewPoint.x = NewPoint.x+Ju.x;NewPoint.y = NewPoint.y+Ju.y;NewPoint.z = NewPoint.z+Ju.z;return NewPoint;}} Any clues what should I do?Thanks in Advance   
 Cross post. Closed.   