Search Unity

Question Can't make my cinemachine camera rotates my player object

Discussion in 'Cinemachine' started by KrisTheCoolGuy, Jan 31, 2022.

  1. KrisTheCoolGuy

    KrisTheCoolGuy

    Joined:
    Feb 16, 2020
    Posts:
    10
    Currently i'm trying to make my cinemachine camera rotates my game object based on the cinemachine's rotation but i couldn't figure out how to do that i find a way to pull a similar method but it makes the camera and the body be desynch ie the camera rotates first and the body later here's the code i used for that

    Code (CSharp):
    1. transform.rotation *= Quaternion.Euler( 0, Input.GetAxis( "Mouse X" ) * lookSpeed, 0 );
    i tried looking for any solution but i couldn't find one exactly so if someone helps me i would be very appreciated
     
  2. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,711
    I would suggest making your mouse directly move your game object and NOT move the camera. Let the camera position itself according to the game object, not according to the mouse. If you could show an image of your vcam inspector, it would help.

    mouse --> gameobject --> camera
     
  3. KrisTheCoolGuy

    KrisTheCoolGuy

    Joined:
    Feb 16, 2020
    Posts:
    10
    sorry for the late reply but here's my vcam inspector image
     
  4. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,711
    ok thanks.
    A couple of things:
    1. You should remove the LookAt target. You're incorrectly telling the vcam that it's looking at itself. Then the warning will disappear and blends will be better.
    2. Instead of doing HardLockToTarget, you can make the vcam a child of your player and make the head a child of the vcam. Then, POV will automatically move the head as well as the camera. So, set your Follow target to null and set the Body to Do Nothing.
     
    KrisTheCoolGuy likes this.