How do I flip a 3d checker piece to the other side?
I am building a checker game for my first Unity app and I have a lot of the basics down with movement. I am using Vector3.SmoothDamp to move my pieces along the board, but I am having a difficult time trying to find a way to flip the piece around to a "King" when a piece move to the other end of the board.
I know that Vector3.SmoothDamp only deals with the transform position X/Y/Z so I need to find something that deals the same way with the position.
This is how I'm doing my piece movement across the board:
if (Vector3.Distance(transform.position, targetPosition) > smoothDistance)
{
transform.position = Vector3.SmoothDamp(transform.position, targetPosition, ref velocity, smoothTime);
}
And it's working great.
I have found examples like this one...
transform.rotation = transform.rotation * Quaternion.AngleAxis(2f, Vector3.back);
That do exactly what I want it to do, but this does it forever. I want to life the piece off the board (using Vector3.SmoothDamp) and then flip it 180 degrees (which I don't know how to do) and then bring the piece back down (also using Vector3.SmoothDamp). I think I have the transform code right, I just don't know what the if statement should be around that code to make it only happen once.
Any help with this would be greatly appreciated.