Quantcast
Viewing all articles
Browse latest Browse all 146

How to i make a gear system from this script? help please

Hello, i searched this from a long time, how to i make a gear system from this audio pitch script? (depending the car speed) Thanks! var minPitch : float = 1.0; var maxPitch : float = 2.0; var maxSpeed : float = 20.0; //tweak to your vehicle private var pitchModifier : float; function Update(){ var currentSpeed = rigidbody.velocity.magnitude; pitchModifier = maxPitch - minPitch; audio.pitch = minPitch + (currentSpeed/maxSpeed)*pitchModifier; if(audio.pitch > maxPitch) { audio.pitch = maxPitch; } }

Viewing all articles
Browse latest Browse all 146

Trending Articles