Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Help chosing the right camera setup.

Discussion in 'Cinemachine' started by FerakIII, Feb 1, 2020.

  1. FerakIII

    FerakIII

    Joined:
    Aug 15, 2013
    Posts:
    5
    I've been experimenting with the Cinemachine cameras for a little while, but I'm a relative newbie when it comes to camera systems. I'm trying to setup a scene where the camera tracks a the player and an NPC who are walking together. I want the camera to be to one side of the NPC, determined by the path the NPC is following. So kinda like a side scrolling view, but the NPC is changing direction in world space every so often, and I want the camera to rotate to have them always moving to the right of the screen.

    I've got a main gameplay virtual cam, that's set to look at a target group of the NPC and Player, and to follow the NPC, all of this works fine. I have had the Body set to Transposer, and initially to Simple Follow With World Up, which is fine for tracking them around the world, but doesn't allow the side scrolling angle. I experimented with changing it to World Space, and this works brilliantly as long as the NPC is moving in a fixed direction, but when they start moving in a different direction I can't figure out how to tell it to rotate.

    I'm wondering if there is a different set of settings I should be using, or if I should be setting up a bunch of different Virtual cams that I switch between when the NPC reaches different waypoints, or even if I should be using a dolly cam and create a track that is parallel to the NPC path.

    Any advice or ideas?
     
  2. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,268
    Not sure from your description what you want exactly, but if you want the walking direction of your characters to always be towards, say, screen right, even as they change world direction, then you want to set the Transposer's binding mode to one of the "Target" variations - say LockToTargetWithWorldUp - and set the offset accordingly.

    And if your target is a group, then make sure to set the group's Rotation mode to Average, so that its orientation will be derived from the orientation of the members.
     
  3. FerakIII

    FerakIII

    Joined:
    Aug 15, 2013
    Posts:
    5
    Thanks for the direction (and quick feedback!), will experiment, I have currently built a dolly track that tracks the characters through the level. But if I want branching paths, it would be better to have the camera more independently attached to them. And thanks for making such an awesome component, I keep getting amazed by what it can do all the time.
     
    Gregoryl likes this.
  4. FerakIII

    FerakIII

    Joined:
    Aug 15, 2013
    Posts:
    5


    This is the result of the dolly track approach, the level has a direction that is independent of the rotation of the characters, I tried the Transposer's bind mode to "LockToTargetWithWorldUp", but since my characters keep changing direction, the camera keeps flicking around. The dolly track approach seems to work fine, except I can't dynamically change where the target of the characters is. i.e. if they come to a fork in the road, after making a decision, switch the target to down one of the paths, and have the camera re-position itself to be moving between the last check point and the one down the new road. More I think about it, I guess I'll need to write custom code, or just make a dolly track for each possible path.
     
  5. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,268
    You can divide your path network into sections, with one dollytrack and vcam per path segment. Then, when your character crosses a fork in the path, activate the vcam on the new segment, and let the Brain blend from the outgoing vcam.
     
    FerakIII likes this.