Gaps between path spawns
Hello again Unity community,
In my runner game, I have an array of trail pieces that make up the course of a level. The trail spawner works by finding the top right corner of the previous trail piece’s collider, and positioning the next trail piece’s top left corner at that location.
//simplified
nextTrailPeice = Instantiate(trailPeices[currentIndex], TopRightCornerOfCurrent, Quaternion.identity);
These trail pieces have a script on them that translates them to the left.
//also simplified
Vector2 offset = Vector2.left * (gameSpeed/divisor) * Time.deltaTime;
transform.Translate(offset);
Working perfectly:
This works perfectly until I increase gameSpeed or when the latency increases. When that happens, the trail pieces will spawn with a gap between them. Removing the time.deltaTime multiplier helps, but doesn't fix the problem.
The colliders separate:
Your answer
Follow this Question
Related Questions
Spawning with trigger 2 Answers
Flag capture with spawning and destroying gameObject 0 Answers
Box Collider for animating characters. 0 Answers
How to use Animation Event in this case ? 1 Answer
How do I make onCollisionStay work? 1 Answer