Simple enough, lift the card off the table flip it over 180 degrees and place it back down, by clicking on it.

I can do the raycasts on click but i just can’t think of how to flip it over. i was thinking a while loop in a coroutine?

help :3

Edit:

So I do not want to use animations I spent some time and come up with the rotation code and just need now to make it move up a bit after that.

```
using UnityEngine;
using System.Collections;
public class FlipCard : MonoBehaviour {
private bool m_CanFlip = true;
private bool m_Match = false;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
if (Input.GetMouseButtonDown(0))
{
RaycastHit hit;
Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
if(Physics.Raycast(ray, out hit))
{
Debug.Log(tag);
if(hit.collider.CompareTag("Card"))
{
StartCoroutine(CardFlip());
}
}
}
}
private IEnumerator CardFlip()
{
Quaternion angle = Quaternion.Euler(0, -180, 0); Quaternion reverce = Quaternion.Euler(0, 0, 0);
if(m_CanFlip == true)
{
while(Quaternion.Angle(transform.rotation, angle)>5)
{
transform.rotation = Quaternion.Slerp(transform.rotation, angle, Time.deltaTime * 5);
yield return new WaitForEndOfFrame();
}
transform.rotation = angle;
m_CanFlip = false;
}
if(m_Match == false)
{
yield return new WaitForSeconds(1.5f);
while(Quaternion.Angle(transform.rotation, reverce)>5)
{
transform.rotation = Quaternion.Slerp(transform.rotation, reverce, Time.deltaTime * 5);
yield return new WaitForEndOfFrame();
}
transform.rotation = reverce;
m_CanFlip = true;
}
}
}
```

So what this does is on click it will flip the card and then after some time it flip back over is the Bool m_Match is false (as later there will be more cards and I will compare there tags to see if they match) but now I need this to also raise the card very slightly on click before it flips.

Thanks!