Hi everyone. I am currently trying to code a saw blade where the arrow keys control the rotation of the saw and
space bar causes the blade to start spinning fast to prepare for sawing. I’m currently having troubles with doing
both of these things simultaneously without causing a weird diagonal rotation. Does anyone have any tips on
how to get this working? Below is what I have so far
void Update() {
if (Input.GetKeyDown ("up")) {
newRotation = Quaternion.Euler (0, 90, 0) * newRotation;
} else if (Input.GetKey ("space")) {
rb.AddTorque(transform.up * revSpeed * Time.deltaTime);
}
transform.rotation = Quaternion.Slerp (transform.rotation, newRotation, Time.deltaTime * switchSpeed);
}