Look-At Direction & Yaw/Pitch Calculator
From a camera position and target, get the forward direction and the yaw/pitch to aim there.
The first step of every look-at matrix is the normalized eyeโtarget direction. From it you can derive the yaw/pitch to orient a camera or turret, or build a full basis with an up vector. Uses the OpenGL convention where the camera looks down โZ.
Formula
About Look-At Direction & Yaw/Pitch Calculator
Aiming a camera, turret or character at a target starts with one vector: the normalized direction from the eye to the target. This calculator computes that forward vector and converts it into the yaw and pitch angles you'd feed a camera controller or aiming system, using the right-handed, โZ-forward convention of OpenGL and most engines. It's the foundational step of the classic 'look-at' matrix and the everyday answer to 'what rotation makes this object face that point?' โ useful for cameras, AI aiming, billboarding and procedural orientation.
How to use Look-At Direction & Yaw/Pitch Calculator
- 1Enter your values into Look-At Direction & Yaw/Pitch Calculator โ sensible, domain-typical defaults are pre-filled so you see a real result immediately.
- 2The result recomputes live using the formula shown on the page; there is no button to press.
- 3Adjust any input to compare scenarios, then read the worked example to see the substituted numbers.
Why use Look-At Direction & Yaw/Pitch Calculator?
- โComputes Look-At Direction & Yaw/Pitch instantly in your browser โ no sign-up, no upload, no server round-trip.
- โ100% free and unlimited, with the exact formula shown: forward = normalize(target โ eye).
- โRuns entirely client-side, so every value you enter stays private on your device.
- โLive recompute as you type, with a worked example and authoritative references for trust.
Frequently asked questions
What is the โZ forward convention?+
In OpenGL's right-handed camera space, the camera looks down the negative Z axis by default, with +X right and +Y up. So 'forward' is โZ, which is why yaw uses atan2(fx, โfz). DirectX and some engines use +Z forward (left-handed); if your yaw seems mirrored, you're likely on the opposite handedness convention.
How do I turn the forward direction into a full orientation?+
Build an orthonormal basis: forward = normalize(target โ eye), right = normalize(cross(worldUp, forward)), up = cross(forward, right). Those three vectors form the rotation part of the look-at (view) matrix, or can be converted to a quaternion. The yaw/pitch this tool gives is the Euler-angle shortcut for simple controllers.
Why separate yaw and pitch instead of a single rotation?+
Many camera and aiming systems are built on independent yaw (horizontal turn) and pitch (vertical tilt) for intuitive control and to clamp pitch (preventing the camera from flipping over the top). Decomposing the look-at direction into these two angles plugs directly into such controllers. For roll-free aiming, yaw and pitch fully define the direction.
What if the target is directly above or below the eye?+
Then the forward direction is nearly vertical, pitch approaches ยฑ90ยฐ, and yaw becomes undefined/unstable (the same gimbal-lock issue as Euler angles). Look-at matrix construction also degenerates when forward aligns with the up vector. Handle this edge case by choosing an alternate up vector or clamping pitch just short of vertical.
Related 3D & VR tools
Quaternion to Euler Angles Converter
Convert a unit quaternion (x, y, z, w) to roll/pitch/yaw Euler angles, with gimbal-lock detection.
โ LiveEuler Angles to Quaternion Converter
Convert roll/pitch/yaw (degrees) to a unit quaternion (x, y, z, w) for engines, IMUs and animation.
โ LiveAxis-Angle to Quaternion Converter
Convert a rotation axis and angle to a unit quaternion โ the most intuitive way to specify a 3D rotation.
โ Live