Green Rock Engine 0
Loading...
Searching...
No Matches
Public Member Functions | List of all members
GREngine.Core.Physics2D.CollisionSystem Class Reference
Inheritance diagram for GREngine.Core.Physics2D.CollisionSystem:
Inheritance graph
[legend]
Collaboration diagram for GREngine.Core.Physics2D.CollisionSystem:
Collaboration graph
[legend]

Public Member Functions

 CollisionSystem (Game game)
 
override void Update (GameTime gameTime)
 
bool AABBOverlap (AABB a, AABB b)
 Tests whether two AABB's overlap.
 
AABB GetCombinedAABBRegion (AABB a, AABB b)
 Creates a new AABB that represents the AABB that the two given AABB's cover (AABB Union)
 
AABB GetAABBOverlapRegion (AABB a, AABB b)
 Creates a new AABB that represents where 2 given AABB's overlap (AABB Intersection)
 
bool PointIsInAABB (PointF p, AABB aabb)
 
bool LinesSegmentsOverlap (PointF a1, PointF a2, PointF b1, PointF b2)
 Checks whether the AABB's of two line segments overlap (hence potential intersection)
 
bool LinesCanIntersect (Line l1, Line l2)
 This simply checks if two Lines can intersect since their gradients are not the same.
 
PointF LineIntersectionPoint (Line l1, Line l2)
 Will take two lines that will intersect, and finds their intersection point.
 
bool IntersectionIsWithinLineSegments (PointF intersection, PointF a1, PointF a2, PointF b1, PointF b2)
 Checks whether passed in point falls between the bounds of both lines to ensure that an intersection occurred inside the segments.
 
bool LineCanIntersectCircle (PointF p1, PointF p2, PointF c, float r)
 Return whether a line segment intersect a circle in TWO PLACES.
 
List< PointF > LineIntersectsCircle (PointF p1, PointF p2, PointF c, float r)
 
void AddCollisionObject (Collider obj)
 
void RemoveCollisionObject (Collider obj)
 
HashSet< ColliderGetColliderObjects ()
 
bool PointIsCollidingWithLayer (PointF point, string layer)
 
List< ColliderGetCollidersOfLayer (string layer)
 
Raycast2DResult Raycast2D (PointF origin, Vector2 direction, float distance, List< string > layers)
 Casts a ray from a point in given direction for given distance. Will stop at the first collider hit.
 

Member Function Documentation

◆ AABBOverlap()

bool GREngine.Core.Physics2D.CollisionSystem.AABBOverlap ( AABB  a,
AABB  b 
)
inline

Tests whether two AABB's overlap.

Parameters
a
b
Returns

Implements GREngine.Core.Physics2D.ICollisionSystem.

◆ AddCollisionObject()

void GREngine.Core.Physics2D.CollisionSystem.AddCollisionObject ( Collider  obj)
inline

◆ GetAABBOverlapRegion()

AABB GREngine.Core.Physics2D.CollisionSystem.GetAABBOverlapRegion ( AABB  a,
AABB  b 
)
inline

Creates a new AABB that represents where 2 given AABB's overlap (AABB Intersection)

Parameters
a
b
Returns

Implements GREngine.Core.Physics2D.ICollisionSystem.

◆ GetColliderObjects()

HashSet< Collider > GREngine.Core.Physics2D.CollisionSystem.GetColliderObjects ( )
inline

◆ GetCollidersOfLayer()

List< Collider > GREngine.Core.Physics2D.CollisionSystem.GetCollidersOfLayer ( string  layer)
inline

◆ GetCombinedAABBRegion()

AABB GREngine.Core.Physics2D.CollisionSystem.GetCombinedAABBRegion ( AABB  a,
AABB  b 
)
inline

Creates a new AABB that represents the AABB that the two given AABB's cover (AABB Union)

Parameters
a
b

Implements GREngine.Core.Physics2D.ICollisionSystem.

◆ IntersectionIsWithinLineSegments()

bool GREngine.Core.Physics2D.CollisionSystem.IntersectionIsWithinLineSegments ( PointF  intersection,
PointF  a1,
PointF  a2,
PointF  b1,
PointF  b2 
)
inline

Checks whether passed in point falls between the bounds of both lines to ensure that an intersection occurred inside the segments.

///

Parameters
intersection
a1Origin of line 1
a2end of line 1
b1Origin of line 2
b2end of line 2
Returns

Implements GREngine.Core.Physics2D.ICollisionSystem.

◆ LineCanIntersectCircle()

bool GREngine.Core.Physics2D.CollisionSystem.LineCanIntersectCircle ( PointF  p1,
PointF  p2,
PointF  c,
float  r 
)
inline

Return whether a line segment intersect a circle in TWO PLACES.

Parameters
p1
p2
c
r
Returns

◆ LineIntersectionPoint()

PointF GREngine.Core.Physics2D.CollisionSystem.LineIntersectionPoint ( Line  l1,
Line  l2 
)
inline

Will take two lines that will intersect, and finds their intersection point.

Parameters
l1Primary Line
l2Other colliders line
Returns

Implements GREngine.Core.Physics2D.ICollisionSystem.

◆ LineIntersectsCircle()

List< PointF > GREngine.Core.Physics2D.CollisionSystem.LineIntersectsCircle ( PointF  p1,
PointF  p2,
PointF  c,
float  r 
)
inline

◆ LinesCanIntersect()

bool GREngine.Core.Physics2D.CollisionSystem.LinesCanIntersect ( Line  l1,
Line  l2 
)
inline

This simply checks if two Lines can intersect since their gradients are not the same.

Parameters
l1Primary Line
l2Other colliders line
Returns

Implements GREngine.Core.Physics2D.ICollisionSystem.

◆ LinesSegmentsOverlap()

bool GREngine.Core.Physics2D.CollisionSystem.LinesSegmentsOverlap ( PointF  a1,
PointF  a2,
PointF  b1,
PointF  b2 
)
inline

Checks whether the AABB's of two line segments overlap (hence potential intersection)

Parameters
a1Origin of line 1
a2end of line 1
b1Origin of line 2
b2end of line 2
Returns

Implements GREngine.Core.Physics2D.ICollisionSystem.

◆ PointIsCollidingWithLayer()

bool GREngine.Core.Physics2D.CollisionSystem.PointIsCollidingWithLayer ( PointF  point,
string  layer 
)
inline

◆ PointIsInAABB()

bool GREngine.Core.Physics2D.CollisionSystem.PointIsInAABB ( PointF  p,
AABB  aabb 
)
inline

◆ Raycast2D()

Raycast2DResult GREngine.Core.Physics2D.CollisionSystem.Raycast2D ( PointF  origin,
Vector2  direction,
float  distance,
List< string >  layers 
)
inline

Casts a ray from a point in given direction for given distance. Will stop at the first collider hit.

Parameters
originPoint the raycast starts
directiondirection in which it is cast
distancemax distance the ray will extend
layersthe layers the ray is allowed to collide with
Returns
A Raycast2DResult that stores the collider hit reference, hit point, and collision normal

Implements GREngine.Core.Physics2D.ICollisionSystem.

◆ RemoveCollisionObject()

void GREngine.Core.Physics2D.CollisionSystem.RemoveCollisionObject ( Collider  obj)
inline

The documentation for this class was generated from the following file: