- Home /
Rotation no save to array
Hello. I have my own script to save position, rotation of GameObject. Position is OK, but rotation not working.
This is fragment of Save function:
rot[counter*6+3] = myObj.transform.rotation.x;
rot[counter*6+4] = myObj.transform.rotation.y;
rot[counter*6+5] = myObj.transform.rotation.z;
And here is fragment of Load function:
Quaternion rotation = obj.transform.rotation=Quaternion.Euler(data.saves[counter*6+3],data.saves[counter*6+4],data.saves[counter*6+5]);
print (rotation); //is the problem - rotation is 0,0,0;
GameObject obj1 = Instantiate (obj, position1, rotation) as GameObject;
Comment
Best Answer
Answer by NikunjPopat · Jul 07, 2014 at 06:22 AM
rot[counter*6+3] = myObj.transform.rotation.eulerAngles.x;
rot[counter*6+4] = myObj.transform.rotation.eulerAngles.y;
rot[counter*6+5] = myObj.transform.rotation.eulerAngles.z;
//Try this one
Your answer
Follow this Question
Related Questions
Saving/Loading variables 1 Answer
What is best way to save several arrays into a file? 0 Answers
how to make a save and load function 0 Answers
Why can't I save an array? 1 Answer
Saving System? 1 Answer