I have a State Machine that is moving and rotating a card. Once it is close to the destination, I need to stop moving and rotate back to 0. This is part of that code. The object will not rotate back to 0 no matter what I do. Please help.
if (!this.moveCompleted)
{
var step = speed * Time.deltaTime;
angle += speed * Time.deltaTime;
if(Mathf.Abs(this.card.transform.position.y) - Mathf.Abs(this.moveToLocation.y) < 0.1f)
{
//rotate back to 0
this.card.transform.rotation = Quaternion.Euler(0,0,0);
//done moving
this.moveCompleted = true;
this.moveResultsCallback(new MoveResults(this.flipCard));
}
this.card.transform.position = Vector2.MoveTowards(this.card.transform.position, this.moveToLocation, step);
this.card.transform.rotation = Quaternion.Euler(0, 0, angle);
}