[17435-img001+(2).jpg|17435]
I have attached an image to help explain what is currently happening with my script. I have an equilateral triangle I am trying to rotate around an axis at 120 degree intervals, stopping at each interval until the statement is triggered again (120 degrees because the triangle will rotate into a similar position, with the vertices shifted, from “B” to “C” in the drawing). The triangle is not orthogonally (drawing “A”), so I am using unity’s Transform.RotateAround function. I have the script generally working, but I have two questions and one issue.
Q1)The script works when I use 90 degrees, instead of 120 degrees, does anyone know why this is?
Q2)Why do I need to return the rotationAngle variable to zero for the triangle to stop rotating?
I1)The script works for about six iterations, then it becomes noticeable that the triangle is slightly deviating from the original position (drawing “D”). This deviation continues to get worse. I’m hoping this is just an issue caused by Q1 or Q2 and will be fixable after I understand what is happening.
//The following is the code I am currently using inside of the conditional statement
rotationAngle = rotationAngle + 90.0f;
GameObject.transform.RotateAround(rotationAxis,rotationAngle);
rotationAngle = 0.0f;