Leg animation not working

Posted by Monacraft on Game Development See other posts from Game Development or by Monacraft
Published on 2013-06-25T11:34:49Z Indexed on 2013/06/25 16:30 UTC
Read the original article Hit count: 229

Filed under:
|
|

I am making a simple animation in XNA C# of a leg moving. This is the logic code for the thigh. It is meant to swing from 25' to 335'. However instead, it hits a point and then keeps on spinning in the other direction. Please help, here's the code:

    private void Thigh_method()
    {
        if (Legdata.Left == true)
            signvalue = -0.05f;
        else
            signvalue = 0.05f;

        if (Legdata.ToMid == true)
            Thighturn_ang += signvalue;
        if (Legdata.ToMid == false)
            Thighturn_ang -= signvalue;

        if (Thighturn_ang <= 25 || Thighturn_ang <= 335 && Thighturn_ang <= 180)
            Legdata.Left = true;
        if (Thighturn_ang >= 25 || Thighturn_ang >= 335 && Thighturn_ang >= 180)
            Legdata.Left = false;

        if (Thighturn_ang == 0)
            Legdata.ToMid = false;
        if (Math.Abs(Thighturn_ang) >= 25f)
            Legdata.ToMid = true;
    }

Thanks in advance, Yours:

Mona

© Game Development or respective owner

Related posts about XNA

Related posts about c#