# Blueprint: Getting an object to LOOK at another object

**URL:** <https://forums.unrealengine.com/t/blueprint-getting-an-object-to-look-at-another-object/363332>\
**Category:** World Creation\
**Tags:** orientation, aim, unreal-engine, constraint, question, Blueprint\
**Created:** [July 8, 2016, 7:18am UTC](https://forums.unrealengine.com/t/blueprint-getting-an-object-to-look-at-another-object/363332 "2016-07-08T07:18:09Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![pdcsky](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@pdcsky](https://forums.unrealengine.com/u/pdcsky)\
**Post date:** [July 8, 2016, 7:18am UTC](https://forums.unrealengine.com/t/blueprint-getting-an-object-to-look-at-another-object/363332/1 "2016-07-08T07:18:09Z")

</div>

I’m trying to create a pair of eyes that will look at an object whenever it moves.  
In 3ds max this is quite easy to accomplish by simply giving the eyes a “Look at Constraint”

Is there such a function in UE4?

---

<div class="post-metadata">

**Author:** ![TechnicallyLew](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/technicallylew/32/605772_2.png) [@TechnicallyLew](https://forums.unrealengine.com/u/TechnicallyLew)\
**Post date:** [July 8, 2016, 7:42am UTC](https://forums.unrealengine.com/t/blueprint-getting-an-object-to-look-at-another-object/363332/2 "2016-07-08T07:42:28Z")

</div>

Hi pdcsky,

Without knowing exactly what it is I can only speculate. Bare with this…

Ok, lets say we have a pair of eyes. A Mesh eye ball individually placed inside a skull.  
In the blueprints you would, possibly, have a tick event or an event that fires from a trigger then loops (performance?), pull from the eyeball mesh and create a function to set rotation.

Next you would need to do a call to find the target you are looking at. For example, get all actors of class with a For Each Loop with Break (again performance…) and find the matching actor and get its location Vector and store that reference as a variable.

Next you would set the eyeball rotation to look towards that vector by setting rotation, this could take some math. I’d suggest a clamp to stop the eye balls spinning into the back of your face.

This is probably a noob approach but I could foresee it working. Maybe not the best method but it might be a good method to try and test and then find optimisations later. (That’s how I roll)

Good luck!

---

<div class="post-metadata">

**Author:** ![PasteDog](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@PasteDog](https://forums.unrealengine.com/u/PasteDog)\
**Post date:** [July 8, 2016, 10:17am UTC](https://forums.unrealengine.com/t/blueprint-getting-an-object-to-look-at-another-object/363332/3 "2016-07-08T10:17:44Z")

</div>

Hello!

You have to make a blueprint that makes the mesh or actor rotate to look at the target location or actor each tick like NukePie explained. The math part is luckily done by UE! 🙂

Something like this should work:

 ![97659-lookattarget.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/d/7/1/d715cddc95e3b553e6c5788de6ecf1c76b29d15e.jpeg)

If you are trying it in code:

```
//Calculates the lookat rotation from direction vector
FVector direction = FVector::ForwardVector;
FRotator lookAtRotator = FRotationMatrix::MakeFromX(direction).Rotator(); 

```

If you are trying to make a skeletal mesh look at a target (like aiming) You should take a look at this documentation: [[Creating an Aim Offset | Unreal Engine Documentation](https://docs.unrealengine.com/latest/INT/Engine/Animation/AnimHowTo/AimOffset/)][2]

I hope this helps!

Elias

---

<div class="post-metadata">

**Author:** ![pdcsky](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@pdcsky](https://forums.unrealengine.com/u/pdcsky)\
**Post date:** [July 8, 2016, 1:04pm UTC](https://forums.unrealengine.com/t/blueprint-getting-an-object-to-look-at-another-object/363332/4 "2016-07-08T13:04:49Z")

</div>

Awesome help guys! I gave the thing a try and it seems to do the trick,  
what about if I wanna get 2 eyeballs that are boned up looking at each other and will keep on looking even if they’re moving?

---

<div class="post-metadata">

**Author:** ![PasteDog](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@PasteDog](https://forums.unrealengine.com/u/PasteDog)\
**Post date:** [July 8, 2016, 3:35pm UTC](https://forums.unrealengine.com/t/blueprint-getting-an-object-to-look-at-another-object/363332/5 "2016-07-08T15:35:46Z")

</div>

How you describe it it sounds like AimOffset, take a look at the link in my previous comment 🙂

---

<div class="post-metadata">

**Author:** ![Dragontiger](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Dragontiger](https://forums.unrealengine.com/u/Dragontiger)\
**Post date:** [April 25, 2017, 9:10pm UTC](https://forums.unrealengine.com/t/blueprint-getting-an-object-to-look-at-another-object/363332/6 "2017-04-25T21:10:55Z")

</div>

Can someone do a tutorial for a newbie. I’m trying tu do a short animation inside UR and a detailed tutorial of the eyes look at object will be very useful.
