I am making a puzzle game in Unity. I have several
GameObjects that have children objects where each child object has a
The game requires that the pieces be rotated, but to position them correctly, they also need to be translated under certain rotations. I thought a good way to handle this would be using an animator that has 0, 90, 180 and 270 degree states. When the objects are by themselves, I have this working correctly.
The problem I am having is when there are two adjacent
GameObjects. When the user tries to rotate a block and the rotation would result in overlapping colliders, I want to ignore the rotate command and do nothing. Traditionally, this would mean that I would rotate the piece, check collisions, and if there is a collision, rotate back in the same
My question is: Is there any way after telling the animation to rotate i.e.
animator.SetFloat("Rotation",animator.GetFloat("Rotation") + 90);
to subsequently tell it to jump to the last frame of the new animation state so that I can check collisions on it and then revert the animation to its original position if there is a collision -- all in the
Or am I better off ditching the
Animator and doing it myself?