- Home /
Question by
Wolk · Jun 07, 2018 at 12:15 PM ·
rigidbody2dsmoothjitteringsmoothingaddforce movement
Rigidbody 2d smooth movement problem (It's jerky)
Hello, i'm using the following code to spawn and move a rb2d object.
var bullet = Instantiate(Resources.Load<GameObject>("arrow_prefab"), new Vector3(0, 1, 0), arrow.transform.rotation);
bullet.GetComponent<Rigidbody2D>().AddForce(bullet.transform.up * speed, ForceMode2D.Impulse);
However the results are as following:
fame 1:
frame 2:
Thus you get a feeling of the object jumping and not moving smoothly. The camera is static, rb2d settings are set to interpolate, and physics fixed timestep is set to 0.033, Application.targetFrameRate = 60 and vsync to every blank.
Changing the fixed time step to 0.003 seems to improve the movement a lot, but it is still a bit jerky
Comment
Best Answer
Answer by Wolk · Jun 07, 2018 at 02:55 PM
Got it! My problem was that the scale of my objects was 0.1 and the orthographic camera's size was 5. I've changed the ortographic camera's size to 16.5 and objects are now 0.4 and it works a lot smoother!