Targeting Camera zoom

Greetings!
First of all, thanks for the awesome course, the state machine is really awesome, and it’s my favourite part. But I am having a little problem here, tried fixing it for a couple of hours, tweaking some camera setting, but couldn’t really achieve the result i want.
So the issue is that when we are targeting and away from the target, we have one view, and when we are getting close, the camera starts sliding back dramatically. I do understand that it wants to keep the target kind of in the centre of the screen, but it really annoys me when for example the enemy gets a huge knockback, and it slides a lot, like it is seen in the gif I attached. Maybe it has something to do with the weights in TargetGroup? Or should I come along with some script that changes some values based on distance to the current target? Or maybe I’m just missing something?
The result I would love to achieve is that camera stays withing the same distance by player’s side.

TargetZoomIssue (1)

That’s a case where the Targeting Camera may not be the best tool for the job. It’s going to do everything in it’s power to keep both the player and the target as close to the center of the screen as possible.

Now with any camera setup, you’re going to have some slide as long as you have some knockback. I did a little experimenting, though, and simply by changing the follow on the TargetingCamera to Camera Focus, and changing the Aim type to Hard LookAt, the player is still facing the enemy (because we’re already enforcing that as soon as we enter PlayerTargetingState) and the knockback is less jarring. I would experiment to taste from there.

1 Like

Thanks for the reply! So, at first I tried to change settings in TargetingCamera, it became much better, but still not the result I wanted. And then I thought for a second time about Your words that Targeting Camera is not the best option for this job, so I did the following :

  • I just duplicated my FreeLook Camera, and it will be my new Targeting Camera.
  • For the settings, it is following CameraFocus and LookingAt TargetGroup. I changed Rigs Radius for 3/2/3 respectively. Also in the middle Rig section I changed Aim to be Group Composer.
    Also, important setting was to tick Recenter To Target Heading under Axis Control, and change Wait Time and Recentring Time to be extremely small, in my case it is .05
  • And the final change: TargetGroup Weights. For the Player I chose 1.5 W and Radius 2, also in Targeter script the Target receives the Weight of .75f and Radius 2.

So the result is perfect for me, you can see it in the attached gif :slight_smile:
Thank you a lot!

FixedTargetingZoom (1)

2 Likes

Well done! I agree that this is much less jarring than the jigging in and out as the camera struggles to keep both characters “centered” on the screen.

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms