bug with ofxCamera::moveLocal()

I was just posting for help on this problem and realized the answer while writing out the code:

void ofxCamera::moveLocal(ofxVec3f move){
ofxVec3f dir = getDir().normalized();

posCoord += dir.rescaled(move.z);
eyeCoord += dir.rescaled(move.z);

posCoord += upVec.rescaled(move.y);
eyeCoord += upVec.rescaled(move.y);

// posCoord += dir.cross(upVec).rescaled(move.x);
// eyeCoord += dir.cross(upVec).rescaled(move.x);

posCoord += dir.getCrossed(upVec).rescaled(move.x);
eyeCoord += dir.getCrossed(upVec).rescaled(move.x);

I was having problems with the camera doing horizontal translation. The reason was that cross() modifies the dir vector, which causes the eyeCoord position to move differently than the posCoord. I changed cross() to getCrossed to calculate the horizontal/x vector of the camera and it seems to fix it. Could someone commit this change to the addon? Or can I do that somehow?


hi, I have access to the svn for this, I’ll test and commit it…thanks

I updated the svn with your changes + some old requests from this post http://forum.openframeworks.cc/t/small-ofx3dutils-improvements/2014/0

Check it out and let me know if it’s ok!

Thanks Pierre - great addon, by the way! I’ll grab the newest version

hi there
I have been using this great addon to lets users navigate through a 3D scene built in OF but it appears that the camera’s up vector is never recalculated? using moveLocal() to pan horizontally works but when panning vertically the y axis the camera moves along is always the global one. looking at the code it seems that perhaps up vector never changes from 0,1,0

I have had a crack at fixing this but no luck - any advice?

Hmmm, the camera in ofx3DUtils is pretty basic, perhaps if you can post an example of your problem I can look at it, but otherwise check out the great and more advanced opengl cameras here:

I am looking to create a more advanced camera in the future based on some of this code…