Original Post
I have positioned a camera to follow a target. How would i make the camera move so that the target is always at an angle x from the camera on all axes? I think i need to recalculate the yaw and pitch so the camera tilts and pans so the angle between the camera vector and the target vector stays constant. Any ideas Here is what i am doing currently, this code will follow the target but will not maintain the angle, camera seems to pan over and around the target instead of staying alongside the target at a set distance away. Scale(&invCamPos, &camPos, -1.0f); // Translate the camera back to the rotation origin... Translate(cameraFrame, &invCamPos, rwCOMBINEPOSTCONCAT); ZDist.x = 0.0f; ZDist.y = 0.0f; ZDist.z = dist; target.x = t.x; target.y = t.y; target.z = t.z; cameraMatrix->pos.x = cameraMatrix->pos.y = cameraMatrix->pos.z = 0.0f; Transform( &temp, &ZDist, cameraMatrix ); Subtract( &camPos, ⌖, &temp ); // Get the camera's UP vector and use this as the axis of rotation... Rotate(cameraMatrix, &up, pitch, combineReplace); Rotate(cameraMatrix, GetRight(cameraMatrix), yaw, postConcatenate); // Translate the camera back to its original position... Translate(cameraFrame, &camPos, postConcatenate);