View on Asset Store (opens in new tab)
Package details
- Latest version
- 1.0.0
- Last updated
- First released
- Unity version
- 2019.4.5 or later
- Package size
- 320 KB
- Files
- 31
- Favorites
- 16
- Views in the past week
- 6
Price tracking
- Last checked
- Tracked since
- Lowest recorded
- $15.00 on
Better Physics Layers
Affiliate link · Purchases support this site
Price history
Last 6 months
USDAsset preview
1 / 4
Better Physics Layers screenshot 1
About this asset
Forum Thread | Discord | Email | Demo | Documentation | API Reference
--------------------------------------------------------------------------Better Physics Layers gives you fine-grained and easy-to-use control over which colliders can collide.
✅ 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.
From the publisher's Asset Store listing.