Search Unity

  1. Unity 2020.1 has been released.
    Dismiss Notice
  2. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

How to recreate this game camera

Discussion in 'Cinemachine' started by Jackk_, Jun 30, 2020.

  1. Jackk_

    Jackk_

    Joined:
    May 2, 2017
    Posts:
    40
    I was wondering the best method of achieving a third person targeting camera, the likes of which shown in this game.

    Cameras functionality can be best seen through 4:30-5:30
    From this video you can see a few key features I want to replicate
    • Automatically scaling/changing distance from the target to keep both the player and target in view
    • Automatic aligning with the players forward transform when standing still
    • Camera turns to face the target (like the player), slowly when strafing right and left (as to prevent the player going out of view)
    The solution I came up with was to use a free look cam using simple follow, setting the LookAt to the target and the Follow to the player, which is causing all sorts of issues whenever they get close, cameras zooming in far too much, direciton of movement messing up etc.

    I am thinking freelook may not be suitable as there should be no need for the user to navigate the camera as it is done automatically in this game.
    Any suggestions or starting pointers would be greatly appreciated.
     
  2. gaborkb

    gaborkb

    Unity Technologies

    Joined:
    Nov 7, 2019
    Posts:
    174
    TargetGroups are exactly for this. You can add targets to the target groups, and adjust each targets weight. The camera will ensure that the targets are inside the view.

    Have a look at our examples scenes for ThirdPersonCamera - example scenes: 3rdPersonWithAimMode, AimingRig. I think 3rdPersonWithAimMode will be the better fit for your case.
     
    Jackk_ likes this.
  3. gaborkb

    gaborkb

    Unity Technologies

    Joined:
    Nov 7, 2019
    Posts:
    174
    I don't see this behaviour in the video, but if I understand correctly, then you may achieve this
    • using damping, either on the camera or on your target (having a shadow of your target that damps your targets movement)
    • or with a state driven camera, which switches between these two cameras based on states.
     
  4. Jackk_

    Jackk_

    Joined:
    May 2, 2017
    Posts:
    40
    I understand what is going on with the 3rdPersonWithAimMode example you talk about, however this isn't the desired mechanics, the main thing is that the player shouldn't have to maneuver the camera when targeting the enemy. I meant the camera is constantly trying to stay behind or near the users pokemon whilst keeping the other pokemon in frame and looking at the target at all times, what rig should i use to achieve this?
     
  5. Jackk_

    Jackk_

    Joined:
    May 2, 2017
    Posts:
    40
    Changing the aim type from POV to composer is essentially what I already have implemented, I like the re-centering aspect but there are poor edge cases like this which make me wonder if there is a means of always keeping both in view?

    edit: Changing composer to group composer makes the camera focus exactly where i want, however i still have the issue of the player being able to move offscreen without the camera keeping them in view
    edit: Camera collider was causing that, I think this solution will be sufficient, I'll let ya know if i come into any more problems, thank you for your help! :)
     
    Last edited: Jul 1, 2020
    gaborkb likes this.
  6. gaborkb

    gaborkb

    Unity Technologies

    Joined:
    Nov 7, 2019
    Posts:
    174
    Any of our rigs could work using TargetGroup. Create a TargetGroup, add all pokemons to the TargetGroup you'd like to be in the frame (note, you can do this dynamically through scripts too). Then, add this TargetGroup to your camera's LookAt. Your Follow target should be the user's pokemon. You may want to add a higher weight for the user's pokemon in the TargetGroup.
     
unityunity