i ve got a rotationscript that rotates the player around y axis, when climbing a ladder i disable the script to rotate the player towards the ladders z direction, the problem is when enabling the player rotationscript again it starts rotating to the last “known” rotation again before it was disabled. i dont want this to happen, so how do i set the rotationscript to have the rotation from when the climb has ended? and not its last rotation before it was disabled?
script:
var smoothSpeed : float = 2;
private var sensitivityX : float = 6;
var aimSens : float = 2;
var normalSens : float = 6;
private var rotationX : float = 0;
private var startrotation : Quaternion;
function Start()
{
startrotation = transform.rotation;
}
function FixedUpdate ()
{
if (Input.GetButton("Fire3"))
{
sensitivityX = aimSens;
}
else
{
sensitivityX = normalSens;
}
rotationX += Input.GetAxis("Mouse X") * sensitivityX;
var xQuaternion : Quaternion = Quaternion.Euler(0,rotationX,0);
transform.rotation = Quaternion.Slerp(transform.rotation, xQuaternion,Time.deltaTime * smoothSpeed);
}