Write a C# script to record GameObject rotation?

I know how to write most of the script and record to csv file.
But when i play back the GameObject from the data it comes very deformed and crooked and essentially inaccurate.
I am using Quaternion.Euler(gameObject.transform.localEulerAngles()) to obtain the rotation values. Is this correct?

you want to obtain the rotation of the object? why not just use transform.rotation?
if you want to store the euler angles just use transform.rotation.eulerAngles
what you are trying to do in that line feels redundant but not innacurate, but you are getting the local rotation so that may be whats making it inaccurate

It is pretty straightforward if you record transform.rotation and then replay by setting the transform.rotation values. Unless you absolutely want euler angles for some reason.

The inspector rotation values are in transform.localEulerAngles.


Only use this variable to read and set the angles to absolute values. Don’t increment them, as it will fail when the angle exceeds 360 degrees. Use Transform.Rotate instead ~ Unity Reference


Actually all has been solved. I removed stupid Quaternion that I for some reason still kept in my code, and changed it to Vector3. The whole animation is now working. Thank you for all your help!
Solution is here Solution - Pastebin.com