Search Unity

Would it be possible to create non centered dead-zone ?

Discussion in 'Cinemachine' started by Kiupe, Nov 22, 2018.

  1. Kiupe

    Kiupe

    Joined:
    Feb 1, 2013
    Posts:
    528
    Hello,

    Here a screenshot showing a character that has been set as a VCam Follow target. According to its position and because I do not want the VCam to move when the character is selected, the ScreenX property is computed in order to be the current character position from the VCam point of view. It works, great.

    But now I'd like to be able to drag" the character and have a dead zone matching the screen edges in order to have the VCam moving automatically. But is seems that the dead zone is centered around ScreenX and ScreenY values, so the dead zone can't match the screen edges. Actually the left one could be off screen in this case.

    Is it possible to set an offset in a way or other ?

    Thanks

    Capture d’écran 2018-11-22 à 15.25.26.png
     
  2. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,730
    You're setting the vcam screen X/Y to get around the fact that when you set a Follow target, the vcam warps to put the character at the screen X/Y, right? as in this thread: https://forum.unity.com/threads/is-...moving-when-target-is-in-the-deadzone.586651/

    Currently, there is no way to turn off that feature of the vcam, but maybe there is a better workaround.

    What if you tried this: create a new invisible GameObject to be the Follow target of the vcam. When the mouse button goes down, warp that target to the character under the mouse. As the mouse drags the character, drag the invisible target also. When the mouse button goes up, warp that target to the center of the screen. That should give you what you're looking for.
     
  3. Kiupe

    Kiupe

    Joined:
    Feb 1, 2013
    Posts:
    528
    Hello,

    Ok, I will try to do that. I already have a first Vcam following an invisible target. When the player click on the screen and there is no character under the mouse I start moving the invisible target to let the user "drag" the screen. At the same time, my other Vcam position is set to the previous vcam position, so it always at the same position, corresponding at what is currently visible. When the user click on the screen and there is a character under the mouse this is that vcam that is used to target the character.

    Reading your comment maybe I can deal with only one vcam and set my already existing invisible camera to go the character position in a very short delay.

    Thanks