Hi All, I just want to move unity placeholder sprite with Vector2.MoveTowards function. No collider or rigidbody attached to the gameobject. However it gets jittery at the edges while move. The sample video is from the mobile build (same as PC). Is it due to my script or something related to graphics, default settings etc? Thanks. Code (CSharp): public class move : MonoBehaviour { public Vector2 target = new Vector2(0, 7); void Start () { } void FixedUpdate () { transform.position = Vector2.MoveTowards(new Vector2(transform.position.x, transform.position.y), target, 3 * Time.deltaTime); } }
This can a broad topic with many solutions available. Setting the "Application.targetFrameRate" by 60 instead of default 30 for mobile seems the least complicated solution for now. Thanks all.
For the smoothest motion you should be doing the above Transform change in "Update" (per-frame) rather than "FixedUpdate". Also, "FixedUpdate" can be called multiple times per-frame in many cases resulting in you seeing it move several steps in a single frame (not necessarily the reason you get jitter here).