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

Fixing FreeLook Camera to the back of a tank turret

Discussion in 'Cinemachine' started by N3rg4l, Jul 23, 2020.

  1. N3rg4l

    N3rg4l

    Joined:
    Nov 21, 2019
    Posts:
    4
    Hello people,
    i am writing here because i did not found any solution to my problem.
    Basically i want my FreeLook camera rotates togheter with the tank turret along the X axis.
    Here is a video about this problem: https://imgur.com/a/nSv5G5B (Don't care about console errors, i already fixed them).
    The closest solution that i found is in this thread (https://forum.unity.com/threads/how...rotation-and-set-camera-behind-player.598714/ , posted by Gregoryl) but i don't see the option to recenter X axis instead of the Y.
    Any help?
     
    Last edited: Jul 23, 2020
  2. gaborkb

    gaborkb

    Unity Technologies

    Joined:
    Nov 7, 2019
    Posts:
    175
    Hi
    Have a look at our examples scenes: aimingRig. It uses the ThirdPersonFollow component for body, which is specifically for these kind of situations.
    You will need to control the turret with your mouse input, and set vcam with ThirdPersonFollow to follow the turret.

    Other example scenes that are related and potentially useful: 3rdPersonWithAimMode, DualTarget.

    You may need to update your Cinemachine package to see these example scenes. ;)
     
  3. N3rg4l

    N3rg4l

    Joined:
    Nov 21, 2019
    Posts:
    4
    Maybe is it better with a standard virtual camera (that i managed to lock to the turret: https://imgur.com/a/vTN7P9e) and a script component that could replace the FreeLook camera main feature (rigs)?

    Because at the moment i am focusing on developing keyboard controls, then when i move the turret with the keys the camera has to follow the turret without any damping.
    But later i want to develop standard Mouse controls (move the camera to aim and turret will follow with a delay caused by max rotation speed of turret ).

    I want to attach in both modes the FreeLook camera rigs feature to move the camera up (to see better behind near walls etc.) and down (to aim better at long distances).
     
    Last edited: Jul 26, 2020
  4. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    3,953
    I agree, it's best in this case to simply parent a static vcam to the turret, and have a custom script to adjust its offset. FreeLook is overkill.
     
unityunity