- Home /
Rotating an object using itween
I want to rotate an object side ways using iTween, but the thing is that it rotates the object in a very weird way in the sense that it also increased the rest of the paraemeters whereas I only want it to rotate in the Y axis.
iTween.RotateTo(gameObject, iTween.Hash("name", "SideWays", "rotation", new Vector3(0, -30, 0), "speed", speed, "easetype", iTween.EaseType.linear, "looptype", iTween.LoopType.pingPong, "oncomplete", "PauseTween", "oncompletetarget", gameObject));
Here is what I have:
How do I get it to rotate sideways then?
What is the perspective of the camera for these drawing...is the camera looking towards positive 'z'. And if you do a Debug.Log(transform.eulerAngles) of the object, what does it report?
@robertbu the debug.log for the object is (270.0, 0.0, 0.0)
Answer by mmangual_83 · Jan 09, 2014 at 08:54 PM
I figured it out. My mistake was that I was using rotateTo rather than RotateAdd:
var props = new Dictionary<string, object>();
props["y"] = 60;
props["speed"] = 40;
props["name"] = "SideWays";
props["easetype"] = iTween.EaseType.linear;
props["looptype"] = iTween.LoopType.pingPong;
props["oncomplete"] = "PauseTween";
props["oncompletetarget"] = _myGameObj;
iTween.RotateAdd(_myGameObj, new Hashtable(props));
Your answer
Follow this Question
Related Questions
How to control a game object's movement in iTween 1 Answer
how to loop an animation 2 Answers
RPC called by OnPhotonPlayerConnected doesn't work 2 Answers
Distribute terrain in zones 3 Answers