- Home /
Set camera angle in a script using the same system as the properties page??
Using Unity 3.5 - I have a simple scene with a camera looking at a cube.
I want to make the mouse 'pan over' the cube - which in terms of the settings on the Camera's Properties page means changing the camera's position (working fine) and the X Angle of it's rotation from 0 to 180 degrees.
Problem is - when you assign an angle > 90 via something like these 2 (tx being between 0 and 180)
transform.localRotation = Quaternion.Euler(tx, 0, 0); or transform.eulerAngles = Vector3(tx,0,0);
something goes horrible awry (Y and Z axis rotations happen and the X rotation is changed)
All I want to do is set the rotation of the camera in a script in the same way I can in the properties page - this should not be hard but it seems impossible - what sort of nonsense is that??
p.s. Transform.lookat also causes the camera to move in physical space, which makes no sense and is equally no help - how hard can this get??