- Home /
This was a bug and was fixed in unity 4.3.3
Bad Input Values for Rotation on Object with 5+ Children
I'm converting my project to utilize some unity 4.3 tools and am encountering errors on objects that are the child of a rotating object. When this object has 5+ children the children start throwing the error:
transform.rotation of 'object' is no longer valid due to a bad input value
And:
Quaternion To Matrix conversion failed because input Quaternion is invalid
I've been able to narrow it down to specifically 5+ objects. If I remove the rotation code for the parent object I don't' get the errors--unfortunately the rotation is vital to my game.
Here's the code that rotates it:
protected void Rotate() {
if(catnip > 0) {
catnip -= Time.deltaTime;
theSpawner.spawnTime = .5f;
}
else {
catnip = 0;
theSpawner.spawnTime = 1f;
}
float catNipMod = catnip > 0 ? catNipForce : 1;
float rotateSpeed = flip * (catNipMod) * .1f * (collected.Count + 1);
if(rotateSpeed > 1f * catNipMod)
rotateSpeed = 1f * catNipMod;
transform.Rotate(0,0,rotateSpeed);
}
Basically I modify the rotation speed based on the number of children (the collected.Count) then I rotate around the Z axis.
Could we see the rotation code? I'm thinking there's some manual values being calculated for a Quaternion that aren't correct
Sure--I asked this question on the forums and I wasn't manually setting the rotation (I was using rota$$anonymous$$round though). I'll edit it in right now.
Hmm... I can't see what would make it stop working correctly after 5 children, I'll keep looking for similar problems though.
Has it written the actual values for the invalid Quaternion?
I'm not so sure it is directly related to it anymore just did a few more tests and it was happening well after 5 children. I've never seen it happen earlier though.
Well that's really weird, perhaps it's a bug? Hopefully somebody with a little more knowledge can help you out.
All I can think of now is the rotateSpeed occasionally hitting a weird value and causing some problems, but I've never had to use transform.Rotate so I'm not sure - Or there is another script/animation that is also trying to modify the rotation. Anyways, good luck getting it figured out!