Ok so I need to know how I can make this object(player controlled turret)which rotates on the Y axis to remember or get the value of the amount of a rotation that is happening, during a certain time.
What it does is rotates to a certain direction when a certain bool is true, which not using the input, as in you don’t control it while this bool is true and while its rotating to this specific direction. So what I need is that specific amount of rotation that has happened on the axis while it rotates to said direction on its own.
Let me explain in code:
Quaternion XQuaternion;
//This is when the bool is not on and you are controlling the rotation with the Input of mouse.
if(rTt != true){
turretRotationX += Input.GetAxis("MouseX") * 1.6f * Time.deltaTime;
}
// So I want to do the same thing as above but not with the input but the amount the turret has rotated since the bool rTt has been true.
if(rTt == true){
// turretRotationX += ??? AngleAxis? I don't how?
}
// This is where the mouse input goes into the rotation. // XQuaternion is what I want to change into the amount of rotation that has happened during rTt == true.
turretRotationX = ClampAngle(turretRotationX, turretMinX, turretMaxX);
XQuaternion = Quaternion.AngleAxis(turretRotationX, Vector3.forward);
//rot is the original rotation of the turret set in Start. Shouldn't be an issue here.
tur.localRotation = rot * XQuaternion;
So yeah, please help.