Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

FPS head getting in the cameras way

Discussion in 'Scripting' started by Atix07, Sep 21, 2020.

  1. Atix07

    Atix07

    Joined:
    Jul 27, 2013
    Posts:
    182
    Hello!

    I'm working on a fps controller with body. I animated the body and everythings is working as inteded expect for the fps bodys head getting in the way. I tried pareting camera into the head bone which makes me dizzy but surely fixes the problem. I just wanted some advices on how can I handle this situation.

    I was thinking about maybe getting head bones transform and sticking the camera with code? What do you guys think?

    Thanks!

     
    Last edited: Sep 21, 2020
  2. Atix07

    Atix07

    Joined:
    Jul 27, 2013
    Posts:
    182
    Okay, I actualty solved it even without 1 line code.

    I put an empty game object inside my headbone. After that, I put "position constraint" component in my camera and selected that empty gameobject. Which you can freeze so it doesnt move and rotate with the animation.

     
    SilverSharp likes this.
  3. SilverSharp

    SilverSharp

    Joined:
    Jan 20, 2016
    Posts:
    2
    Thanks for sharing your solution! This worked perfectly for my case as well.