Download

Zelda Style Lock-on Camera

Hey guys/gals. I’m working on a pretty simple 3D game, but having a bit of trouble with my locking system. Best way to describe the goal would be very similar to Ocarina of Time. I’ll try to explain where I am and where I’m having trouble.

Right now, I’m good on the movement of the character, both locked and unlocked.

  • Unlocked - direction of movement sets attack direction, meaning I can spin the camera and will always attack in the correct direction based on where the character is facing. Pretty standard.
  • Locked - character is always facing the enemy and attack direction is always “forward” a.k.a. toward the enemy as you would want.

Bit hard to explain, but the above is just about exactly like Ocarina of Time / Witcher, lots of other games.

When locked, I want to shift the camera so the enemy is in the center(ish) of the screen and have the character be off to the side. The camera should follow the enemy while keeping the character in frame at all times.

First thing I tried was to move the “target offset” of the character spring arm component to the enemy location, which simply didn’t work. Most likely my math was wrong, but it didn’t really seem to have the right effect anyway when playing with the values manually of that variable.

Then, I tried to reparent the characters spring arm to the enemy itself. Result was much closer to what I’m going for, but doing that obviously takes the character position out of the equation. I can just run out of range of the camera.

I also tried to add a dummy scene component to the character and keep it between the character and the enemy and parent the spring arm to that. Pretty uncontrollable, seemed like a dead end.

It seems like there is a super simple solution that I’m overlooking, so figured I’d ask before continuing to throw stuff at the wall and seeing if anything sticks. Seems like I need to have two camera targets at the same time?

Thank you for reading. Nostalgia pic below for reference. :slight_smile:

Hey peeps. So I still have lots of work to go on this, but I was able to figure out what was causing the bulk of my frustration. See attached pics for a super basic, bare bones implementation if anyone comes across this.

I think the main thing that’s confusing is my lack of understanding regarding the difference between “Get Controller” and “Get Player Controller.” I also never saw the two Booleans in Character Movement as shown in the pics. If anyone would be able to maybe explain a bit more about those topics I would very much appreciate it as I’m a bit disappointed how long it took me to crack such a simple idea.

Anyway, pics below. I’ll update once I’m satisfied in realizing my goal and will post the solution to hopefully save someone else some time.