# 180 degrees

How would I add a line to this so it resets at 180 degrees from its current position

its the restart when stuck script, I always end up restarting facing backwards. I also find that reverse is 10x faster than forwards, and no matter how symetrical the car is, it always goes around in a circle.

``````var stuckTimeLimit = 5.0;

var startPosition : Transform;

private var stuckTime = 0.0;

// get all wheel colliders down the hierarchy
private var wheels : Component[];
wheels = GetComponentsInChildren(WheelCollider);

function Update ()
{
if( !IsAnyWheelGrounded() || IsCarStuck() )
{
stuckTime += Time.deltaTime;
if( stuckTime > stuckTimeLimit )
{
ResetCar();
stuckTime = 0.0;
}
}
else
{
stuckTime = 0.0;
}
}

function IsCarStuck()
{
var rpm = 0.0;
for( var w : WheelCollider in wheels ) {
rpm += Mathf.Abs(w.rpm);
}
rpm /= wheels.Length;
return ( rpm > 10  rigidbody.velocity.sqrMagnitude < 0.01 );
}

function IsAnyWheelGrounded()
{
for( var w : WheelCollider in wheels ) {
if( w.isGrounded )
return true;
}
return false;
}

function ResetCar()
{
if( startPosition )
{
transform.position = startPosition.position;
transform.rotation = startPosition.rotation;
}
else
{
transform.position = transform.position + Vector3(0,10,0);
transform.rotation = Quaternion.identity;
//Hey do I do something here?Cheers guysAC
}
rigidbody.velocity = Vector3.zero;
rigidbody.angularVelocity = Vector3.zero;
}
``````

Id love to post my car here and if someone could check it out, they can use it themselves? Anyone keen?
AC

So if the key statement lies here, how do I rewrtite the rotation with a 180 degree shift about the y axis?

`````` {
transform.position = transform.position + Vector3(0,10,0);
transform.rotation = Quaternion.identity;
//This is origional
}
``````
``````{
transform.position = transform.position + Vector3(0,10,0);
transform.rotation = Quaternion.identity + Vector3(0,180,0);
}//this doesnt work
``````
``````{
transform.position = transform.position + Vector3(0,10,0);
transform.rotation = transform.rotation + Vector3(0,180,0);
}//this doesnt work
``````

Obvious to me is that vector 3 refers to translation. How do I express this in terms of rotation?incl 180 degrees?
Thanks
AC