Hi everyone,
I’m implementing a LookAt system for my Follow AI in Unreal Engine 5.7. Requirements:
-
When one FollowAI is within a certain range of another, it should look at the other AI.
-
Head should be fixated/locked to the target while LookAt is active (idle head motion should not override it).
-
The rest of the body should continue playing idle/locomotion normally.
Current Approach
I’m doing LookAt in the Animation Blueprint using Transform (Modify) Bone.
Event Graph math:
-
Start:
Get Socket Location("head") -
Target:
LookAtTarget.GetActorLocation + (0,0,120)(face height offset) -
LookAtRot = Find Look At Rotation(Start, Target) -
ActorRot = Get Actor Rotation(Self) -
Relative rotation:
-
PitchDiff = LookAtPitch - ActorPitch -
YawDiff = LookAtYaw - ActorYaw -
Roll = 0
-
-
Clamp:
-
Pitch ~ (-30..30)
-
Yaw ~ (-70..70)
-
-
Make Rotator(PitchClamped, YawClamped, 0) -
Smooth with
RInterpTobefore sending to AnimGraph
AnimGraph:
Use Cached Pose (MainState)→Local To Component→Transform (Modify) Bone(neck/head) →Component To Local→ output
Attempts & Issues
-
LookAt Node (AnimGraph)
-
Tried LookAt node with Layered Blend per Bone / Blend Poses by Bool
-
Problem: head sometimes stuck / not resetting; blend issues and deformations
-
-
Transform (Modify) Bone — head
-
Bone:
head/ Rotation Mode: Replace Existing / Component Space -
Problem: head follows target but deforms/tilts weirdly
-
-
Layered Blend per Bone
-
Separate LookAtPose, blend only neck/head chain
-
Problem: idle head movement sometimes overrides lock
-
-
Transform (Modify) Bone — neck
-
Bone:
neck_01/ Replace/Add settings -
Problem: more deformation; upper body twist
-
-
Add to Existing (Bone Space)
-
Bone:
neck_01 -
Problem: reduces deformation, but idle head motion still affects look
-
-
Chained ModifyBone nodes (neck + head)
- Replace Existing: locks head but sometimes twists wrong direction / looks backward
-
Axis remap attempt
-
Tried mapping yaw → roll (
MakeRotator(Pitch, Roll=Yaw, Yaw=0)) -
Problem: still collapses or flips
-
Questions / Help Needed
Looking for the correct, stable way to implement LookAt using Transform (Modify) Bone without deformation or rotation flipping. Specifically:
-
Best rotation space (Component vs Bone) for Replace Existing?
-
Best way to convert world LookAt rotation into ModifyBone rotation without missing nodes?
-
How to normalize yaw/pitch to avoid ±180 flipping (manual or BP method)?
-
Recommended bone chain setup (neck + head split) for stability?