AABB
Declaration
public struct tainicom.Aether.Physics2D.Collision.AABB
An axis aligned bounding box.
Constructors
AABB
void AABB(Vector2 min, Vector2 max)
Parameters:
| Name | Type | Description |
|---|---|---|
min |
Strawberry.Math.Vector2 |
|
max |
Strawberry.Math.Vector2 |
AABB
void AABB(ref Vector2 min, ref Vector2 max)
Parameters:
| Name | Type | Description |
|---|---|---|
min |
ref Strawberry.Math.Vector2 |
|
max |
ref Strawberry.Math.Vector2 |
AABB
void AABB(Vector2 center, float width, float height)
Parameters:
| Name | Type | Description |
|---|---|---|
center |
Strawberry.Math.Vector2 |
|
width |
System.Single |
|
height |
System.Single |
Properties
Width
float Width { get }
Height
float Height { get }
Center
Get the center of the AABB.
Vector2 Center { get }
Extents
Get the extents of the AABB (half-widths).
Vector2 Extents { get }
Perimeter
Get the perimeter length
float Perimeter { get }
Vertices
Gets the vertices of the AABB.
Vertices Vertices { get }
Value: The corners of the AABB
Q1
First quadrant
AABB Q1 { get }
Q2
Second quadrant
AABB Q2 { get }
Q3
Third quadrant
AABB Q3 { get }
Q4
Forth quadrant
AABB Q4 { get }
Fields
LowerBound
The lower vertex
Vector2 LowerBound
UpperBound
The upper vertex
Vector2 UpperBound
Methods
IsValid
Verify that the bounds are sorted. And the bounds are valid numbers (not NaN).
bool IsValid()
Returns: true if this instance is valid; otherwise, false.
Combine
Combine an AABB into this one.
void Combine(ref AABB aabb)
Parameters:
| Name | Type | Description |
|---|---|---|
aabb |
ref tainicom.Aether.Physics2D.Collision.AABB |
The aabb. |
Combine
Combine two AABBs into this one.
void Combine(ref AABB aabb1, ref AABB aabb2)
Parameters:
| Name | Type | Description |
|---|---|---|
aabb1 |
ref tainicom.Aether.Physics2D.Collision.AABB |
The aabb1. |
aabb2 |
ref tainicom.Aether.Physics2D.Collision.AABB |
The aabb2. |
Contains
Does this aabb contain the provided AABB.
bool Contains(ref AABB aabb)
Parameters:
| Name | Type | Description |
|---|---|---|
aabb |
ref tainicom.Aether.Physics2D.Collision.AABB |
The aabb. |
Returns: true if it contains the specified aabb; otherwise, false.
Contains
Determines whether the AAABB contains the specified point.
bool Contains(ref Vector2 point)
Parameters:
| Name | Type | Description |
|---|---|---|
point |
ref Strawberry.Math.Vector2 |
The point. |
Returns: true if it contains the specified point; otherwise, false.
TestOverlap static
Test if the two AABBs overlap.
bool TestOverlap(ref AABB a, ref AABB b)
Parameters:
| Name | Type | Description |
|---|---|---|
a |
ref tainicom.Aether.Physics2D.Collision.AABB |
The first AABB. |
b |
ref tainicom.Aether.Physics2D.Collision.AABB |
The second AABB. |
Returns: True if they are overlapping.
RayCast
Raycast against this AABB using the specificed points and maxfraction (found in input)
bool RayCast(out RayCastOutput output, ref RayCastInput input, bool doInteriorCheck = true)
Parameters:
| Name | Type | Description |
|---|---|---|
output |
out tainicom.Aether.Physics2D.Collision.RayCastOutput |
The results of the raycast. |
input |
ref tainicom.Aether.Physics2D.Collision.RayCastInput |
The parameters for the raycast. |
doInteriorCheck |
System.Boolean = true |
Returns: True if the ray intersects the AABB