Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bfollington/differ-cs
A port of differ (open source SAT collision implementation) to C#
https://github.com/bfollington/differ-cs
collision csharp sat separating-axis-theorem unity
Last synced: 2 months ago
JSON representation
A port of differ (open source SAT collision implementation) to C#
- Host: GitHub
- URL: https://github.com/bfollington/differ-cs
- Owner: bfollington
- Created: 2016-04-04T14:44:21.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2021-06-13T13:05:08.000Z (over 3 years ago)
- Last Synced: 2024-10-07T04:08:44.763Z (3 months ago)
- Topics: collision, csharp, sat, separating-axis-theorem, unity
- Language: C#
- Size: 18.6 KB
- Stars: 11
- Watchers: 3
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## What is differ-cs?
A port of the original differ for Haxe (https://github.com/underscorediscovery/differ). The port is (where possible) a one-to-one mapping, with a few changes to the API (no more out parameters). This is a [Separating Axis Theorom](http://en.wikipedia.org/wiki/Hyperplane_separation_theorem) collision library for C# games, intended for use in Unity.
----
## Facts
- Supports polygons, circles, and rays currently.
- 2D only (for now).
- Includes a simple drawing interface for debugging shapes (Not in my port, in the original)
- **COLLISION ONLY.** No physics here. By design :)
- Contributions welcome##Quick look
**A simple collision example**
This is taken from the original, but this syntax is 100% compatible.var circle = new Circle( 300, 200, 50 );
var box = Polygon.rectangle( 0, 0, 50, 150 );box.rotation = 45;
var collideInfo = Collision.shapeWithShape( circle, box );
if(collideInfo != null) {
//use collideInfo.separationX
// collideInfo.separationY
// collideInfo.normalAxisX
// collideInfo.normalAxisY
// collideInfo.overlap
}### Roadmap
- Unit tests, the original had none
- Clean up code style
- Implement ShapeDrawer for Unity
- Create demos