**Summary:**
I am creating an infinite runner. I have an object in my scene that is permanently moving to the left ("Scroller"). Whenever I create obstacles, I parent them to the "Scroller". Once they move off screen, I set them to inactive. The player object does not move at all, nor does the camera. Both of these objects are 100% stationary, as the Scroller object is doing all of the movement. **Problem:**
The movement of the one parent object is jerky in the editor (thus causing the children objects to jitter), and there is very jerky movement in non-development WebGL, PC and Android build. **More Details and Reiteration:**
- Each obstacle has a rigidbody attached. - The jitter occurs randomly, sometimes few seconds, sometimes every frame. - There are no more than 20 obstacles active at any point in time. - Only the "Scroller" object is moving, and every other object is being parented to it - I am instantiating one of many Obstacle collections, and then parenting that collection to the "Scroller." To reiterate that last point, my hierarchy looks like - Scroller -> Obstacles Parent - > Obstacle, Obstacle, Obstacle **Script**
My movement script: private void Update() { scroller.position = Vector3.Lerp(scroller.position, scroller.position + new Vector3(-1, 0, 0), Time.deltaTime * speed); //scroller.position += new Vector3(-1, 0, 0) * (Time.smoothDeltaTime * speed); } Using LateUpdate provides roughly the same experience, give or take a few hairs from my head.
I am creating an infinite runner. I have an object in my scene that is permanently moving to the left ("Scroller"). Whenever I create obstacles, I parent them to the "Scroller". Once they move off screen, I set them to inactive. The player object does not move at all, nor does the camera. Both of these objects are 100% stationary, as the Scroller object is doing all of the movement. **Problem:**
The movement of the one parent object is jerky in the editor (thus causing the children objects to jitter), and there is very jerky movement in non-development WebGL, PC and Android build. **More Details and Reiteration:**
- Each obstacle has a rigidbody attached. - The jitter occurs randomly, sometimes few seconds, sometimes every frame. - There are no more than 20 obstacles active at any point in time. - Only the "Scroller" object is moving, and every other object is being parented to it - I am instantiating one of many Obstacle collections, and then parenting that collection to the "Scroller." To reiterate that last point, my hierarchy looks like - Scroller -> Obstacles Parent - > Obstacle, Obstacle, Obstacle **Script**
My movement script: private void Update() { scroller.position = Vector3.Lerp(scroller.position, scroller.position + new Vector3(-1, 0, 0), Time.deltaTime * speed); //scroller.position += new Vector3(-1, 0, 0) * (Time.smoothDeltaTime * speed); } Using LateUpdate provides roughly the same experience, give or take a few hairs from my head.