- Home /
How to Rotate Around obj with iTween
Hi,I'm trying to implement "Rotate Around" with iTween. But as far as I know iTween does not have a method which implement "RA" by itself,so I have to use "Value To" together with "Transform.RotateAround". Then I wrote the following code and played,but as a result,there is a non-negligible error between two angles in rotation on the code and on the actual Game View. I want to rotate obj 180 degrees around the origin,but on the actual Game View,it rotates about 184 degrees. Is there a way to eliminate this error ? Or should I rewrite the code ?
void Start () { var hash = new Hashtable(); hash.Add("time", 1); hash.Add("from", 1); hash.Add("to", 1); hash.Add("onupdate", "RAwithiTween"); hash.Add("onupdatetarget", gameObject); iTween.ValueTo(gameObject, hash); } public void RAwithiTween(float value) { gameObject.transform.RotateAround(Vector3.zero, Vector3.up, 180*value*Time.deltaTime); }
Your answer
![](https://koobas.hobune.stream/wayback/20220612153537im_/https://answers.unity.com/themes/thub/images/avi.jpg)