speedpad juice

Cubes Wot Go Faste

Cubes Wot Go Faste

Juicing up a speedpad isn’t terribly difficult. There’s obviously always more you can add, but for now, this works. I literally implemented speedpads last night! It’s great how modular I made my game as to make asset creation so easy.

The way I have speedpads work is by merely adding a force to any rigidbody on the pad over time.

void OnTriggerStay(Collider other){
if (other.rigidbody != null){
other.rigidbody.AddForce(transform.up * force * Time.deltaTime);

Truncated, of course. And I can’t be bothered to fix up WordPress messing up my indentation. It hurts to look at, but bear with me.

This is a very simple function—it merely looks at anything touching the speedpad’s trigger, and then adds force to it. I use transform.up because that’s the way my chevrons are facing in relation to the gameObject’s orientation.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s