Forum rules - please read before posting.

Glitchy movement on iOS

I'm currently testing my iOS build and am having some issues with character movement.

In the editor everything works fine. But when testing on iPad character movement
becomes glitchy. Walking seems to be OK (I think) but when running in
one direction a single frame of the opposite run animation will often
show (I only have left and right animations, no up/down). Also,
occasionally, when the character stops, the animation will flip
rapidly between the left and right run animations for a second or two
instead of returning to idle.

No such problems on android.

Character is animated with Sprites Unity Complex and motion control is set to Automatic.

The game is 2D. Movement method = point and click, Input method = touch Screen,
NavMesh search % = 0.8, NavMesh search direction = straight down from
cursor, Destination accuracy = 1, Pathfinding update time = 0.



Any ideas?

Comments

  • edited November 2017
    when running in one direction a single frame of the opposite run animation will often show

    So when making a beeline (no NavMesh edges getting in the way), the opposite animation plays mid-run, or only at the start/end?

    Are you able to take a video?  As Its a visual problem seeing it occur would help understand it better.

    How have you set up your transitions to switch between the left/right animations?  Please post shots of your Animator Controller and the way your transitions are built / what parameter conditions they rely on.
  • Thanks for the quick reply Chris!

    Yep, the single frame glitches occur mid run, without navmesh edges in the way. The multiple frame sticking is usually at destination, although it also occasionally happens mid-run.

    Here is a (terrible quality, sorry) video of the multi-frame glitch;


    and here is my animation controller;

  • Thanks.

    So the R -> L transition occurs if the angle < 180.  Is the opposite true for L -> R?

    It may be that when the character's angle becomes exactly 180, the controller gets confused and the conditions for both transitions become true at the same time.

    Try lowering the angle threshold, ie. R->L if angle < 170, L->R if angle > 190.  That way, it won't immediately switch when 180 degrees, but close enough to it so that the character will still face left/right appropriately.
  • Yep, was set up <180 / >180.

    Changing to <170 / >190 has not solved the issue.
  • edited December 2017
    In that case, I'm inclined to think it may be a platform/Unity issue, since the angle parameter shouldn't be changing wildly like that.

    What Unity version are you using?

    A couple of ideas:
    1) Try using the Direction integer parameter, instead of the Angle float parameter
    2) Try removing the L -> R transitions altogether and see if the glitching still occurs
    3) Try auto-connecting the editor up to the device while running, and then use Debug.Log statements to confirm the angle float parameter value:

    void Update ()
    {
     Debug.Log ("Angle is : " + KickStarter.player.GetSpriteAngle ());
    }

  • using Unity 2017.2.0p2.

    Changing to direction parameter didn't change anything.

    After removing the transitions altogether the glitch still happens, but instead of flipping between left and right anims, it just does the first frame of one direction over and over. Here's another terrible quality video to illustrate - https://www.dropbox.com/s/39ay7p6s0buv8bh/movementglitch.mp4?dl=0

    Don't think I can connect editor and device to debug as I'm building in Windows...

  • edited December 2017
    Looking at the way the white leg completes a cycle, it looks to me more like it's more of a movement glitch.  Is he coming into contact with any colliders?

    There's a "Sprites Unity Complex" variant of the 2D Demo's player character, Brain2D_SpritesUnityComplex, located in the /AdventureCreator/2DDemo/Resources folder.  If you drop him into the scene so that he becomes the player, does the same thing occur?  Conversely, what if you load in the 2D Demo's Managers, and the 2D Demo scene, but have your own Player prefab in the scene instead?
  • Character is not contacting colliders when this happens. 

    Brain2D_SpritesUnityComplex runs perfectly in one of my scenes. No Glitches.

    Also, my character seems to run fine in the demo scene...


  • If your character runs OK in the demo scene, then it could be down to either your own scene, or your game's Managers.  We need to do a bit more "process by elimintation" here.

    Try loading up your own game's Managers, and load up the 2D Demo scene with your own Player.  Unset the "On Start cutscene" field so that playing the scene immediately begins gameplay.  What then?  If the game runs OK, I'd say it's going to lie with your scene - otherwise it could be your Managers.
  • Sorted(I think)!

    Running the demo scene with my character and my managers I could recreate the glitching, so I started comparing the managers and tinkering with settings.

    Seems like changing my Destination Accuracy in movement settings from 1 to 0.9 (as in the demo) has solved the problem :)

    Thank you very much for your help Chris!
  • You're welcome - though I'd like to see if I can learn a bit more about why this would happen if I can.

    How large is your player character's sprite compared to that of the 2D Demo?  Would you mind also posting a shot of the Player's full Inspector window?
  • No problem. Sprite is 330x420. And here's a pic of the inspectors of player and sprite child;

  • Thank you, but I was referring to the sprite's size within Unity - which is separate from the actual pixel size.  If you drag in the "BrainIdle_D" sprite into your scene, how does his size compare?

    It could be due to your massive Acceleration / Deceleration values - try lowering them to something more reasonable.  Generally 30 should be as high as you need in most cases.
  • When dragged into the scene Brain is around 3/4 the size of my character.

    I've now played all the way through the new build without the glitch reappearing, so looks like changing the destination accuracy has fixed it. I'll lower my acceleration/deceleration as well just to be safe...
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.