- Home /
How to rotate a plane without flipping it [iTween]
Hi, I am trying to perform a very simple tweening rotation of a plane within my scene. Here are the data points:
var bin1spin = Vector3(150, 90, 270);
var bin2spin = Vector3(95, 90, 270);
var bin3spin = Vector3(40, 90, 270);
var bin4spin = Vector3(-15, 90, 270);
var bin0spin = Vector3(292, 90, 270);
the thing is, when I animate from 4 > 3 > 2 everything works perfectly and smoothly, but from 2 > 1, the plane does some kind of 'flip' along the way. It also does the errant flip from 1 > 2 > 3, while it works smoothly and fine from 3 > 4
Please help!!!
here is the trigger code:
if (Input.GetKey ("1")){
iTween.RotateTo(binHighlight,{"rotation":bin1spin,"time":.8});
}
if (Input.GetKey ("2")){
iTween.RotateTo(binHighlight,{"rotation":bin2spin,"time":.8});
}
if (Input.GetKey ("3")){
iTween.RotateTo(binHighlight,{"rotation":bin3spin,"time":.8});
}
if (Input.GetKey ("4")){
iTween.RotateTo(binHighlight,{"rotation":bin4spin,"time":.8});
}
if (Input.GetKey ("5")){
iTween.RotateTo(binHighlight,{"rotation":binXspin,"time":.8});
}
Answer by wgrand · Aug 15, 2011 at 05:27 AM
Did you figure this out?
Not yet. $$anonymous$$y interim solution was to remove the animation entirely, just using:
binhighlight.transform.localEulerAngles = binXspin;
I'm fairly positive that I can accomplish this once I have a better understanding of quaternions, but its time to SHIP IT! :) ALLTHOUGH, just answering this, I might be able to accomplish this by isolating the rotation to a single plane, like this:
iTween.RotateTo(binHighlight,{"x":binXspin.x,"time":.8});
we shall see...