Answers for "Unity 2D Rotate Problem!"
http://answers.unity.com/questions/509768/unity-2d-rotate-problem.html
The latest answers for the question "Unity 2D Rotate Problem!"Answer by robertbu
http://answers.unity.com/answers/509896/view.html
The easy way to do this is to use a empty game object with the visible object as a child. You would then detect the left/right and do whatever flip you wanted to the child.
dir = screenPos - transform.position;
if (Vector3.Dot(dir, Vector3.right) > 0) {
child.localRotation = Quaternion.Euler(0,0,0);
}
else {
child.localRotation = Quaternion.Euler(0,180,0);
}
The rotations here are just placeholders. You will need to figure out what rotation you want in the inspector and then fill in the correct values. I would be more efficient to precalculate the rotations in Start() and then just assign the Quaternion in Update().
Start() {
qLeft = Quaternion.Euler(0,180,0);
qRight = Quaternion.Identity;
}Wed, 07 Aug 2013 17:39:46 GMTrobertbu