- Home /
Question by
EliteHedgehog56 · Jul 10, 2019 at 08:59 AM ·
physicsaccelerationarcademario kart
Acceleration, deceleration and kart style drifting
hey guys, I am making a kart racer and I am currently creating the kart controller script, currently I am trying to add acceleration, deceleration and a simple mario kart style drifting ability, how would I implement this?
Here's my code so far:
var speed : float = 10.0;
var turnspeed : float = 100;
function Update (){
//add acceleration and deceleration
thrust = Input.GetAxis("Vertical");
turn = Input.GetAxis("Horizontal");
transform.Translate(thrust*Vector3.forward*Time.deltaTime*speed);
transform.Rotate(turn*Vector3.up*Time.deltaTime*turnspeed);
if (Input.GetAxis("Drift"))
{
//mario kart style drifting when the drift button is held down
}
}
Comment
Your answer
Follow this Question
Related Questions
strange unrealisticly physic problems about velocity/gravity acceleration 2 Answers
Custom Acceleration 1 Answer
Confusion with AddForce with ForceMode.Acceleration 1 Answer
How to drive Rigidbody.AddForce acceleration correctly from Update 1 Answer
Accelerate a rigidbody towards max speed 2 Answers