3rd Person Camera Aiming, It's not locking/aiming

Hey all,

I’m working on a third person game with a few friends, and we’re trying to implement a Zelda-esque targeting system.
I’ve gotten it so the player will forever look at the object while the button is held, however the camera is a different story.
I can’t get it to go on the back of the player, nor can I get it to update as the player moves.

So in order of blueprints
44fb8fa6e92a4a8bb03eebeec15a5b077268da49.jpeg

The monster targeter script.

614f88b7f7f0715f838cb0d49dfdebe1641fae62.jpeg

The failed Camera Script.

Both of these are tied to the exact same Event Tick

Now that camera script, whenever it’s targeting something, for some reason it inverts the controls.

1fe538aebc7b9acaf558472cf7657a1fa776679a.jpeg

So I made this to invert only when the button is held. However it only inverts the first time it’s called, and after that does nothing

So short run

  1. I need some way to make the Camera update each frame upon lock on, but don’t know how to go about it
  2. I need to make the camera lock to the back of the player
  3. I need to make the controls invert, or in some way avoid the initial invert of the Camera Lock On

I have no idea how to go about fixing these issues, can anybody lend a hand?

Like this?..
https://youtube.com/watch?v=2vCQmEssDfo
if so I can show you what I did…

Your video is set to private friend

sorry about that…unlisted now…

Yea it’s around the lines of that, if you could help me that’d be fantastic :smiley:

Sure…although warning this code is from 4.0 and needs to be rewritten…I already see some things I don’t like…I’ll be rewriting it soon but I can share the idea of it for now…
I set my “lock target” by distance to My character (Alice) …
4e12e99ce35042764377eea24d9a64292d0b8307.jpeg
6d469245be548ab6b1fde5213a576df988370188.jpeg
Once Locked on I Set Orient rotation to movement off, (skip ignore auto cam…that’s just my way of making the camera turn left or right when the player moves in that direction), and I set use controller Yaw to true, To be honest without those 2 checked I think this would work exactly the same…I’ll find out when I rewrite it…
cause on Tick
b528b1c972b789e7333f35e4fb7aeee6ebc7e134.jpeg
I set Alice’s look at rotation anyways every tick and the camera rotation…so I don’t see why I’d need those check boxes but if you don’t use them and run into problems try and use them real quick and see if it solves it…
also I noticed you use the relative rotation node…I rarely use those so just double check those…
and here’s a look at that Look at Actor Macro I have in there…standard stuff though…
7f382475ae9ab09550740d44ecda5c1fcb675781.jpeg

in the anim graph I change her walk animations once she’s locked on…the First Person Shooter has and example of this in there…

I’ll be out of town all weekend (but still by my laptop) so I can help you if you run into any problems but I won’t be able to make any good videos or rewrite this code for a few days…I hope this helps you though…
I’ll have a video up on it in the next week (maybe 2) if it doesn’t…

I do this slightly differently; I check every tick to compare the look-at rotation to the current world control rotation. If the delta between these two rotations exceeds a specified threshold, I use an Add Yaw Input node to shift the camera back.

The advantage to this setup is it gives the player some leeway with the camera; it tracks the target in a way that always keeps it in front of the player, but the player’s movements don’t constantly move the camera every tick. Since the cam continues updating along with the player movement, you get “normal camera but bounded to keep the enemy on screen”.

A potentially better way, which I use for slightly different circumstances, is to spawn a “camera holder” actor and move the camera to it, and set its location to be halfay between the player and locked actor. This gives the player a better view of himself and the enemy, though you have to do a lot of guess-and-check to adjust the boom length so that the camera is always zoomed properly.

I was going to see if I could get something like that working on my rewrites…I for sure will be checking this out…thanks RhythmScript…

Okay, so, sorry for taking so long to reply and ask everything about it. Been a weird computer week.

The first image, to see if I can understand it, you get every actor in the area that is an Enemy Pawn, and put them into an array, and then get the number of enemy said array. I’m not sure what the Casting does, but it checks if the enemy is dead, and then gets the distance. It compares The distance to and the current lock target distance, and from there sets the lock target should it be Less than.

Once there, it locks on and you remove orientation to movement, and change the walk speed, but how did you get it to be able to set the local offset to the Camera Boom? Also, what does the casting do? I’m a bit green at this

Next, for Alice’s change, you set the look at actor for Alice to be the Actor itself. From where you get the controller, it’s rotation, and the world’s rot on Alice herself, and push them into a Make Rot, which then goes out to the Interp To, which I’m assuming fixes some weird issues I’ve been having, into the Set Control Rotation, thus forcing the Controller itself to look at the lock target

And then the final picture is self explanatory

Did I understand the code correctly?

I think you’re getting it…test it out…see how it goes for you…
I did end up rewriting and taking out those 2 nodes I mentioned…still testing it to make sure…anyways…
Casting is just being able to “see” what’s in another Blueprint that’s not the one you’re calling from…just communication between the two…I call this from Alice’s BP so I have to Cast to the Enemies BP to see if they’re dead and what-not…

Camera Boom should pull up that Offset Node…just Use Get Camera Boom and pull off from that node and it should come up when you type…

I’ll get some pics up of the (much cleaner) code up if you run into problems and have a video up in a week or two…

I’ll be able to test it in a week or two. My computer suffered a bit of heatstroke and needs to have it’s Mobo and Processor replaced. It can’t stay on long enough for me to do much development and testing D:

But when the parts are here Friday. I can actually go through and test it all

Not to resurrect something from the dead, but would you be able to post your blueprint Rhythm? Or give a few more details?

hey I just came across this and I think its perfect for what Im trying to do. If you are still willing to show me how to do this that would be great.
By the way I think your game concept is worth your time and effort.
thanks again looking forward to your reply.

on the off chance this is directed to me or someone else comes to this thread…I’ve made a video explaining my version so I’ll place that here…

1 Like