Camera lockOn view blocking
Reported by: Eldar Bertsel
October 19, 2023
THE PROBLEM
One of the problems that I had to deal with was related to the lock on view blocking mechanic that I had implemented. Basically, it is a mechanic that checks whether there is anything like a wall between the player and an enemy. If there is then the lock on should turn off because it doesn't make sense to be locked on to someone who you can't even see. The way that mechanic worked is it would create a ray from the player to the target that the player is locked on, check its tag, and if there is something in between them at any point, meaning something that has not an enemy tag, then the lock on would turn off. Unfortunately, some of the abilities that I have like fireball or a fire blast would block the view with their colliders. Even though you can't see the colliders they are still there and the ray can hit them, so every time the player or an enemy like magician would cast those abilities then the lock on would turn off.
THE SOLUTION
The solution to it was quite easy. I decided to make a check that would only check for objects with a stationary tag and if it hits that check then it would start a 3 seconds timer. if during those 3 seconds the ray was still colliding with a stationary object then it turn the lock off otherwise the lock will say on. This not only fix my issue but also makes the process of locking on and off smoother because the lock on isn't turn of instantly if there is something between the player and a locked on target.
Get Psyche
Psyche
Welcome to your next great souls-like adventure!
Status | In development |
Author | Sad Ogre Studios |
Genre | Role Playing, Adventure |
Tags | Atmospheric, Fantasy, Indie, mind-bending, psyche, Sci-fi, Singleplayer, Souls-like, Third Person |
More posts
- Problem: Harder Isn't Always More FunDec 14, 2023
- How to make the controller feel more responsiveDec 14, 2023
- ModelMayhem: A Programmer's TaleDec 08, 2023
- Problem: Face Your FearsDec 03, 2023
- Time to show our real main characterDec 01, 2023
- Problems: melee combat system is too boringNov 24, 2023
- Problem: Frames Win Games?Nov 17, 2023
- Problem with camera transitionNov 16, 2023
- Combo Attack systemNov 11, 2023
- Problems with code reusabilityNov 03, 2023
Leave a comment
Log in with itch.io to leave a comment.