unity3d – Object Generation Gaps
Help me understand what the problem is in Unity3D.
I generate an infinite number of blocks in motion.
But the higher the speed of movement, the larger the gap between objects. As far as I understand, the gap will be sampled due to the frame refresh time.
How to generate objects close to each other?
void Update()
{
if (startspawn)
{
spawn1 = Instantiate(spawner);
spawn1.GetComponent<Rigidbody>().velocity = new Vector3(15, 0, 0);
startspawn = false;
}
if (spawn1.transform.position.x - startcoordinateX > size)
{
spawn2 = Instantiate(spawner);
spawn2.GetComponent<Rigidbody>().velocity = new Vector3(15, 0, 0);
spawn1 = spawn2;
}
}
Read more here: Source link