Using raycast to touch a 3D object:

I wrote this code and from what I know this should work.

I get no errors and no crashing.

??? what gives?

/
/
/
foreach (Touch touch in Input.touches)
        {
            if (touch.phase == TouchPhase.Began)
            {
                Ray ray = Camera.main.ScreenPointToRay(touch.position);
                RaycastHit hit;
                if (Physics.Raycast(ray, out hit) )
                {
                    if (hit.collider.tag == "card")
                    {
                        card.transform.rotation = Quaternion.Euler(0, 90, 0);
                    }
                }
            }
/
/
/

We have no idea what gives, because you haven’t told us what’s happening. For all we know it’s working perfectly.

All that does is set the rotation of an object to (0, 90, 0) when you touch it if it is tagged as a card. Are your objects tagged as cards? Are their initial rotations something other than (0, 90, 0)? Are your casts actually hitting them? Do they have colliders to be hit?

Yes to all of the above penguin. I am having a hard time debugging it because I am pushing it to an android device.

Is it written properly?

It’s working thnks for your help penguin…:)…lol

So I got this working, but the object only rotates when I touch it. Do I need to fire a function to make it do the entire rotation I want…Or should I just do an animation??