initial commit
commit
48f5a9db8e
|
@ -0,0 +1,12 @@
|
||||||
|
# Hugo default output directory
|
||||||
|
/public
|
||||||
|
|
||||||
|
## OS Files
|
||||||
|
# Windows
|
||||||
|
Thumbs.db
|
||||||
|
ehthumbs.db
|
||||||
|
Desktop.ini
|
||||||
|
$RECYCLE.BIN/
|
||||||
|
|
||||||
|
# OSX
|
||||||
|
.DS_Store
|
|
@ -0,0 +1,3 @@
|
||||||
|
[submodule "themes/hugo-theme-learn"]
|
||||||
|
path = themes/hugo-theme-learn
|
||||||
|
url = https://github.com/matcornic/hugo-theme-learn
|
|
@ -0,0 +1,6 @@
|
||||||
|
---
|
||||||
|
title: "{{ replace .Name "-" " " | title }}"
|
||||||
|
date: {{ .Date }}
|
||||||
|
draft: true
|
||||||
|
---
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
baseURL = "https://moontools.github.io"
|
||||||
|
languageCode = "en-us"
|
||||||
|
title = "Bonk Docs"
|
||||||
|
|
||||||
|
theme = "hugo-theme-learn"
|
||||||
|
[outputs]
|
||||||
|
home = ["HTML", "RSS", "JSON"]
|
|
@ -0,0 +1,15 @@
|
||||||
|
---
|
||||||
|
title: "Bonk"
|
||||||
|
---
|
||||||
|
|
||||||
|
# Bonk
|
||||||
|
|
||||||
|
[Bonk](https://github.com/MoonsideGames/MoonTools.Core.Bonk) is a fast and modular collision detection system for MonoGame that is part of the MoonTools suite.
|
||||||
|
|
||||||
|
Bonk **is** designed to help you figure out if two shapes are overlapping and by how much.
|
||||||
|
|
||||||
|
Bonk **is not** a physics simulator and it will not help you execute collision responses.
|
||||||
|
|
||||||
|
Bonk is available as a [NuGet package](https://www.nuget.org/packages/MoonTools.Core.Bonk/).
|
||||||
|
|
||||||
|
Bonk is licensed under the [LGPL-3](https://www.gnu.org/licenses/lgpl-3.0.en.html). In summary: feel free to include it in your closed-source game and modify it internally at will, but if you make changes that you intend to redistribute, you **must** freely publish your changes.
|
|
@ -0,0 +1,13 @@
|
||||||
|
+++
|
||||||
|
title = "Broad-Phase Collision"
|
||||||
|
date = 2019-09-14T18:33:15-07:00
|
||||||
|
weight = 15
|
||||||
|
chapter = true
|
||||||
|
pre = "<b>3. </b>"
|
||||||
|
+++
|
||||||
|
|
||||||
|
### Chapter 3
|
||||||
|
|
||||||
|
# Broad-Phase Collision
|
||||||
|
|
||||||
|
Fast and inaccurate.
|
|
@ -0,0 +1,18 @@
|
||||||
|
---
|
||||||
|
title: "Introduction"
|
||||||
|
date: 2019-09-14T18:36:07-07:00
|
||||||
|
---
|
||||||
|
|
||||||
|
Let's say we have a room with 100 objects. How do we know if any of those 100 objects are touching one another?
|
||||||
|
|
||||||
|
The naive solution is to simply check each pair of objects and see if they are colliding.
|
||||||
|
|
||||||
|
Unfortunately, this will require 10000 comparisons.
|
||||||
|
|
||||||
|
In other words, this naive approach becomes *extremely* expensive as the number of collision objects grows.
|
||||||
|
|
||||||
|
The solution? Broad-phase collision detection.
|
||||||
|
|
||||||
|
The purpose of the broad-phase is to very quickly check if an object *might* be touching another object. Then, once we know that an object might be touching another object, we can do a more expensive and accurate test.
|
||||||
|
|
||||||
|
There are a few different ways to do this. The only way that Bonk currently implements is the *spatial hash* technique.
|
|
@ -0,0 +1,6 @@
|
||||||
|
---
|
||||||
|
title: "Spatial_hash"
|
||||||
|
date: 2019-09-14T18:35:33-07:00
|
||||||
|
draft: true
|
||||||
|
---
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
+++
|
||||||
|
title = "Getting Started"
|
||||||
|
date = 2019-09-14T18:05:58-07:00
|
||||||
|
weight = 5
|
||||||
|
chapter = true
|
||||||
|
pre = "<b>1. </b>"
|
||||||
|
+++
|
||||||
|
|
||||||
|
### Chapter 1
|
||||||
|
|
||||||
|
# Getting Started
|
||||||
|
|
||||||
|
It's pretty simple.
|
|
@ -0,0 +1,26 @@
|
||||||
|
---
|
||||||
|
title: "Installation"
|
||||||
|
date: 2019-09-14T18:20:28-07:00
|
||||||
|
---
|
||||||
|
|
||||||
|
The simplest way of using Bonk is by including it in your C# project as a NuGet package.
|
||||||
|
|
||||||
|
To include the latest version of Bonk in your project using the .NET CLI, use the following command:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
dotnet add package MoonTools.Core.Bonk
|
||||||
|
```
|
||||||
|
|
||||||
|
If you are using the NuGet Package Manager, you may do:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
PM> Install-Package MoonTools.Core.Bonk
|
||||||
|
```
|
||||||
|
|
||||||
|
Once you have done this, you may access Bonk functionality by including
|
||||||
|
|
||||||
|
```cs
|
||||||
|
using MoonTools.Core.Bonk;
|
||||||
|
```
|
||||||
|
|
||||||
|
in any C# file.
|
|
@ -0,0 +1,13 @@
|
||||||
|
+++
|
||||||
|
title = "Shapes"
|
||||||
|
date = 2019-09-14T19:08:45-07:00
|
||||||
|
weight = 10
|
||||||
|
chapter = true
|
||||||
|
pre = "<b>2. </b>"
|
||||||
|
+++
|
||||||
|
|
||||||
|
### Chapter 2
|
||||||
|
|
||||||
|
# Shapes
|
||||||
|
|
||||||
|
What are shapes? We just don't know.
|
|
@ -0,0 +1,13 @@
|
||||||
|
---
|
||||||
|
title: "Circle"
|
||||||
|
date: 2019-09-14T19:46:44-07:00
|
||||||
|
weight: 20
|
||||||
|
---
|
||||||
|
|
||||||
|
To define a circle, give a center point and radius.
|
||||||
|
|
||||||
|
```cs
|
||||||
|
var center = new Position2D(5, 5);
|
||||||
|
var radius = 3;
|
||||||
|
var circle = new Circle(center, radius);
|
||||||
|
```
|
|
@ -0,0 +1,17 @@
|
||||||
|
---
|
||||||
|
title: "Introduction"
|
||||||
|
date: 2019-09-14T19:19:03-07:00
|
||||||
|
weight: 5
|
||||||
|
---
|
||||||
|
|
||||||
|
In Bonk, a **Shape2D** is defined by two methods.
|
||||||
|
|
||||||
|
1) A *support function*, which is a method that returns the farthest possible position **Vector2** in a given **Vector2** direction defined by the shape with its vertices transformed by a **Transform2D**
|
||||||
|
|
||||||
|
2) A method for creating an axis-aligned bounding box from the shape.
|
||||||
|
|
||||||
|
Bonk provides you with 4 built-in common 2D shapes, but you can implement these methods to create custom **Shape2D** structs.
|
||||||
|
|
||||||
|
Note that these shapes should be defined with zero-centered **Position2D** structs. You will use a **Transform2D** to manipulate the shape's position, rotation, and scale in 2D space.
|
||||||
|
|
||||||
|
A final restriction to note: Defining concave shapes is an error. The collision solving algorithm that Bonk uses does not support concave shapes. If you wish to define concave shapes, define them as a composition of multiple convex shapes.
|
|
@ -0,0 +1,13 @@
|
||||||
|
---
|
||||||
|
title: "Line"
|
||||||
|
date: 2019-09-14T19:36:39-07:00
|
||||||
|
weight: 10
|
||||||
|
---
|
||||||
|
|
||||||
|
To define a Line, give a start and end position.
|
||||||
|
|
||||||
|
```cs
|
||||||
|
var start = new Position2D(-1, 1);
|
||||||
|
var end = new Position2D(1, 1);
|
||||||
|
var line = new Line(start, end);
|
||||||
|
```
|
|
@ -0,0 +1 @@
|
||||||
|
Subproject commit b85d51a051745cf12e3a45ce61b4b0c747c5ea4a
|
Loading…
Reference in New Issue