Hi, i’m creating a script to roll a motorcycle. I use the rigidbody.AddForce to move forward and the rigidbody.AddTorque to spin my moto but when i do it, it doesn’t work like i want.
This is my script… Please somebody to help me:
class Zem_Controller:MonoBehaviour
{
public float speed_translation = 100.0F;
public float speed_rotation = 100.0F;
private Vector3 movement_zem;
void FixedUpdate()
{
//if (Input.GetKey (“d”))
float movement_forward = Input.GetAxis (“Vertical”);
movement_zem = new Vector3(0.0F,0.0F,movement_forward);
rigidbody.AddForce (movement_zem * 5 * speed_translation );
float movement_rotation = Input.GetAxis (“Horizontal”);
movement_zem = new Vector3 (0.0F, movement_rotation, 0.0F);
rigidbody.AddTorque (movement_zem * 1000 * speed_rotation);
}
}