Question by
blackened_led · Feb 28, 2017 at 02:00 AM ·
animationrotationmouse click
Sprite rotation clip & ending position
Hi you all, I'm a newbie at Unity and I'm having some problems trying to rotate a simple sprite with animations. Here is what I have:
A standard button sprite that should make a 90º turn on each mouse click (that's what the justTurn clip for). This is the code related to the mouse click + trigger thing:
void Update()
{
var mp = Camera.main.ScreenToWorldPoint(Input.mousePosition);
if (Input.GetMouseButtonDown(0) && srCollider.OverlapPoint(mp))
{
animator.SetTrigger("justTurn");
}
}
Now here is the point: after the turn animation, the idle clip makes the button go back to its original rotation state. But what I'm looking for is to keep on its ending state (in the picture, the button should point down after the first click, but it goes back pointing right).
Any idea?
Thanks a lot
scenario.jpg
(95.3 kB)
Comment