Announcement

Collapse
No announcement yet.

how to set camera for locking system?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    how to set camera for locking system?

    I recently swapped somethings in the game i'm making for a lock on system.

    When you are locked on the game sets your character's rotation to the Target (easy enough)
    The controls are a single joystick with the controller yaw updating the camera, so that when you are not locked on the camera stays mostly behind your toon. (easy enough although I had several days of being stupid with it)

    But when you are locked the camera stays centered on your character, who is now facing weird depending on how the enemy moves.
    I tried setting the camera to look at the Target. But of course that sets it to just follow the target and you character can go to the limits of the boom (making it impossible to see where you are going at times if backing/strafing far enough)

    Ideally I would like to keep the camera BEHIND the character, (maybe with some slight angle/drag for a more natural feeling) where it has a "look at direction" that passes through the character but points directly at the target.

    How would I go about doing this?
    So far the only thing that comes to mind is rather annoyingly complex maths of finding character location, doing math to know where the camera SHOULD be to be being the character, setting it's position THEN getting a look at direction to the target and setting the camera to it. With a branch that says if it is beyond some value to break the lock....
    I GUESS it would work...but seems like there would be a much easier way then having something like that run on an event tick while a target is locked.

    Appreciate the help
Working...
X