Hi! I'm trying to rotate a 3d object (just a square plane) around ITS coordinate system, and not Processings global coordinate system. When using rotateX(), rotateY(), and rotateZ(), the rotation is always around Processings origo. I want to do a rotation around x at first, which is fine to use rotateX since it's the first rotation, and then rotate around the objects new y-axis. In other words, I want the rotation to always be around the object itself. So imagine there being a coordinate system on the square plane with z-axis orthogonal against the plane, and the x- and y-axes in the plane (parallel).

I tried rotating around x first with rotateX, and then calculate a new y-axis (variable called new_vy) by multiplying the vector vy = {0, 1, 0} by x's rotational matrix, and then use rotate(angle, new_vy[0], new_vy[1], new_vy[2]);

Some semi-psuedocode: //Code begin

rotateX(angleX);

new_vy = Rx(angleX)*vy; //Rx is the rotational matrix for x-rotation. Note that this is a matrix operation,
//and the actual code doesn't look like this.
//vy is just the unit vector for the y axis, vy = {0, 1, 0}

rotate(angleY, new_vy[0], new_vy[1], new_vy[2]); //this function is pretty much the same as glRotatef(angle, x, y, z);

draw3dobject();

//Code end

This should be done for z aswell, but x and y is enough for starters.

So, any suggestions? Doesn't have to be a modification to my code, can be an entirely different method.

I've found something about quaternions, but I would prefer not to use them, since I don't entirely understand them, and I think that this should work with out them.

The purpose of this is to simulate a quadcopter, so therefor I need to input three separate angles, pitch, roll yaw, (euler angles).

/Daniel