a. This works:
angles.z = -rotAngle; //(angles is stored in the start method angles = transform.rotation.eulerAngles;)
transform.rotation = Quaternion.Slerp(transform.rotation, Quaternion.Euler(angles), Time.time * 1);
or b. this works: transform.Rotate(Vector3.up, rotSpeed * Time.deltaTime, Space.World);
but not both. Somehow a. overwrites b. even though b. comes after it in the code. I suppose it overwrites it on the next frame…
The camera is top down.
a. rotates my 3d spaceship around the z axis for making the ship look like it’s banking in that direction.
b. rotates my spaceship around the y axis for turning it with A and D keyboard keys.
with both it only a. banks the spaceship and my turning is overwritten.
I don’t know how to fix it. The local up pivot of the spaceship changes when I rotate it on the z axis. I thought Space.World would rotate it on the world axis. And it works. But then it get’s overwritten.
How do I do both rotations without messing up the other?
I think I’m going to have to combine the rotations both into one slerp rotate call or something.
You might need to show more code, but in general, yes, you should not be trying to do both transform.rotation = and transform.Rotate() in the same frame, as they’re both calculating new values for transform.rotation and will likely interfere with the effect you want. Rotating about two different axes can be pretty tricky to get right, since Euler Angles are applied in a specific order.
Great to hear. When folks figure out solutions to their questions, it can be helpful to the next person hitting Google if those solutions get added to the thread. Up to you.
Doesn’t make any sense ^^. First of all you’re passing a changing start value into Slerp which completely changes the behaviour from being linear to being an accelerated exponential interpolation. Furthermore passing in Time.time as “t” also doesn’t make much sense. The “t” value has be be in the range of 0 to 1. Time.time is the current game time which is ever increasing. So after the first second in the game the value will be larger than 1 so it’s simply clamped to 1. So your line is essentially equal to simply: