Better Physics Layers

Better Physics Layers gives you fine-grained and easy-to-use control over which colliders can collide.

*IF YOU'RE USING THEM IN A PRODUCT, YOU MUST BUY THEM. 💰*

 

✅ Features:
—————-
Up to 64 layers, totally separate from Unity’s built-in layer system
Separate physics layers from rendering layers
Easy to use – Just specify which layer (or layers!) the object belongs to, without worrying about bitmasks
Fine-grained control – Objects can belong to any combination of layers, and can collide with any combination of layers
Mix and match – Any object without a PhysicsMask component will behave exactly like normal and won’t be affected
Fast – No measurable performance hit even with thousands of rigidbodies*
Full source included, so you can inspect and modify to your heart’s content

❔ Why?
—————-
Normally, whether or not two colliders can collide depends on the GameObject’s layer and the physics layer matrix. This is a problem for two main reasons:

– There are only 32 layers, of which 8 are reserved, and these layers also affect rendering (among many other things!)
– Objects can only belong to one layer at a time

Better Physics Layers solves this by making good use of Unity’s IgnoreCollision functions. This is extremely fast and doesn’t hurt performance.

I created this system because I needed it. While working on my portal system I discovered that it was extremely limiting not being able to have an object belong to more than one physics layer at once, and I quickly used up all 24 of Unity’s customisable built-in layers.

❗ *Limitations:
—————-
– Raycasts/spherecasts/etc. can’t easily be filtered within the physics engine except by Unity’s built-in layers, so there’s an included function to filter the results of the cast instead.
– There’s a small performance cost to updating the collision ignores, simply due to sheer number of loops required. On my computer this is ~0.2ms in the editor with 100 objects, or ~3ms in the editor with 1000 objects. The cost is O(n^2). The collision ignores only need to be updated when changing layers or adding new objects, so in most cases this performance cost is negligible.
– Currently only supports 3D physics, but I want to add 2D support in future.

*** IF YOU'VE FOUND A BUG OR BROKEN LINK, PLEASE LET US KNOW. 🐞🔗 **

Term of Use: All resources here are for personal learning only, not for commercial use! Assets and 3D models can only be used in games after purchasing a license from the respected owner. We offer download services only; no technical support provide

Product Information

  • File Size
    :

    320.1 KB

  • Version
    :

    1.0.0

  • Last Updated
    :

    August 8, 2024

  • Released
    :

    August 8, 2024

  • File Included
    :

    WinRAR (.rar)

  • Compatible With
    :

    Unity 2019.4.5 | +

Share Your Valuable Opinions

Cart (0)

  • Your cart is empty.