hey guys, i was wondering if someone could help me basically i have script and there are two lines that i was wondering if someone can explain for me here is my script:
public enum RotationAxis {MouseX = 1}
var RotationAxisX = RotationAxis.MouseX;
var sensitivityX : float = 400f;
public var minimumX : float = -360;
public var maximumX : float = 360;
public var rotationX : float = 0;
var OriginalRotation : Quaternion;
function start(){
OriginalRotation = transform.localRotation;
}
function Update () {
if(RotationAxisX == RotationAxis.MouseX){
rotationX += Input.GetAxis("Mouse X") * sensitivityX * Time.deltaTime;
rotationX = ClampAngle (rotationX, minimumX, maximumX);
OriginalRotation = XQuaternion = Quaternion.AngleAxis(rotationX, Vector3.up);
transform.localRotation = OriginalRotation * XQuaternion;
}
}
function ClampAngle (angle, min , max ):float
{
if(angle < -360f){
angle += 360;
}
if(angle >360){
angle -= 360;
}
return Mathf.Clamp (angle,min, max);
}
basically the script is for mouse look, i want to ask in this following code why does it need the "+=" in front of it to make it rotate in the x axis:
rotationX += Input.GetAxis("Mouse X") * sensitivityX * Time.deltaTime;
ans secondly what does this line do:
transform.localRotation = OriginalRotation * XQuaternion;
i would be really happy if someone could help me that would mean alot thanks in advance MCHALO