Animation::RM_Bounce endless loop

If you found a bug in our library or on our website, please report it in this section. In this forum you can also make concrete suggestions or feature requests.

Moderators: CEGUI MVP, CEGUI Team

JordanWeber
Just popping in
Just popping in
Posts: 2
Joined: Mon Apr 01, 2013 12:25

Animation::RM_Bounce endless loop

Postby JordanWeber » Mon Apr 01, 2013 12:33

When attempting to start my program, it gets caught in an infinite loop when using RM_BOUNCE.

delta = 0;
newPosition = 0;

So the following gets stuck, because newPosition never changes:
newPosition = -newPosition;

CEGUIAnimationInstance.cpp

Code: Select all

    else if (d_definition->getReplayMode() == Animation::RM_Bounce)
    {
        if (d_bounceBackwards)
        {
            delta = -delta;
        }

        float newPosition = d_position + delta;

        while (newPosition <= 0 || newPosition > duration)
        {
            if (newPosition <= 0)
            {
                d_bounceBackwards = false;

                newPosition = -newPosition;
                onAnimationLooped();
            }

            if (newPosition > duration)
            {
                d_bounceBackwards = true;

                newPosition = 2.0f * duration - newPosition;
                onAnimationLooped();
            }
        }

        setPosition(newPosition);
    }


Temporary Workaround:
Everytime you start the animation state, step it a small enough amount so delta isnt 0.0f;

Code: Select all

    statsMessageAnimation->start(false);
    statsMessageAnimation->step(0.000001f);


I will be submitting this into mantis.

Return to “Bug Reports, Suggestions, Feature Requests”

Who is online

Users browsing this forum: No registered users and 0 guests