system
1
I rotate an object around another object by using RotateAround and the Mouse Y Axis. Now I would like to set max angles, so, the transform can not have an angle bigger than 60 and smaller than -60. Is that possible?
var Speed : float = 10;
var Achse : Transform;
function Update ()
{
var rotationY : float;
rotationY += Input.GetAxis("Mouse Y") * Speed;
rotationY = Mathf.Clamp (rotationY, -60, 60);
transform.RotateAround(Achse.position,Achse.right,-rotationY);
}
poncho
2
before the transform.RotateAround
you can check the transorm new angle
would be like this
float newAngle = transform.eulerAngles.y+rotationY;
if(newAngle<=60 && newAngle >= -60)
{
transform.RotateAround(Achse.position,Achse.right,-rotationY);
}
hope this helps