Motorcycle

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.

Thanks ,
Hawx

Bump.

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.

Ok , so I’ve got this:

#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.

You want to use input.GetAxis instead of the button down for this kind of stuff: Unity - Scripting API: Input.GetAxis

would you be able to post an example of how that would work? I’ve never tried Input.GetAxis

float vertical = Input.GetAxis("Vertical");
rigidbody.AddForce(transform.forward * vertical * 20 + transform.up * 5, ForceMode.Acceleration);

Here is a line I use in my project. You will have to adjust the parameters though. Same works for “Horizontal”