Search Unity

Potential Feature Request for Recenter to Target Heading

Discussion in 'Cinemachine' started by Steel-Grin, Nov 13, 2019.

  1. Steel-Grin

    Steel-Grin

    Joined:
    Aug 28, 2013
    Posts:
    16
    I'm currently using a FreeLook camera and recentering the camera behind the players back when moving with no camera input ala typical action adventure games. In my case, like a lot of these games, the player rotates based on the movement input not strafing unless they're aiming.

    I'm not sure if there's an option I've missed here, but I can't seem to find a way to not recenter when the target forward is facing towards the camera. I'm using 2.3.5 and checked the 2.4.0 changelog, but can't see anything.

    I can implement this myself by grabbing the dot product of the target and camera and then disabling recenter when the target forward is within a range of the camera. Maybe there's a more efficient way of doing this like disabling when the player is +/- 180 degrees somehow without having to do a dot, but I'm not sure.

    However, should this not be an included option in the editor as it's a use case most people will have if they're making a third person/adventure camera? You would almost never want the camera to recenter when you're walking towards it, you just want it to follow backwards.
     
  2. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,720
    Good idea for a feature, but sadly not implemented yet in core. You'll have to write a little script to poll the character fwd vs camera fwd, and turn off the recentering when it's as you describe. A dot product is probably the most efficient way to calculate it.
     
    Steel-Grin likes this.