Jump to content

Jittery jump velocity


pdiddles03
 Share

Recommended Posts

No jitter, 

Here is some key jump code ..

                if(keys.jump.preJumpMode){ //prejump
                    moveY = 0;
                    if(onUp || inUp){
                        upJumpMode = 1;
                    }
                }
                if(keys.jump.jumpMode){ //jump
                    moveY = (keys.jump.jumpIndex<=1)? 0.8 * oScaleFactor :(keys.jump.jumpIndex<=4)? 0.6 * oScaleFactor :(keys.jump.jumpIndex<=6)? 0.4 * oScaleFactor :0.2 * oScaleFactor ;
                    keys.jump.jumpIndex++;
                }
                if(keys.jump.fallMode){
                    moveY=-0.5;
                }

Some simplified interpolation using a ternary operator.

There was a significant process used to step-debug jump anomalies for ... things that made perfect sense... but were difficult to predict, during testing.

For example: stop turn animation on jump animation... that caused a Jitter - because two animations at same time.

 

SUGGESTION: To find the jitter... 

1) try to set debugger; directly before it begins the jitter...

2) if you can do that -you can fix any complex animation anomaly.

3) step through until you see where it goes wrong...

4) usually it is something obvious that is hard to predict.

5) fix is usually very simple, like adding a if(jumpMode) then turnAnimation = 0. etc...

Hope that helps.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...