Hello there!
I’m having some problems rotating an object only in it’s Y.
if you use the codes
var i : int = 0;
transform.rotation = Quaternion.AngleAxis(i, Vector3.up);
i++;
or
var tiltAroundY = Input.GetAxis("Horizontal") + transform.eulerAngles.y;
// Create a rotation
transform.rotation = Quaternion.Euler (transform.eulerAngles.x, tiltAroundY, transform.eulerAngles.z);
The first option keeps the object without any rotation exempt around the Y, so I can’t tilt the object, for example.
And in the second option the object can be rotated in any axis, and get tilted, but if you rotate the object on its Y it rotates in a kind of word coordinate, and not as I rotate an object on the unity3D viewer, on the real Y of the object.
Hmm, interesting that my code works for you. I’ll give you more details, hopefully that will help. Keep in mind I’m a noob to both Unity and 3D programming. My scene has a simple terrain, camera and a cube. The cube has a rigidbody, a mesh renderer, the script I pasted above and a Box Collider. I tried adding a Character Controller but then it would either slide off the terrain or display other odd behavior. My camera is using a “smooth follow” script, I don’t remember which example I snagged that from.
My rigidbody was not set to isKinematic, I went ahead and tried that both ways with no improvement. I also deleted the rigidbody to see if that would help but it made no difference.
You said you are using the smooth follow script? The script keeps the camera behind its target. I wonder if the object is rotating but since it is always in the same relation to the camera, it appears not to be rotating. At the very least, you should check if the rotation remains the same throughout by check its value in the inspector.