Understanding the backwards EasyCam axis

Hey all, I’m trying to wrap my head around what’s going on here when you use an EasyCam and how it affects the 3D axis coordinates.
So for reference, this is a bit of code I’m using:

void ofApp::setup(){
	ofBackground(0);
	ofNoFill();
	cam.disableMouseInput();
	cam.setPosition(300, 200, 300);
	cam.lookAt(glm::vec3(0));
	cam.enableMouseInput();
	cam.setNearClip(0.001);

	sphere.setPosition(2,0,0);
	sphere.setScale(0.01);
}

//--------------------------------------------------------------
void ofApp::draw(){
	
	cam.begin();

	ofSetColor(64);
	ofPushMatrix();
	{
		ofRotate(90);
		ofDrawGridPlane(0.5, 10, true);
		ofDrawAxis(0.4);
		
	}
	ofPopMatrix();
	sphere.draw();

	cam.end();
}

Which generates this result:

Right off the bat, there are two confusing things. First, the axis drawn in the middle doesn’t match the supposed OF coordinate system.
Second, despite the spheres location being set to positive X, it’s showing on the grid as being at a negative Z location.

So the question is, what do I trust here? Is the drawn axis and grid wrong? Is the sphere being placed incorrectly? Any help is appreciated.

Hi,
with the following code you are drawing the grid rotated so it makes sense with what you see.

{
		ofRotate(90);
		ofDrawGridPlane(0.5, 10, true);
		ofDrawAxis(0.4);
		
	}

instead of it just use

ofDrawGrid(0.5, 10, true)

I’d say the result of that makes even less sense, with the sphere now appearing as though it were drawn in the positive Y axis, and the grid flipped upwards.

I realize this is all a relative positioning thing, and that the sphere is likely correct and the grid is wrong–but I’m still trying to figure out why.

It is still correct. The ofDrawGridPlane() function draws the ZY plane, as you can read in the reference here
Use instead ofDrawGrid() function as it will draw all planes and label these correctly. You will see that it is all fine

Hello @Andyfilms, maybe it is helpful
cam.lookAt have a second optional parameter which is the vector indicating where camera up is.
so you can define which axis is your “up”, and if it is negative or positive. You can pass any value there

	glm::vec3 cameraLook3d = { 0.0f, 0.0f, 0.0f };
	glm::vec3 cameraLookUp = { 0.f, -1.0f, 0.0f };
	glm::vec3 cameraLookUp2 = { 0.f, 1.0f, 0.0f };

cam.lookAt(cameraLook3d, cameraLookUp);