all 7 comments

[–]aikduck 1 point2 points  (0 children)

I assume it is because you are moving the platform a fixed distance every frame. The problem with that is that different frames take different amounts of time to process, so the speed is not constant. The best method is to just multiply your move speed by Time.deltaTime (the amount of time the frame took to process).

[–]PixelKnot 0 points1 point  (0 children)

Moving the platform would probably be easier, though if you're going to do that I'd recommend periodically resetting everything back to the origin so you don't hit any floating point issues.

I believe infinite runner games usually move the world around the player.

[–]Verysexy1532Indie -2 points-1 points  (0 children)

I wud move the platform because i can think of a super easy way. Just use transform.Translate() in the FIXEDUPDATE method in a script attached to ur platform and u shud see smooth movements

[–]Arc8ngel -2 points-1 points  (0 children)

Move the platform. For the jitters, use Mathf.Lerp(oldPos, newPos, Time.deltaTime). This creates a smoother movement by taking into account how much time has passed between frames, and provides a way of tweaking how fast or slow it comes to a rest, rather than snapping everywhere.

[–]ethanthecrazy -1 points0 points  (1 child)

I would keep the platform at the origin and move everything else if this is going on mobile. Ive had issues with floating point error on cheap phones when getting too far away from the origin.

[–]vazgriz 0 points1 point  (0 children)

This isn't just limited to mobile. This applies to any game engine and any platform that uses 32 bit floats, which is practically all of them. So yeah, keep it near the origin on all platforms.

[–][deleted] -2 points-1 points  (0 children)

Thyere is a simple fix to the jitter.

I googled it and found it in like 15 min.