Hi there.
I've decided to upgrade to Sprites Unity Complex from Sprites Unity for more control. I'm making a 2D game and have created L, R, U & D animations for Idle and Walk. I have referred to the Brain demo sprite and used the same settings apart from not adding the diagonal directions. I've used the angle parameters - D=0, L=90, U=180, R=270 and D=360.
The problem I have is with gliding. For example, when navigating at around 82 degrees left, my sprite switches to the idle cycle for a moment and then reverts back to the correct left walk cycle. My sprite is navigating around the nav mesh which is an 'L' shape. So when I start at the middle of the bottom horizontal line of the 'L' and move my sprite to the top left of the 'L' is glides for a moment. Granted, I believe I'm trying to move in a diagonal left direction.
I've had a go at changing acceleration, walk speed etc but nothing seems to reduce or preferably eliminate the problem. I also tried adding in the diagonal directions by duplicating my left and right cycles to mimic the Brain prefab, but that didn't improve it either.
So, should I use the Direction Integer instead or is there another way to improve it please?
For reference I'm using the most up to date versions of Unity and AC.
I wasn't able to capture a screen shot quick enough but when my sprite glides, the transition appears as Idle.
Please let me know if you need any further information. Thanks
https://imgur.com/D3GLuwx
Comments
Whether you use the Direction Integer or the Facing angle Float is really a choice of convenience. If you only have animations for the four cardinal directions, it shouldn't make a difference.
Let's see some screens of the Player's full Inspector, as well as the transition properties.
Bobcat, I tried your suggestion of exit time to 1 and untick the box which made no difference but I thought if you untick the exit time box it would disable it anyway?
Chris,
Q. When the Idle states are playing, what is the "Move speed" parameter's value
A. Move speed parameter = 0 and then accelerates to 1 where the sprite will start walking again.
All my Idle and Walk animations have 24 frames. Would this make a difference?
Q. And at what point does this occur?
A. The issue occurs in the middle. So for example, the Sprite will be at the bottom right of the screen. I will click on an area towards the top left of the nav mesh. The player will walk left for a moment, the speed decelerates to 0 where she'll then glide for a second or two and resume walking when she is able to face up. And at that point the speed will accelerate back up to 1.
The only other thing I can think of is that I've changed the original Prefab player's method to Unity Sprites Complex rather than creating a new Prefab in this particular scene only, as I'm just testing it out at the moment before I create a new Prefab. I'm using the same animations so perhaps it's trying to play the original Unity Sprites method?
Screen shots located in the below link. Do let me know if you require anything further. And thanks again for taking the time to look into my issue.
https://imgur.com/a/C2b2w
I suspect that this is due to the "Slow movement near wall colliders?" option, which shouldn't be used when using Point And Click movement, as it's intended to prevent players from playing walk animations when directly-moving into walls. What is your movement method?
If I'm wrong, and disabling the option makes no difference, does the Brain2D_SpritesUnityComplex player prefab have the same behaviour? You can test him out by dropping him into your scene file so that he overrides the default prefab.
Chris, movement method is 'Point and Click.
And we have the solution. It was the 'Slow movement near wall colliders' checkbox option after all. I didn't even consider that. And yeah, I used Brain prefab in the scene initially as a comparison while I was putting it together and he worked perfectly hence why I was so stumped as my animator appeared to be correct. She's now moving around as expected
Once again, thank you! I can now work on adding my other animations to the controller so it doesn't look so cluttered and confusing.