- Home /
Why is it so fast to move objects with collider collisions?
I have an object in my VR game that has 1100 boxes in its compound collider (A long story but it needs to be done this way). When the game is running and I try to move my object in the editor by dragging its handle, my game basically freezes for a few seconds as you would expect. Looking at the profiler, all of this comes from the CPU cost of calling Physics.SyncColliderTransform().
But, if I put a simple stick into my VR game with a simple box collider on it, and I hit my 1100-collider object with it, my game runs perfectly fine. No noticeable performance costs. I can even duplicate my 1100-collider object 4 times and hit them against eachother to move them, and that only takes my performance down slightly if all 4 of the objects are colliding against eachother at once. I'm sure Physics.SyncColliderTransform() is being called, but it doesn't take any noticeable performance.
So, why is it so slow to move my object by its handles in the editor, but so fast to move them with other colliders?
Answer by sirjoan620 · Feb 01, 2019 at 09:05 PM
If you change the world with transform.position or editor abilities, it's like god hand, it's not calculable for physic.
If you need to change a physic object's position you should use rigidbody.position and rigidbody.rotation.
Check this out: https://answers.unity.com/questions/62933/move-object-to-specific-position-with-physics.html