ATTENTION / LOOK-AT · UNREAL ENGINE

Running past things
and actually noticing them.

A run cycle stares straight ahead, always. Throw a ball past the character and it carries on like nothing happened. So I made a Control Rig layer that sits on top of the walk/run and turns the whole upper body toward whatever deserves attention, without affecting the bottom animation.

ENGINEUnreal Engine
BUILT WITHControl Rig · Anim Blueprint · Sequencer
FOCUSProcedural layering · Tooling
SAME TAKE · CONTROL RIG OFF, THEN ON
// 01 · one take, one knob

Each clip on this page follows a level sequence.

A mentor told me during my internship: if you want to show what a parameter does, make the test reproducible and change one thing. So every comparison here comes from a single Level Sequence. Same run, same red ball, same frames. Each clip is two renders of it with one value changed, side by side.

That's also why the system is driven from Sequencer at the moment. Not because it needs Sequencer, but because "it looked better that one time" isn't evidence.

// 02 · how it fits together

An event goes in, a head turns.

01Level SequenceFires events on exact frames
→
02Attention BPHolds the target + settings
→
03Anim BlueprintReceives the attention events
→
04Walk / RunLocomotion as usual
→
05Control RigTurns the body on top of it

The Control Rig runs after the locomotion pass, so the walk and run animations stay untouched. The rig only adds the look on top of the pose it receives.

The Anim Blueprint has two events and that's the whole interface:

EVENT

AttentionChange

Takes the object to look at and a settings struct: blend time, blend curve and weight. The latest call wins: a new target just takes over.

EVENT

AttentionFade

Takes a time and a curve, and blends the character back to looking where its animation wants it to look.

TOOL

The Attention BP

What a designer touches: a Blueprint holding the same struct, so tuning a look is editing three fields, not opening the rig.

Sequencer is only the thing calling the events today. Anything that can reach the Anim Blueprint can call them too, like an AI perception callback or a trigger volume. I just haven't wired one up yet.

// 03 · looking behind

Looking back without breaking his neck.

When the target crosses directly behind the character, the angle goes from -180° to 180° in a single frame. For the maths that's basically the same direction. For the spine, it means going from twisted all the way one way to twisted all the way the other, with nothing in between: one frame he's looking over one shoulder, the next he's looking over the other, with a little motion blur as a souvenir.

Two problems were hiding in that snap, so there are two pieces to the fix.

MATHS

A custom quaternion slerp

A regular slerp always takes the shortest way round, which is exactly the thing that flips sides at 180°. Mine keeps going in the direction it was already turning, so the rotation stays continuous past 180° instead of jumping to the other side.

MOTION

The U-turn

When the target goes past a threshold behind the character, the point he's looking at doesn't cut straight through his back. It swings around him on a helix-shaped path, so the head follows a curve a human would actually take.

LEFT: THE OLD SNAP · RIGHT: SLERP + U-TURN
// 04 · head only vs. the whole spine

Turning just the head is how you get an owl.

The obvious version rotates the head bone and calls it a day. It works, technically. It also looks like the neck is on a swivel while the rest of the body hasn't been told anything.

So the rotation is spread over every bone from the head down to the pelvis, each with its own weight. Same target, same angle, but now the whole person is looking, not just their face.

LEFT: HEAD → PELVIS, WEIGHTED · RIGHT: HEAD BONE ONLY

And once the weights exist, they become another acting knob. Same run, same ball, two setups. On the left the pelvis doesn't take part at all and the turn piles up near the top. On the right the pelvis, spine and shoulders all get a real share, so the whole torso commits to the look.

PELVIS 0 · SPINE 0.1 · SHOULDER 0.3 · HEAD 1 VS. 0.3 · 0.5 · 0.8 · 1
// 05 · timing is personality

Same target, a different character.

The blend time in the struct ends up doing a lot of acting. At one second the character drifts toward the ball, a bit absent-minded. At a tenth of a second it whips around like it just heard its name. Neither is wrong; they're two different people.

SAME EVENT · 1 S BLEND VS. 0.1 S BLEND

Then there's the curve. Same duration, different shape: ease in starts lazy and catches up, ease out reacts immediately and settles. It's a subtler difference, which is exactly why the struct takes a curve and not just a number. Animators care about the subtle one.

SAME DURATION · EASE IN VS. EASE OUT
// 06 · the part I'm proudest of

The body bounces. The gaze doesn't.

A run cycle bobs and twists every step. If the look-at doesn't account for that, the head lands on the target and then wobbles around it in rhythm with the feet, which reads as "not actually looking".

Here the red debug line goes from the head to the target. Watch it while the character runs: the body moves underneath, the line stays pinned.

DEBUG LINE: HEAD → TARGET · OFF, THEN ON
// 07 · what works today

Honest status.

✓Head → pelvis weighted lookWorking
✓Blend time + curve + weightWorking
✓Stable gaze while runningWorking
✓AttentionChange / AttentionFadeWorking · latest wins
✓Targets behind the characterCustom slerp + helix U-turn, no more snap
✗EyesFixed for now, it's a head turn

// 08 · next

Next: eyes that lead
the head.

Then something in the world that calls AttentionChange on its own, so it stops needing me holding the Sequencer.

Back to work ↗