public static void RotateFrom(GameObject target, Hashtable args)
{
Vector3 tempRotation;
Vector3 fromRotation;
bool tempIsLocal;
//clean args:
args = iTween.CleanArgs(args);
//set tempIsLocal:
if(args.Contains("islocal")){
tempIsLocal = (bool)args["islocal"];
}else{
tempIsLocal = Defaults.isLocal;
}
//set tempRotation and base fromRotation:
if(tempIsLocal){
tempRotation=fromRotation=target.transform.localEulerAngles;
}else{
tempRotation=fromRotation=target.transform.eulerAngles;
}
//set augmented fromRotation:
if(args.Contains("rotation")){
if (args["rotation"].GetType() == typeof(Transform)){
Transform trans = (Transform)args["rotation"];
fromRotation=trans.eulerAngles;
}else if(args["rotation"].GetType() == typeof(Vector3)){
fromRotation=(Vector3)args["rotation"];
}
}else{
if (args.Contains("x")) {
fromRotation.x=(float)args["x"];
}
if (args.Contains("y")) {
fromRotation.y=(float)args["y"];
}
if (args.Contains("z")) {
fromRotation.z=(float)args["z"];
}
}
//apply fromRotation:
if(tempIsLocal){
target.transform.localEulerAngles = fromRotation;
}else{
target.transform.eulerAngles = fromRotation;
}
//set new rotation arg:
args["rotation"]=tempRotation;
//establish iTween:
args["type"]="rotate";
args["method"]="to";
Launch(target,args);
}