Search Unity

First person camera

Discussion in 'Cinemachine' started by a-t-hellboy, Nov 21, 2018.

  1. a-t-hellboy

    a-t-hellboy

    Joined:
    Dec 6, 2013
    Posts:
    180
    Hey there,

    I'm creating the FPS game which it has full body awareness feature like Mirror's Edge.
    And like any FPS games the body is rotated according to camera look so I put my virtual camera in player gameObject.
    This is my setup:

    upload_2018-11-21_23-48-14.png

    As you see there is no rotation in horizontal axis in the camera because actually it is rotated in this axis by player rotation.
    But now I want to put this virtual camera out of the player gameObject and has that previous result which I just explained.
     
    Last edited: Nov 25, 2018
  2. a-t-hellboy

    a-t-hellboy

    Joined:
    Dec 6, 2013
    Posts:
    180
    Anyone ?
     
  3. No one answered because probably no one understands what is your question. At least I don't, that's for sure.

    If you want an effect back, change back whatever you have changed. Other than that, you may need to rephrase your question.
     
  4. a-t-hellboy

    a-t-hellboy

    Joined:
    Dec 6, 2013
    Posts:
    180
    I made some changes in my post. Check it out please.
     
  5. I still don't get it. When your body is rotating, you just match the rotation on the camera. Or I still don't understand what you're asking for.
     
  6. a-t-hellboy

    a-t-hellboy

    Joined:
    Dec 6, 2013
    Posts:
    180
    How should I match the rotation on the camera ?
    How should I match the rotation on the camera ? (I don't use Unity Input Manager, I use Rewired)
     
  7. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,728
    I also don't understand your question, or what you're trying to do.

    Why do you want to unparent the vcam from the player? If you want the mouse to control player rotation, then make a script to do that. If the vcam is parented to the player, with "do nothing" in Aim and Body, it will exactly follow the player.
     
  8. a-t-hellboy

    a-t-hellboy

    Joined:
    Dec 6, 2013
    Posts:
    180
    Because I want to transit from my third person camera to first person camera and vice versa. Also there are 2 player gameObject, one for third person and another for first person. Because of this I want to put my first person camera out of player gameObject and sync player rotation and first person camera rotation.

    Also I use Rewired for input managing and player rotation depends on mouseX axis and speed parameter. I want my camera rotation speed same as player rotation speed (Typical FPS game)
     
  9. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,728
    Sounds like you need 2 vcams: one for FPS and one for TPS. Activate one or the other, according to the mode you're in. Let Cinemachine do the blending for you. Keep the FPS camera inside the player GameObject.
     
  10. a-t-hellboy

    a-t-hellboy

    Joined:
    Dec 6, 2013
    Posts:
    180
    @Gregoryl By keeping it in player GameObject how I should enable and disable player GameObject for TP and FP mode ? (For TP it is out of player GameObject)
     
  11. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,728
    You don't have to disable the entire Player gameObject. Just the FPS child when you enter TPS mode.
    I don't really know how you've set things up, but assuming it's like this:

    Camera
    - brain

    Player
    - FPS controller
    - vcam

    TPS controller
    - vcam

    For FPS mode disable the FPS controller component (including its vcam) and enable the TPS gameObject.
    For TPS mode do the opposite.