- Home /
Help with >Input.GetMouseButtonDown(0)<
Hey everyone, im working in a TCG game, and i need a script, to turn the card over 180º when I click on it.
I use this script:
function Update ()
{
if ( Input.GetMouseButtonDown(0))
transform.Rotate(0, 180, 0);
//transform.position = Vector3(10, 10, 10);
}
But when i click over a card all the cards with this script turn over. I need to only, the one under the click to rotate. I alredy try, OnMouseEnter, OnMouseOver, Raycast... Probably I did it in the wrong way. But alredy try everything.
Help plz :C
Answer by robertbu · Apr 27, 2014 at 10:44 PM
You can use OnMouseDown():
function OnMouseDown () {
transform.eulerAngles = Vector3(0.0, 180.0, 0.0);
}
$$anonymous$$an I fking love you! Thanks!
I dont know what
transform.euler.eulerAngles
$$anonymous$$eans, and dindt work this way, but change for mouse down just like you said
function On$$anonymous$$ouseDown () { transform.Rotate(0, 180, 0); } and work thanks a lot!
It should have been just 'transform.eulerAngles'. I fixed the line in the original answer. Glad it worked out for you.
Your answer
Follow this Question
Related Questions
How do I get monodevelop to run faster? 1 Answer
Help play animations medium-difficulty 2 Answers
animation.Play("tiro", PlayMode.StopAll); not working 0 Answers
array index is out of range (C#) 2 Answers
Please help with Mouse aim? 0 Answers