Search Unity

Weapon rotating when looking up and down

Discussion in 'Scripting' started by SNIPEZPUNISHER, Sep 1, 2015.

  1. SNIPEZPUNISHER

    SNIPEZPUNISHER

    Joined:
    Jun 23, 2015
    Posts:
    9
    So I'm building a zombie fps and made a character with Fuse/Mixamo.
    I build my own movement into the character, so to look up and down it rotates the spine of the character.
    My gun is a child of the camera, which is a child of the character head, because that would seem logical.
    Now for some reason my gun or camera has a weird rotation which results in the gun not being centered anymore.
    When i have my gun at angles of 0, 90, 180 or 270, then my gun aims perfectly straight, but when it goes up to an angle like 45, then it starts going up and down.

    Here are some pictures:

    Here the character is looking straight.
    As you can see there is almost no real arm visible. and the gun aims correct(even though not visible here)
    http://imgur.com/CCetGxv

    Here is the character looking up, you can see much more of the arm and the back of the gun. which means that it is not at the same angle/position even though unity says it is.
    http://imgur.com/e1tiZAM

    Here you can see the gun aiming straight and as you can see the crosshair/dot lines up correctly(for the most part, i'm still working on it)
    http://imgur.com/LEILz6F

    Here you can see the gun aiming down and the scope just completely being off of the crosshair position. This also applies when looking up, but only at angles like 45 degrees, if i look straight down or up, then everything is lined up
    http://imgur.com/YnJFOGT

    So i think it has something to do with the spine being rotated, because when i use the firstpersoncontroller from the standard assets, then everything works fine.

    Hope someone know an answer to my problem!

    PS don't look at the model of the gun and my scene, because it was my first model i ever made(needed a gun), and this map has only been in development for a few hours and is mainly used for testing!