ToolJoltTools

Look-At Direction & Yaw/Pitch Calculator

From a camera position and target, get the forward direction and the yaw/pitch to aim there.

โ€”
Forward X
โ€”
Forward Y
โ€”
Forward Z
โ€”
Yaw (ยฐ)
โ€”
Pitch (ยฐ)

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

forward = normalize(target โˆ’ eye) ยท yaw = atan2(fx, โˆ’fz) ยท pitch = asin(fy) [right-handed, โˆ’Z forward, OpenGL-style]
References: OpenGL gluLookAt specification; Lengyel (2011), Mathematics for 3D Game Programming

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

  1. 1Enter your values into Look-At Direction & Yaw/Pitch Calculator โ€” sensible, domain-typical defaults are pre-filled so you see a real result immediately.
  2. 2The result recomputes live using the formula shown on the page; there is no button to press.
  3. 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 tools

Related 3D & VR tools

Sponsored