Search Unity

Freelook Camera with different modes

Discussion in 'Cinemachine' started by Wannabeuk, Apr 25, 2019.

  1. Wannabeuk

    Wannabeuk

    Joined:
    Feb 19, 2013
    Posts:
    62
    So, i'm not sure if this is possible, or it might be really easy and i'm just not understanding something.

    I'm using a freelook camera to make use of the top/middle/bottom rigs. But i want slightly different behaviour between each rig. I want the top rig to not automatically rotate with target (my player) movement. and to stay at a fixed rotation. But allow the player to manually change that rotation.

    I then want middle camera to act pretty much default with auto orbit

    and then i'd like the bottom to work like an over the shoulder 3rd person. always staying behind the player

    I do wonder if this is pushing freelook into something it wasn't designed for, as with the top rig i can get either a fixed rotation with no player control, or player control with auto orbit. i can't work out how to get both.

    Would it be better to have three seperate cameras instead and blend between them?
     
  2. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,711
    Yes, this looks like a job for 3 separate vcams. Have a look at the CinemachineMixingCamera, which will generate a continuous blend of its child vcams. A simple script can control the weightings based on whatever input you like (for instance, mouse Y).
     
  3. Wannabeuk

    Wannabeuk

    Joined:
    Feb 19, 2013
    Posts:
    62
    Thanks Gregoryl, I thought i might be pushing in the wrong direction.
     
  4. Wannabeuk

    Wannabeuk

    Joined:
    Feb 19, 2013
    Posts:
    62
    Ok so i'm having some real difficulty with this, and for some reason i'm finding little help via google.

    I can't work out what type of camera i would need for top down. I've read that cinemachine wasn't really designed for top down cameras and that you should take some extra steps for setup, but i don't really understand what those steps are.

    Working in 3D, how can i get a camera to be above and slightly offset from the character looking down (not at a strict 90 degrees, more like 80 degrees) and follow them around without rotating, but also allow the player to rotate, i'm still stuck at one or the other. I'm starting to wonder if cinemachine isn't the solution to use for my game.
     
  5. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,711
    Top-down: Use a vcam with FramingTransposer in the Body, and DoNothing in the aim.
     
  6. Wannabeuk

    Wannabeuk

    Joined:
    Feb 19, 2013
    Posts:
    62
    Gregoryl,

    That is very wierd. I'd read you saying that elsewhere but when i tried yesterday as soon as changed it to framing transposer it would snap the camera to same y height as the target and stick facing towards the Z, So i assume that was for side cameras only. But today it worked! I assume i'll need to write a script to rotate the camera myself rather than the handy axis input available on the freelook camera?
     
  7. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,711
    Yes. To set the camera angle, just set the X rotation in the transform. Framing transposer has a setting for distance.
     
  8. Wannabeuk

    Wannabeuk

    Joined:
    Feb 19, 2013
    Posts:
    62
    Really sorry to be asking so many questions. But your very helpful!

    I've got it working just about now, but one thing i'm struggling with is the mixing cam blending. I have two camera now, my topdown camera and an over the shoulder 3rd person, I looked at the mixing camera in the examples and knocked up a quick script that increases the weight of the bottom camera as the user scrolls in, and decreases it as they scroll out.

    That mostly works, but it seems that the weight needed to switch gets exponentially higher the closer you get between cameras (I hope that made sense). Basically with the topcam at weight 20, and the bottom camera at weight 200 it's split 10% top camera 90% bottom camera, but in order to get to 100% bottom camera the weight needs to be 5000!

    There dosn't seem to be much in the way of settings for the mixing camera, so i'm not sure what i can do about this, do you have any suggestions?
     
  9. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,711
    It's up to you to manage the weights.
    As you lerp cam A from 0 to 100, lerp cam B from 100 to 0. Make sure the weights always add up to 100.

    I just picked 100 as an example. In fact you can use any number, so long as the total weight stays constant.
     
  10. Wannabeuk

    Wannabeuk

    Joined:
    Feb 19, 2013
    Posts:
    62
    Ah, i see, i didn't get that impression from the example scene as it never modifies one of the weights, but it makes perfect sense now you've said it.

    Thanks again.
     
    Gregoryl likes this.