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.