some corrections

main
Evan Hemsley 2019-09-14 23:45:02 -07:00
parent a968e8ca74
commit f270480db7
4 changed files with 4 additions and 4 deletions

View File

@ -34,7 +34,7 @@ hash.Insert(1, rect, rectTransform);
To find potential collisions, use the **Retrieve** method and give an ID, an IShape2D, and a Transform2D. To find potential collisions, use the **Retrieve** method and give an ID, an IShape2D, and a Transform2D.
```cs ```cs
hash.Retrieve(1, rectB, rectBTransform); hash.Retrieve(1, rect, rectTransform);
``` ```
In this example, the above method call returns an *IEnumerable<(T, IShape2D, Transform)>* containing the circle information we inserted. In this example, the above method call returns an *IEnumerable<(T, IShape2D, Transform)>* containing the circle information we inserted.

View File

@ -6,7 +6,7 @@ weight: 10
Bonk uses the Gilbert-Johnson-Keerthi, or GJK, algorithm to perform narrow phase collision detection. Bonk uses the Gilbert-Johnson-Keerthi, or GJK, algorithm to perform narrow phase collision detection.
To accurately check a collision, you must pass two sets of shapes and transforms. Remember that a transform operates on the vertices of a shape: it moves, rotates, and scales them in 2D space. To accurately check a collision, you must pass two sets of shapes and transforms to the *GJK2D.TestCollision* method. Remember that a transform operates on the vertices of a shape: it moves, rotates, and scales them in 2D space.
```cs ```cs
var circleA = new Circle(2); var circleA = new Circle(2);

View File

@ -12,7 +12,7 @@ This can present us with problems when it comes to game physics. If your charact
To avoid these problems, I created the *Position2D* struct. *Position2D* maintains an integer X and Y position, as well as X and Y fractional carryover. Whenever numbers with fractional values are added to the position, the fractional values are added to the carryover. Once the carryover value reaches 1, it is added to the coordinate. This means that we can treat positions as integer values without sacrificing precision. To avoid these problems, I created the *Position2D* struct. *Position2D* maintains an integer X and Y position, as well as X and Y fractional carryover. Whenever numbers with fractional values are added to the position, the fractional values are added to the carryover. Once the carryover value reaches 1, it is added to the coordinate. This means that we can treat positions as integer values without sacrificing precision.
This means that in our physics calculations, we will never have discrepancies between internal game position logic and rendering. Therefore, in our physics calculations, we will never have discrepancies between internal game position logic and rendering.
```cs ```cs
var one = new Position2D(1.3f, 3.5f); var one = new Position2D(1.3f, 3.5f);

View File

@ -10,4 +10,4 @@ To create a *Transform2D*, you must provide a *Position2D* or a *Vector2* for tr
var transform = new Transform2D(new Position2D(4, 1), 5f, new Vector2(3, 1)); var transform = new Transform2D(new Position2D(4, 1), 5f, new Vector2(3, 1));
``` ```
The following section will describe how to use Shapes in conjunction with Transforms to perform collision detection. The following section will describe how to use an *IShape2D* in conjunction with *Transform2D* to perform collision detection.