I am working with a program that handles with the six degrees of freedom (left-right, up-down, front-back, yaw, pitch, roll). I am using iTween which is an AMAZING tool that is currently handling the object’s movement. But, I AM having a bit of an issue. This diagram should help:
As you can see the object travels diagonally and I want it to where if its in the second state I want the position updated to the position I want it. But I don’t know what I am doing wrong.
In my class I have it set up like so:
case ObjectAnimations.animation1:
MoveAcrossXPlane();
break;
case ObjectAnimations.animation2:
MoveAcrossYPlane();
break;
case ObjectAnimations.animation3:
MoveAcrossZPlane();
break;
case ObjectAnimations.animation4:
RotateObject_Pitch();
break;
case ObjectAnimations.animation5:
RotateObject_Yaw();
break;
case ObjectAnimations.animation6:
RotateObject_Roll();
break;
public void MoveAcrossXPlane()
{
iTween.MoveTo(_cubeObject_demo, iTween.Hash("name", "Xplane", "position", new Vector3(1, 1, 0), "speed", speed, "easetype", iTween.EaseType.linear, "looptype", iTween.LoopType.pingPong, "oncomplete", "PauseTween", "oncompletetarget", gameObject));
}
public void MoveAcrossYPlane()
{
_cubeObject_demo.transform.position = new Vector3(0, 1, 0);
iTween.MoveTo(_cubeObject_demo, iTween.Hash("name", "Yplane", "position", new Vector3(0, 1.7f, 0), "speed", speed, "easetype", iTween.EaseType.linear, "looptype", iTween.LoopType.pingPong, "oncomplete", "PauseTween", "oncompletetarget", gameObject));
}
//...rest of the methods go down here
The user presses a button and that is how I am controlling each state and in the class that has the GUI button I inserted the logic to stop each animation as well as placing the object where I want it:
switch (taskCounter)
{
case 0:
iTween.StopByName(obj_animateBlock._cubeObject_demo, "Xplane");
iTween.MoveTo(obj_animateBlock._cubeObject_demo, iTween.Hash("position", new Vector3(-1, 1, 0)));
break;
case 1:
iTween.StopByName(obj_animateBlock._cubeObject_demo, "Yplane");
iTween.MoveTo(obj_animateBlock._cubeObject_demo, iTween.Hash("position", new Vector3(0, 1, 0)));
break;
case 2:
iTween.StopByName(obj_animateBlock._cubeObject_demo, "Zplane");
iTween.MoveTo(obj_animateBlock._cubeObject_demo, iTween.Hash("position", new Vector3(0, 1, 0)));
break;
case 3:
iTween.StopByName(obj_animateBlock._cubeObject_demo, "Pitch");
iTween.MoveTo(obj_animateBlock._cubeObject_demo, iTween.Hash("position", new Vector3(0, 1.2f, 0)));
iTween.RotateTo(obj_animateBlock._cubeObject_demo, iTween.Hash("rotation", new Vector3(0, 0, 0)));
break;
case 4:
iTween.StopByName(obj_animateBlock._cubeObject_demo, "Yaw");
iTween.MoveTo(obj_animateBlock._cubeObject_demo, iTween.Hash("position", new Vector3(0, 1.2f, 0)));
iTween.RotateTo(obj_animateBlock._cubeObject_demo, iTween.Hash("rotation", new Vector3(0, 0, 0)));
break;
case 5:
iTween.StopByName(obj_animateBlock._cubeObject_demo, "Roll");
iTween.MoveTo(obj_animateBlock._cubeObject_demo, iTween.Hash("position", new Vector3(0, 1.2f, 0)));
iTween.RotateTo(obj_animateBlock._cubeObject_demo, iTween.Hash("rotation", new Vector3(0, 0, 0)));
break;
}
If anyone has any idea on how to fix this, I will be greatly appreciative. Thank you and God Bless.