Hi, I’m trying to implement a code that does the following :
-Imagine a shape that has a 4 sides : Top, bottom, , left and right. Let’s assume we start with the bottom face facing us, when clicking on any face, said face will rotate so that it is now facing us.
While I’ve already implemented the whole “get which face you clicked on and start rotating”, I’m a bit confused as to how exactly I should code the rotation for it to look good.
My current code (using iTween) looks like :
iTween.RotateAdd(hitTransform.gameObject, iTween.Hash("amount", new Vector3(currentRotation.x + (currentRotation.x - 90F), 0F, 0f), "time", 1f, "oncomplete", "EndRotation", "oncompletetarget", this.gameObject));
Which is, as you can imagine, doesn’t work properly. What I want is basically to get the current rotation on the x.axis and then, depending on where I clicked, rotate towards it using the shortest path possible (and without rotating on any other axis)
Sorry if that isn’t clear, thanks a lot for your help!