https://github.com/griffelstudio/gltf-collision-detection
Clash detection between meshes of glTF files.
https://github.com/griffelstudio/gltf-collision-detection
bim collision-detection gltf
Last synced: about 1 year ago
JSON representation
Clash detection between meshes of glTF files.
- Host: GitHub
- URL: https://github.com/griffelstudio/gltf-collision-detection
- Owner: griffelstudio
- License: mit
- Created: 2021-03-13T15:43:46.000Z (about 5 years ago)
- Default Branch: development
- Last Pushed: 2024-05-10T19:54:07.000Z (about 2 years ago)
- Last Synced: 2025-04-13T20:39:58.658Z (about 1 year ago)
- Topics: bim, collision-detection, gltf
- Language: C#
- Homepage:
- Size: 29.6 MB
- Stars: 8
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# GS.Gltf.Collisions  
.NET Core 3.1 library to find intersecting meshes in 3D glTF files.
Not the fastest yet, but stable and 100% pure C#, ready to be built and utilized in any .NET codebase.

# Quick Start 
Get the package from [GitHub Packages](https://github.com/griffelstudio/gltf-collision-detection/pkgs/nuget/GS.Gltf.Collisions) or [NuGet.org](https://www.nuget.org/packages/GS.Gltf.Collisions#supportedframeworks-body-tab)
```
dotnet add package GS.Gltf.Collisions --version 1.0.0
```
Add ```using GS.Gltf.Collisions;```
Create settings according to which collisions will be detected, supplying paths to one or many glTF files:
```c#
var inputFiles = new List { "Just.gltf", "An.glb", "Example.glb" };
var settings = new CollisionSettings(inputFiles);
```
Create detector object and run detection method
```c#
var detector = new CollisionDetector(settings);
var result = detector.Detect();
```
# Help
Result of collision detection is the list of `CollisionResult` objects, each containing pair of intersecting elements and `BoundingBox`s.
Each of both elements is represented by `KeyValuePair` where key is *model* index, value is glTF *node* index.
All bounding boxes are axis aligned. There are minimum one - around points of intersection, and maximum - around intersecting elements.
`CollisionSettings.OutputMode` enumeration has 3 options:
* `InMemory` - just calculates intersection result without writing any files to disk
* `SeparateFile` - creates glTF file containing red axis aligned bounding boxes for each intersected pair of elements
* `MergeAll` - creates one glTF file with all input models merged and adds red bounding boxes nodes in it
## Resources
https://github.com/jslee02/awesome-collision-detection#other-awesome-lists