hello! i just wanted to create a small carrera rc slotcar kinda game. but i stuck at the part where the car should drive in a curve. the code looks simple as this: Code (CSharp): using UnityEngine; using System.Collections; public class Carrera : MonoBehaviour { public float accerleration; void Update () { if (Input.GetKeyUp(KeyCode.DownArrow)) { this.gameObject.GetComponent<Rigidbody>().AddForce(this.gameObject.transform.forward * accerleration, ForceMode.Acceleration); } if (Input.GetKey(KeyCode.DownArrow)) { this.gameObject.GetComponent<Rigidbody>().AddForce(this.gameObject.transform.forward * -accerleration, ForceMode.Acceleration); } } } but the problem with this is that: i somehow have to tell the rigidbody that he should rotate to the left in the curve or something like that. but how?
Rotate RB in direction of moment transform.rotation = Quaternion.LookRotation(rigidbody.velocity); i think above will work. .