3
\$\begingroup\$

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.

\$\endgroup\$
1
  • \$\begingroup\$ Has this already a solution? or Have you posted it in Unity as bug? \$\endgroup\$ Commented May 4, 2016 at 0:34

2 Answers 2

2
\$\begingroup\$

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.

\$\endgroup\$
1
  • \$\begingroup\$ No, it won't help since I don't want to disable entire physics system (hence I want to use rigidbody2Ds), but just prevent calculation of collisions. \$\endgroup\$ Commented Mar 30, 2016 at 13:50
2
\$\begingroup\$

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.

phys2d.proj.sett

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

\$\endgroup\$
4
  • \$\begingroup\$ Thank you for taking your time, but as I stated in the question, I already disabled all combinations in collisison matrix. And all of my colliders are triggers, too. \$\endgroup\$ Commented Apr 1, 2016 at 14:03
  • \$\begingroup\$ Dayumm, missed first line. Have you disabled matrices in both 2D and 3D views? Maybe Unity is messing something up internally. Also, are your colliders set as triggers? \$\endgroup\$ Commented Apr 1, 2016 at 14:36
  • \$\begingroup\$ Yes and yes (actually I tried with every possible combination). \$\endgroup\$ Commented Apr 1, 2016 at 15:21
  • 1
    \$\begingroup\$ Well, then I guess you should post this somewhere around Unity guys. There might be a bug. \$\endgroup\$ Commented Apr 1, 2016 at 15:22

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .