WoopWoop-Docs
Loading...
Searching...
No Matches
Public Member Functions | Private Member Functions | Private Attributes | List of all members
WoopWoop.BoxCollider Class Reference

Represents a collider component for a rectangular box. More...

Inheritance diagram for WoopWoop.BoxCollider:
WoopWoop.Collider WoopWoop.Component

Public Member Functions

override void Awake ()
 Initializes the collider.
 
override bool IsCollidingWith (Collider other)
 Checks if the collider is colliding with another collider.
 
CollisionDataGetCollisionData (Collider other)
 Gets collision data with a given entity.
 
Vector2 GetWorldExtents ()
 Gets the extents of the collider in world space.
 
override void OnDrawGizmo ()
 Draws the collider's gizmo in the editor.
 
- Public Member Functions inherited from WoopWoop.Collider
bool IsCollidingWith (Entity other)
 Checks if the collider is colliding with an entity.
 
Entity[] GetCollidingEntitiesWithTag (string tag)
 Gets an array of entities colliding with entities having a specific tag.
 
Entity[] GetAllCollidingEntities ()
 Gets an array of all entities colliding with the collider's entity.
 
- Public Member Functions inherited from WoopWoop.Component
void Attach (Entity entity)
 Attaches the component to an entity.
 
virtual void Start ()
 Called when the component is started if it's enabled.
 
virtual void Update (float deltaTime)
 Called every frame to update the component's state.
 
virtual void OnEndOfFrame ()
 Called on the end of every frame.
 
virtual void Stop ()
 Called when the component is removed.
 

Private Member Functions

List< Vector2 > GetWorldPoints (Vector2 position, Vector2 scale, float angle)
 Gets the corner points of the collider in world space.
 
bool SATCollisionDetection (List< Vector2 > points1, List< Vector2 > points2)
 Performs Separating Axis Theorem (SAT) collision detection.
 
List< Vector2 > GetAxes (List< Vector2 > points)
 Calculates the axes of the collider.
 
List< Vector2 > SATContactPoints (List< Vector2 > points1, List< Vector2 > points2)
 Calculates the contact points using the Separating Axis Theorem (SAT).
 

Private Attributes

List< Vector2 > axes = new List<Vector2>()
 

Additional Inherited Members

- Properties inherited from WoopWoop.Component
Entity entity [get, private set]
 The entity to which this component is attached.
 
Transform transform [get]
 The transform of the entity to which this component is attached.
 
bool Enabled = true [get, set]
 Determines whether the component is enabled.
 

Detailed Description

Represents a collider component for a rectangular box.

Member Function Documentation

◆ Awake()

override void WoopWoop.BoxCollider.Awake ( )
virtual

Initializes the collider.

Reimplemented from WoopWoop.Component.

◆ GetAxes()

List< Vector2 > WoopWoop.BoxCollider.GetAxes ( List< Vector2 > points)
private

Calculates the axes of the collider.

Parameters
pointsCorner points of the collider.
Returns
List of axes.

◆ GetCollisionData()

CollisionData? WoopWoop.BoxCollider.GetCollisionData ( Collider other)

Gets collision data with a given entity.

Parameters
otherThe other collider to check against.
Returns
Collision data if colliding, otherwise null.

◆ GetWorldExtents()

Vector2 WoopWoop.BoxCollider.GetWorldExtents ( )

Gets the extents of the collider in world space.

Returns
Extents vector.

◆ GetWorldPoints()

List< Vector2 > WoopWoop.BoxCollider.GetWorldPoints ( Vector2 position,
Vector2 scale,
float angle )
private

Gets the corner points of the collider in world space.

Parameters
positionThe position of the collider.
scaleThe scale of the collider.
angleThe angle of rotation of the collider (in radians).
Returns
List of corner points in world space.

◆ IsCollidingWith()

override bool WoopWoop.BoxCollider.IsCollidingWith ( Collider other)
virtual

Checks if the collider is colliding with another collider.

Parameters
otherThe other collider to check against.
Returns
True if colliding, otherwise false.

Reimplemented from WoopWoop.Collider.

◆ OnDrawGizmo()

override void WoopWoop.BoxCollider.OnDrawGizmo ( )
virtual

Draws the collider's gizmo in the editor.

Reimplemented from WoopWoop.Component.

◆ SATCollisionDetection()

bool WoopWoop.BoxCollider.SATCollisionDetection ( List< Vector2 > points1,
List< Vector2 > points2 )
private

Performs Separating Axis Theorem (SAT) collision detection.

Parameters
points1Corner points of the first collider.
points2Corner points of the second collider.
Returns
True if colliding, otherwise false.

◆ SATContactPoints()

List< Vector2 > WoopWoop.BoxCollider.SATContactPoints ( List< Vector2 > points1,
List< Vector2 > points2 )
private

Calculates the contact points using the Separating Axis Theorem (SAT).

Parameters
points1The points of the first collider.
points2The points of the second collider.
Returns
A list of contact points.

Member Data Documentation

◆ axes

List<Vector2> WoopWoop.BoxCollider.axes = new List<Vector2>()
private

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