Target Lock-on via Key Press

Hi everyone,

So I have been working on a mechanic where I have a spectator camera pawn lock-on to a character pawn. The aim is for my spectator camera pawn to rotate toward the character pawn’s position in the world at all times when I press the F key. The problem I am having is, for some reason when I set the target to lock-on as self (the spectator camera pawn) it works perfectly! But unfortunately when I set the target to be the character pawn it does not even perform the lock-on action. I have been stuck for some time, any help would be appreciated.

The first image depicts the key press functionality which calls a custom event which in turn calls a function over a network.

Within the function which contains the lock-on code

Instead of Player Controller try get Player Pawn? Because controller might not have an entity in space, just an abstract one but the Actor will.

Why is there a cast but no actual object in the frameCharacter function? You’re getting actor location, but which actor are you getting? and you should get Player Pawn actor location instead of Player Controller actor location surely?

Hi! Yes I fixed that and now the spectator pawn looks toward the character pawn when he spawns, but only once. The spectator pawn for some reason does not rotate toward the character’s position even though I have set a find look at rotation within a tick event.

This is how the blueprint function looks now

bottom left corner of this picture you’ll see you have not execution going through that Cast to DirCamSnapTestActor…it’s not being called…you need to run an execution line through it likely from your SwitchHasAuthority to the Cast then to SetControlRotation…


It seems that still did not do the trick. After fiddling for a while I believe I narrowed down the problem but still with no solution (take a look at the red highlights from the image below). Inserting any vector node (whether custom or from location vectors of spawned actors in-game) within the Target from the Find Look at Rotation did not make any changes to the rotation of my pawn’s spectator camera. What I am trying to achieve with the *Find Look at Rotation * is obtain the location (from the client) of a pawn that is controlled by different player controller over a listen server. In simpler terms, how do I get/reference/obtain the location of the listen server’s player controlled pawn when I am on a puny client?


I don’t have much time to experiment unfortunately because I am at work but in theory this should work. Have a Run on Server event which gets a random or preset or closest Pawn or whatever class the controlled actors are and set that as a replicated variable. Use that variable in your LookAt function, hope that works for you! If not, then let me know and I’ll try find you a solution.

Hi, sorry for the delayed response I have been away from home for these past few days. I will definitely try what you said and post my update. Thank you for taking the time out of your busy schedule to help me, I greatly appreciate it!

Hi Monument2Sin,

Thanks a lot it worked great! Here are screen shots in case anyone is interested in replicating what I did for a simple target lock-on mechanic via network!

HI, can you please help? I don’t understand some things in the screenshots.