Gradual UV Pan and Specific Spawn times

Hey there,

How might I go about getting a gradual speed increase using mainTextureOffset? I’m trying to create a panning roadway texture to fake vehicle movement but I can only get it set to a constant speed, whereas I would like it to start off slow but increase to a max speed.

Also, what would be the best way to spawn objects at set times? I’ve been using coroutine and waitforseconds which works, but its kinda hard to keep track of and seems like a clunky way of doing it.

I should mention that I’m using JavaScript,

Thanks

Mathf.Lerp? And for spawning colliders or better triggers?

Thanks Jister.

I got the texture panning half working. It works, but there’s a bit of a jerk when it reaches max speed. Here’s my code:

// Road Script

// Public Vars

var accelerationSpeed : float = 0.1;
var topSpeed : int = 2;

// Private Vars


function Update () {
		
		//  Set UV Pan Speed 
        var roadSpeed = Mathf.Lerp(0, topSpeed * Time.time, accelerationSpeed * Time.time);
    
        // Pan Texture
        renderer.material.mainTextureOffset = Vector2 (0, -roadSpeed);
	
}

As for spawning, it’ll be meshes with colliders, basically props that the player will collide with.