Is there a way to turn collision detection system off completely in Unity?
My world setup is 2D Top-Down. All collisions are disabled from the collision matrix. There are no collisions in the scene as I wanted, but as I perceive, Unity is still trying to calculate collisions in the background. So I'm experiencing serious frame rate drops because of Physics2D.Simulate when I have about 2k colliders moving over each other on the scene. I followed the suggestions about colliders and rigidbodies on the API exactly (so I know the stuff about not to move static colliders without rigidbody, that's not the case here), but I somehow can't manage to tell Unity that I don't want her to calculate "possible" collisions. I only want colliders for Raycast2D, OverlapCircle and making movements a bit realistic. Thanks in advance for all suggestions.
As far as I understand your needs, you would require to entirely disable Physics2D, which isn’t something for what Unity has been prepared as the Physics engine is a built-in and fully integrated module from the game engine.
Nevertheless, as told in here some users have found a solution in applying the maximum to the fixed timestep:
In the time settings, set the fixed timestep to 10 (the maximum).
That’s as disabled as it gets.
Hope this helps somehow.
You should be able to get away with using colliders and marking them as triggers.
Then in Project Settings -> Physics2D, set the layer collision matrix to not even trigger when overlapping one another. (Uncheck all of the boxes)
Also, make sure the Queries Hit Triggers option is checked and for other options too.
Picture displays checked collision matrix, which will ENABLE the detection, am just taking picture from currently open project. You should UNTICK them for your desired behaviour.
And, voila! No collisions, but you can still check for ray hits and other casts.
Have never worked with 2D though, but I feel this should be working.
You can also change the behaviour via scripts (runtime) by utlizing:
Obviously, other stuff seen in the Physics2DSettings can be changed too: http://docs.unity3d.com/ScriptReference/Physics2D.html
- Database Administration Tutorials
- Programming Tutorials & IT News
- Linux & DevOps World
- Entertainment & General News
- Games & eSport