Answers for "transform.rotation interferes with transform.Rotate"
http://answers.unity.com/questions/1071011/transformrotation-interferes-with-transformrotate.html
The latest answers for the question "transform.rotation interferes with transform.Rotate"Answer by Glurth
http://answers.unity.com/answers/1071277/view.html
GetAxis returns a value between -1 and 1. Multiple this by 20 , and you will be settings your lean angle to a min/max of -20 to +20 degrees, with this line `newRotation = Quaternion.Euler(transform.rotation.x, transform.rotation.y, leanAngle);` Though I'm not sure why that line is INSIDE your if statement.
The transform.Rotate(euler_angle_parameter,Space.World) function can thought of as equivalent to:
transform.roation.eulerAngles= transform.rotation.eulerAngles + euler_angle_parameter;
So, using both, the rotate function AND directly assigning rotations can get a bit confusing.
Maybe try something like this (uncompiled- just an example):
Vector3 amount_to_rotate_and_turn= Vector3.zero;
amount_to_rotate_and_turn.z = Input.GetAxis("Horizontal") * 20; //we will turn this much every frame, so multiplying by 20 might be too fast of a turn
if(Input.GetKey ("s")){
amount_to_rotate_and_turn.y = 1; //we will turn this much every frame
}
if(Input.GetKey ("a")){
amount_to_rotate_and_turn.y = -1;//we will turn this much every frame
}
transform.Rotate(amount_to_rotate_and_turn, Space.World);Thu, 24 Sep 2015 13:59:56 GMTGlurth