Hi ,
I’ve been searching for a tutorial to make a realistic motorcycle , but I haven’t dug up any results.
So I thought I would come to you guys.
I’m not sure how to start to create the scripts for a realistic motorcycle, so I’m looking for a bit of help ,any help or scripts would be appreciated.
If you don’t have anything better, then you should just start working with a car tutorial, and change the model to motorcycle, and just rotate your motorcycle sideways when turning, it won’t be realistic, but if you tinker with it a lot, you can get quite reallistic look i believe.
#pragma strict
var speed : int;
var MaxSpeed : int = 12;
var LimitSpeed : int = -3;
function Start(){
}
function Update () {
if(Input.GetButtonDown("W")){
if(speed != MaxSpeed){
speed++;
}
rigidbody.velocity = transform.forward * speed;
}
if(Input.GetButtonDown("S")){
if(speed != LimitSpeed){
speed--;
}
rigidbody.velocity = transform.forward * speed;
}
if(Input.GetButtonDown("D")){
transform.Rotate(-Vector3.forward * (Time.deltaTime * 20));
}
if(Input.GetButtonDown("A")){
transform.Rotate(Vector3.forward * (Time.deltaTime * 20));
}
}
But I need it to make the speed int go up when the key is pressed, at the moment I have to press the key several times to make it reach the max speed but I want it to go from 1 to 12 smoothly while the “W” key is pressed.
Plus I would like the bike to keep rotating while I have the “A” key pressed. At the moment it’s taking several key presses.