How to deal with stupid rotation system?

Hi!

Simply, I want to add a rotation to an existing gameobject’s rotation.

For example, I have (0, 0, 50) and I want it to be added to rotB (0, 0, 0).

I’ve tried this code:

rotB *= Quaternion.Euler (0, 0, 50);

But the result is so weird, something like (2.53543, 7.54353534536, 50).

Any ideas ?

You're setting the "isSpeaking" to true at the start of this, but not starting the audio yet from what I can see? Also, from your comments it looks like "AnharmonicSynthSFX.KITTpoliceChaosImitationFX();" toggles a given effect? Is that what plays the audio?

Thanks @TreyH, Yes You are Right, I think what I ned to do is set up a new bool that I could Call: "PoliceChaosActive = false" And Track it with that bool ;)

2 Answers

2

Have you tried:
rotB = Quaternion.Euler (rotA.eulerAngles.x,
rotA.eulerAngles.y,
rotA.eulerAngles.z + 50f);

Same thing here

That's right, what you're seeing is a rounding error that is essentially 0 in the game. Pretty much the only way this would cause a problem is if you're doing some kind of if(rotB.eulerAngles.x == 0f) check. Otherwise, you shouldn't notice any difference between this and perfect 0f.

One other thing to make sure of, look closely at the inspector position x, y, and z values. sometimes it cuts off the scientific notation at the end of the float, so 2.53543e-10 looks like 2.53543, when it’s actually essentially 0, but some floating point rounding made it look non-zero. Just something to check.

OK, this is the measure of the weird angle. [72214-screenshot-2.png|72214] Does this mean actually 0 in-game?