Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/extrys/unitycollisioncomputer

Makes use of Unity's Physics API, and it's used to handle custom collision events in a more efficient way than Unity's default collision events.
https://github.com/extrys/unitycollisioncomputer

data-oriented-technology-stack dots jobs optimization performance physical-computing physics unity unity-package unity3d unity3d-plugin

Last synced: 4 months ago
JSON representation

Makes use of Unity's Physics API, and it's used to handle custom collision events in a more efficient way than Unity's default collision events.

Awesome Lists containing this project

README

        

The problem: Unity's OnCollisionEnter and OnCollisionExit are executed per instance, and when 2 objects collide, both objects execute the event, causing duplicated events.
It makes harder to handle things like particles, sounds, or any other effect that should be executed only once per collision.

This code is working with Unity's Physics API, and it's used to handle custom collision events in a more efficient way than Unity's default collision events.
The whole file contains all needed code to make it work
just implement ICustomCollisionListener interface in your class and use StartListenCollisions and StopListenCollisions extension methods to start and stop listening to collisions. it requires a Rigidbody reference in each listener for now.