- Home /
2D Sprite leaves a trail when moving diagonally
Hello! Sorry for my poor English!
My problem: I'm trying to diagonally move some object with large speed. Move script taken from this tutorial. Quote from it:
Vector3 target = moveDirection * moveSpeed + currentPosition;
transform.position = Vector3.Lerp( currentPosition, target, Time.deltaTime );
My example sprite is:
And i got move effect like this:
I can't even catch it on a screenshot, so i forged it in Paint:) This occurs in build for PC with any quality settings (but not in Unity Editor!) and also on Android Tablet. When I slow down move speed in script movement is fine perfect, there no blinks and trails, but it's not acceptable for me. When I move object straight, not diagonally. It's better, but not good either. In the project from tutorial I can set any speed and there is no such effect. I tried different options of sprite's import (filter mode - point, bilinear, pixels per units and so on), but no luck, bc I don't actually understand what i'm doing.
Help me please. Thanks!
Answer by raitkxel · Feb 11, 2015 at 02:28 AM
Hey brother! I was also facing same problem and com up with a solution. Simply set your 2d camera clear flags value to Solid color or to sky box OR ues a screen background with no alpha channel.
I think problem is when sprites render on some area with alpha channel they render themselves evey frame as mentioned in unity docs. So there should be some non alpha thing (either camera background or some screen full background image) behind sprites.
Hope that helps. Thank you