- Home /
Jittery movement of sprite on device
I have a 2D sprite that is moved by the following simple code:
var DurationInSeconds = 3f;
public void Update()
{
progressTime += Time.smoothDeltaTime;
transform.position = Vector3.Lerp (origin, destination, progressTime / DurationInSeconds);
}
In the editor/newer Android devices, this works well.
On a particular device (Samsung Galaxy Tab 2), the movement of this sprite is jittery and does not seem smooth.
I've seen numerous questions regarding jittery or stuttered movement with no real answers on how it can be resolved.
Answer by jceipek · Jun 20, 2014 at 05:19 PM
Different devices will have different framerates. I would suggest using FixedUpdate()
instead of Update()
and updating the position using Time.fixedDeltaTime
. Unity will call FixedUpdate()
independently of the framerate, so it should look much more consistent on different devices.
Your answer
Follow this Question
Related Questions
The name 'Joystick' does not denote a valid type ('not found') 2 Answers
Making a bubble level (not a game but work tool) 1 Answer
Problem with player movements 1 Answer
Why is Input.GetAxisRaw() not returning whole numbers when using a joystick? 1 Answer
mystery RestartLevel function used in official tutorial 2 Answers