Player look at object wrapped in trigger box

So I want to make a 3rd person view player to look at an object(actor) when it enters the object’s trigger box and I tried using find look at rotation node in the anim graph of the player but it can’t get the reference actor to work.

I’m relatively new to UE4 blue prints and animation so I hope someone my help me out.

Many thanks!

a 3rd person view player to look at an object

do you want the mesh to face the object or the view(camera)? if its the camera then you will likely need to set the control rotation of the controller, that is the case unless your spring arm is a child of the mesh. so you would get look at rotation then set control rotation based on that.

using find look at rotation node in the anim graph

why are you working in the anim graph? do you have a specific turning animation that your looking to use?

can’t get the reference actor to work

without seeing the script its hard to determine what youve done, what your trying to reference, and where to help. try posting a screenshot so we can see the script.

at the most basic level you could create a script in the actor to look at, the player character, or the level bp that could handle making the player face the object. the simplest method would be like mentioned above, get the look at rotation and set both the control rotation and the actor rotation to the look at rotation. you could also take that a step farther and add in a rotation over time via a timeline and a lerp rotator which sets the rotations in small increments overtime, basically it makes the character rotate to look at the target actor over a specified time. you could also use a interp for a similar effect. if you are planning to use a specific animation things will get a bit more complex and i would need to look into a good solution there before giving any advice.

im surprised this doesn’t give you any errors. its probably because its a macro but if this were a normal script i suspect the set world rotation would give a error from having a improper target (no target) since the target isn’t specified until the overlap. once there is a overlap it would work for a time but i imagine that eventually the return of the cast would be lost due to garbage collection and the issue would go back to no reference.

for your example i would instead either run the script once via the begin overlap → cast → set rotation which results in looking at the target, or run everything on tick including the cast if you want the view to be locked to the actor. course if you wanted to get real fancy you could add in a gate node to control the flow of the tick execution in the tick example.

try this:

Yes, I didn’t think about that