Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Look at with a FPS controller

Discussion in 'Cinemachine' started by derkoi, Sep 17, 2018.

  1. derkoi

    derkoi

    Joined:
    Jul 3, 2012
    Posts:
    2,255
    Hey, I'm using Cinemachine with a modified Unity FPS controller from the standard assets with Do Nothing on the body and aim, this is working great.

    I'd like to have my character look at things in the world, but I need to rotate the player parent game object left & right instead of the camera, is this possible?

    Thanks
     
  2. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,658
    With DoNothing in the Aim and Body, Cinemachine won't interfere with this. You'll need to look at the standard controller code to find out if there are any issues with this idea.
     
  3. derkoi

    derkoi

    Joined:
    Jul 3, 2012
    Posts:
    2,255
    I think you're misunderstanding me. I plan to change Cinemachine to look at a gameobject, but when I do it only rotates the camera and not the player parent, which is what I need.
     
  4. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,658
    Like I said, you'll need to look in the Controller code, not in Cinemachine. Cinemachne is 100% passive in this situation. What happens when you rotate the player parent?
     
  5. derkoi

    derkoi

    Joined:
    Jul 3, 2012
    Posts:
    2,255
    When aim is set to do nothing, the camera rotates with the player parent as expected but when aim is set to composer and I have my look at target when I rotate the player parent, it rotates but the camera keeps looking at the target.

    I'd like my player parent to rotate left & right and not the camera, is there any way to set that up with cinemachine?
     
  6. derkoi

    derkoi

    Joined:
    Jul 3, 2012
    Posts:
    2,255
    I've just made a bit of a hack:


    Code (CSharp):
    1. if (FollowRot)
    2. {
    3.             Quaternion myRot = transform.rotation;
    4.             myRot.y = CamTransform.rotation.y;
    5.             transform.rotation = myRot;
    6. }
    This basically rotates my Parent to match the camera on the Y axis.