I am trying to calculate a position that is always in front of the camera (using ofCamera) at a certain distance. I can get the position and orientation of the camera, but how would I find the position offset in front of the camera?
Thanks for any help!
you can try using the cam.getLookAtDir() to get the direction the camera is facing. Multiply it by your desired distance and then add it to the position.
float myDistance = 50.f;
ofVec3f lookDir = camera.getLookAtDir(); // already normalized
ofVec3f camPos = camera.getPosition();
ofVec3f targetPos = (lookDir * myDistance) + camPos;
thanks! yes that was exactly what I was looking for.