So I want to make a 3d platformer with endless level. I heard that its better when the obstacles are moving towards you. So I have a tube where the player is inside and when it gets to certain Z (behind the camera) it destroys and spawns a new one with certain speed. However even when I applied rb.velocity , the cloned tube is slower…
I have these scripts
public Transform prefabTube;
public Vector3 offset;
void Update()
{
if (this.transform.position.z <= -510)
{
Instantiate(prefabTube, offset, Quaternion.Euler(90, 0, 0));
Destroy(this.gameObject);
}
}
and velocity
public Rigidbody rb;
public float speed = 2000f;
void Start()
{
rb.velocity = new Vector3(0, 0, -speed * Time.deltaTime);
}
I don’t really get it when .velocity should add constant speed…