Beispiel #1
0
    void FixedUpdate()
    {
        for (int i = 0; i < 8; i++)
        {
            float Ldistance = LPAPIJoint.GetDistanceJointLength(LeftMuscle[i].GetPtr());
            float Rdistance = LPAPIJoint.GetDistanceJointLength(RightMuscle[i].GetPtr());

            float act = Ldistance - LeftMuscleForce[i];
            if (act < 0)
            {
                act = 0;
            }
            if (act < 10)
            {
                act += relax;
            }
            LPAPIJoint.SetDistanceJointLength(LeftMuscle[i].GetPtr(), act);
            LeftMuscleForce[i] = 0;

            act = Rdistance - RightMuscleForce[i];
            if (act < 0)
            {
                act = 0;
            }
            if (act < 10)
            {
                act += relax;
            }
            LPAPIJoint.SetDistanceJointLength(RightMuscle[i].GetPtr(), act);
            RightMuscleForce[i] = 0;
        }
    }