Search Unity

True fps problem !!!

Discussion in 'Scripting' started by vipvex, Mar 9, 2012.

  1. vipvex

    vipvex

    Joined:
    Dec 6, 2011
    Posts:
    72
    I'm currently working of a true FPS. I'v used my knowlage on FPS scripts from Eteeski's and this guy's tutorial on how

    to make a true FPS -->


    So i'v attached a PlayerLook script to the head my rigged character model and it works fine. I can look around

    and see my own body. $Image_1.PNG


    So my next step was to add movment to the arms when aming. So that they would follow the camera. But when I

    added the script to both arms I got a problem. I added a emtpy game object to my character and parented

    the arm to it, the animation that I currently had for the character stoped and was replaced with the default stance of the

    model. (when it just sits there with no animations) $Image 3.PNG


    The arm still moved around like i wanted it to move but there was no animation in it.

    Then I tried adding the PlayerLookScript to the actual rig but as I was expecting it rotated in a weird angle but this time

    the animation worked. $Image 3.PNG [

    My question is how do make my character's arms move in the dierction I want with animations ?
    Do I add somet to the PlayerLookScript ?

    PLEASE RESPOND !!! If you need more information just ask :)
     

    Attached Files:

    Last edited: Mar 9, 2012
  2. Nickman99

    Nickman99

    Joined:
    Sep 21, 2013
    Posts:
    1
    What script is on the working arm?
     
  3. angrypenguin

    angrypenguin

    Joined:
    Dec 29, 2011
    Posts:
    15,620
    The problem is the part where you're changing the hierarchy of the model by parenting the arm to an empty GameObject. You can add extra children, but you can not change the parenting of the nodes that define the skeleton of the skinned mesh. This will break the mapping between the animation data and the model, which I'm pretty sure is what you're getting here.

    If I understand correctly, you tried attaching the look script directly to the arm and it partially worked but pointed the wrong way? That's probably because in the model the arm isn't pointed down the Z axis, which is what Unity considers to be "forward". Off the top of my head you could either fix this in the model (though this will probably effect your animations), or you could modify the script so that it has a rotation offset value and account for it using that. The offset would be the difference between the arm's current Z axis and a vector pointing in the direction you wish to be the arm's "forward".
     
    Last edited: Sep 23, 2013