- Home /
2D Unity games - player movement stuttering/jittering?
I'm having an issue with objects looking as if they are moving smoothly. I have no issues with framerate. Vsync is on so I run a steady 60 fps at all times. The current project that I am working on has two cubes for platforms and a cube so the player can jump back and forth. This is a very simple task, yet the movement looks sloppy and jerky. Is this an issue with unity, or is there a setting that I need to change? I have messed with the timestep to check to see if that was the issue. It did cause the cube to move -slightly- smoother but it caused the physics to act a little funky as well. I could fix the physics, but all of this seems unnecessary, so I set it back to default now. I originally thought it was my smooth follow camera script, but after removing it, the jerkiness was still there.
The code for moving the cube is transform.Translate (.1f, 0, 0); and rigidbody2D.AddForce (Vector3.up * 80); for jumping.
Almost forgot, there is a directional light in the scene as well. I'm going to try deleting it real quick. -Edit: No change after deleting the directional light.
Does anyone know how to fix this? or what the issue is?
My Unity version is 4.6.0b17, but I have had issues with non beta versions as well.
I just created a new project to make sure it wasn't the scripts or anything that I may have changed and didn't realize. The scene consists of only: $$anonymous$$ain Camera; Cube with is$$anonymous$$inematic and fixed angle turned on; Cube with gravity turned on.
This is as simple as it gets and it still jitters until the cube lands.
Could my monitor be causing this issue? It has happened on the few I$$anonymous$$acs that I have used as well.
Answer by felixwcf85 · Mar 26, 2017 at 02:17 PM
Solved my problem by switching LateUpdate function to FixedUpdate in my Camera script.
Nice. I will keep that in $$anonymous$$d when I go back to that game. It will be a while before I go to it again though.
THIS SOLVED IT! Had the same Issue, I had code that made the camera follow the character on the body of a LateUpdate, changed it to FixedUpdate and now everything looks as smooth as it should!
Answer by siddharth3322 · Dec 30, 2014 at 05:14 AM
I have some suggestion for you. You have to give try to any of these options, which one work for you that I don't know. But generally any of these setting are working.
In rigidbody component, try to change interpolate option of your stuttering object. Generally I prefer interpolate for my games.
In Edit->Project Settings->Time, set both value same. At present Fixed Timestep value is 0.02f. Set it for Maximum Allowed Timestep. Here changing of values are acceptable because which value work for you depend on your game.
In Edit->Project Setting->Quality, Play with vSyncCount values. I hope, I can able to give you some useful help.
I have tried setting the rigidbody2d to both extrapolate and interpolate. Didn't fix it.
VSync Count - Tried all three of the settings there. Every VBlank works best but that was what I had it on already. I think its the default setting?
I set the $$anonymous$$ax Timestep to match the Fixed Timestep. Still didn't work.
I tried combos of each of these.
Thanks for the help, Siddharth.
But since none of those worked, I tried just dragging the cube with the translate tool and it still seemed a bit jerky. It may have been my hand, but I tried to be as smooth as possible. Can monitors cause this issue?
Your answer
Follow this Question
Related Questions
A node in a childnode? 1 Answer
Need help with screen resolution and character size 1 Answer
A Question about sprites 3 Answers
Move Object With Angle In 2D 1 Answer