I'm rotating a 3D object using a 4x4 transformation matrix. The object is a cylinder is rotated about its center point. The cylinder has a radius of 1 and a height of 2. Then there is a 3D vector (the position of the point on cylinder) placed at (x,y,z)=(0,1,0).
The object is rotated using Euler angles in the transformation matrix so that the object can pitch, yaw and roll. The cylinder can pitch, yaw and roll using my transformation matrix, but when applying the transformation matrix to the point the point does not move as it's supposed to.
I know that in a vertexshader file the each vertex position of the cylinder is multiplied the transformation matrix to get the world coordinates. Then the world coordinates are multiplied by the view matrix to get position relative to the camera and then multiplied by a projection matrix for the gl_position.
I tried doing the same for the point on the cylinder, to use only the transformation matrix and I tried to use transformation with the view matrix and tried with the transformation and projection, but none would work.
I want the ball to stay in its current position as shown below.