Ok I have a 3 lane cargame - think Spy hunter side on. and I am using AddForce to swap lanes. This works fine.
But what I need to do is Kill the force in in the z axis, allowing it keep it’s speed and Stop the car on each lane - I can Translate it no problem but I want it to move smoothly
Any Ideas? Thanks!
public void switchLanesUp()
{
if (zActive == true)
{
switch (currentlane)
{
case 1:
rigidbody.transform.Translate(0, 0, 0);
break;
case 2:
rigidbody.AddForce(Vector3.forward * 200 , ForceMode.Acceleration);
currentlane = 1;
break;
case 3:
rigidbody.AddForce(Vector3.forward * 200 , ForceMode.Acceleration);
currentlane = 2;
break;
}
Debug.Log ("Switched lanes Up " + currentlane);
}
}
Void FixedUpdate() {
if (rigidbody.position.z >= 3 )
{
Debug.Log ("STOP");
rigidbody.transform.Translate(0, 0, 0);
}
}