I can draw a scene using a camera fine, but if i change the tilt or pan of the camera then the box room I draw using planes gets destroyed, the angles of all the sides change and it looks like a scene from Labyrinth. I don’t understand what’s wrong.
maybe i should post up a screenshot to demonstrate the problem, first pictute is no pan or tilt, 2nd is some pan and tilt, so it should be looking a bit to the right and up (ignore the rectangle and square top left, thats just another camera looking behind). it feels like the rotation of the camera is affecting the rotation/translate of the planes.
are you placing the camera in a particular position? is it an ofCamera of ofEasyCam?
if ofCamera, it is placed in 0,0,0 looking towards 0,0,1
The second screenshot doesn´t look unreasonable to me.
You should call ofEnableDepthTest(); in the begining of draw();
Did you try with ofEasyCam instead of ofCamera? ofEasyCam inherits from ofCamera, so if anything is wrong with the ofCamera ofEasyCam will also have it, the difference is that ofEasyCam allows you to interact with it by dragging the mouse.
ofEnableDepthTeest() will only introduce obstruction of objects close to the camera and wont have anything to do with the incorrect positioning and angles of the planes shown in the 2nd image. consider the green is the roof and the blue is the floor.
I think the problem is the renderer is applying the cameras rotation on the objects I draw in world space, which makes sense. I need to find a way to somehow turn it off.
Hi, what are class are the objects stored in the _plane array (or vector)? how are these setup?
you always draw stuff in world space, unless you have nested (parented) objects, which shouldn´t be the case.
The camera doesn’t transform the objects it renders, as it is unrelated to these.
did you try using ofEasyCam? what happens?
Same results with easycam, I’ve pasted the other code bits. One thing I recently noticed is I am translating then rotating, this should be creating an orbiting effect according to online sources, but the effect I get is a rotate and then translate. it still shouldnt be affected by the rotation of the camera though.
it isnt clipping, the angles of the planes are changing. I’m now redrawing the planes by rotating before translating and it’s working. I’d still like to find out why the cameras rotation affects the rotation and translation of the planes when translating before rotating.