Target Lock | Tech Discussion


This week there was not too much done as I mainly focused on creating a functioning target lock. As per the previous post there was an issue with the target lock-on where I was trying to figure out how to separate the camera from the player. After much research in the Unreal documentation, I came to the conclusion that there was functionality I needed to where I could not separate the two in the way that I intended, at least at my current experience level. 

The other problem with the target lock camera is that when I created a target lock I initially had the camera and player not locking to the target together. I was able to get the player to lock on to the target but setting the character's orientation rotation to center on the target but the camera was still free to move where ever the player wanted to move it freely. This made me look at what I was doing with the camera and realize I was only interacting with the player and not the camera. Doing some more research I came across the Controller and how I can use this with the follow camera to lock the camera to the orientation that I need it in. The image below shows this method of how the target lock works with the camera. 

With this change, a decision made was to make the character also not be locked onto the orient of the lock so the camera. The player can move freely with the camera still attached to him and the camera will stay locked onto the target. The next thing to tackle with the camera lock was the distance check. I wanted this lock-on to disable after the player reaches a certain distance away from the target so I added that into the check as well. This along with the radius check to see if the target was within the target locking distance to be sure that I was using the correct radius. 

The biggest thing I need to add to the target lock is to have it disable and target the nearest enemy, if there is one, upon the death of the previous enemy. This will require me to understand our enemy class more and how they are calling their death functions to see what I need to do to make sure the lock on will disable. Once I finish with this rudimentary lock on, as it will still need plenty of polishing, I am hoping to add a heavy attack to the player combat system.


written by Amara Gitomer

Get Mythicism

Leave a comment

Log in with itch.io to leave a comment.