If you look at the expanding under Gameboard.FixedUpdate(), it is quite explicit.
In my FixedUpdate, I directly change the position of my game object. And each time I do this, Unity destroy all colliders and recreate them at the new position, and with or without rigidbody attached.
The only way to avoid this process of destruction and creation, with cause a huge performance drop, is to have a rigidbody attached and change its velocity.
So, intended behaviour?
Some other way to move a gameobject without risk?
You must not move a collider without its Rigidbody.
You must not move a collider, with or without a rigidbody, from the FixedUpdate function.
Do either of those two and your collider will be destroyed and recreated to its new position by Box2D.
same here, we had a freeze on ios and android because the re-genetation crash for one 2d collider (bad triangles?) and only on mobile… take us long to figure out. I would like know the reason behind this perf issue: destroy all colliders and recreate it at runtime.
for us, the fix will be to remove all 2d physic component of our game, since we only use it to make 2d raycast, instead we will make an in house raycast solution.
Well, a simple solution is to ensure every collider or group of collider have a rigidbody attached to it and do the transform through the rigidbody’s gameobject.
Just never move a collider alone. As it is seen as a static collider by box2D, it will be deleted and recreated somewhere else.
It doesn’t, I’m running into the same perf glitch despite using MovePosition because the rotations are 3D,
which
Internally Box2D seems to move the collider anchors position and rebuild the collider profile with the unpleasant result of 2ms for only 300 colliders.
It’s a shame because Box is super fast when doing purely 2D rotation, the documentation should reflect that it’s ill suited for 2.5D games where rotation is in non Z axis.