- Home /
"Invalid AABB" error whenever rigidbody moves
I'm getting an error that says "Invalid AABB b0" whenever the player in my game moves, which is a rigidbody. Since it's AABB I'm assuming it has something to do with collision, but the error throws whenever the player is moving, even if it's not hitting anything.
Selecting the error reveals nothing, it's not anywhere in my code but presumably something with Unity itself. Image below.
Latest Unity, using 3D physics. The game seems to run perfectly fine, but getting 100+ errors constantly while playtesting makes it hard to debug anything. The error fires every frame while the player's rigidbody is in motion.
Thanks!
Can you check if your colliders/bounding boxes are correct, for example empty bounding box or for any reason one with negative size. Also try to locate which game object exactly is causing that error. $$anonymous$$aybe you have an invalid scale on one object.
I thiiiink this might've been an issue, but it was solved indirectly by simply changing how the player was instantiated (setting the position and rotation directly in the instantiate line, ins$$anonymous$$d of later). Thanks anyway!
You just mentioned it was the wrong position, but what exactly threw the exception inside the player? In my case it was a LineRenderer
component which threw the exception because of setting positions while no position had been available.
Hate to second guess you, but are you sure it's the LineRenderer? Cuz AABB is a collision testing method (axis-aligned bounding box), and I'm not sure why the LineRenderer would check collision at all.
If you tried to set a position to something unavailable I'd expect it would give a NaN error or "invalid Vector3" or something.
Answer by nyonge · Jul 27, 2015 at 06:08 AM
Solved it. For anyone else with a similar problem, it was because of the way I was instantiating the player. I was using Instantaite(Resources.Load(gameObject etc etc)) to do it, then on the next couple lines setting the position and rotation independently. By moving the position and rotation set into the Instantiate function itself:
playerObject = Instantiate(Resources.Load("Player", typeof(GameObject)), target.transform.position, target.transform.rotation) as GameObject;
That seems to have fixed it. Not sure why, but it works!
Answer by BassemAkl · Aug 06, 2015 at 06:55 AM
I had the same problem. I found that I accidentally set a GameObject's Scale that has a Rigidbody to 0,0,0. Just changing that to a non-zero value solved the problem.
Answer by Tkrain42 · Sep 03, 2015 at 03:47 AM
I ran into this problem, and thought it was something to do with the Rigidbody (since it was happening when two rigidbodies collided), but I discovered in my instance that it was because I'd passed the NavAgent's desiredspeed.magnitude to the animator, and when the rigidbodies collided, that created a speed of Zero... which I was using as a parameter for the animation speed of Walk... The end result was that the character that stopped due to collision suddenly had all its bones with positions and rotations of nAn...
Answer by Vectrex · Oct 25, 2015 at 12:36 PM
I had particles with world collisions AND particle stretching from velocity. So when I wasn't moving, the collisions AABB box would have been 0
Answer by superdupergc · Dec 10, 2015 at 03:05 AM
Happened to me with a linerenderer, i think the size was set to 0