Verlet Intergration Soft Body
Loading...
Searching...
No Matches
PhysicsCSAlevlProject.SeperatedAxisRectangleCollider Class Reference

The SeperatedAxisRectangleCollider class represents a rectangle collider that can be rotated and uses the Separating Axis Theorem (SAT) for collision detection. More...

Inheritance diagram for PhysicsCSAlevlProject.SeperatedAxisRectangleCollider:
PhysicsCSAlevlProject.PolygonSeperatedAxisCollider PhysicsCSAlevlProject.Collider

Public Member Functions

override Collider DeepCopy ()
 SeperatedAxisRectangleCollider (Rectangle rectangle, float angle)
override bool ContainsPoint (Vector2 point, out Vector2 closestPoint)
override void Draw (SpriteBatch spriteBatch, PrimitiveBatch primitiveBatch)
 Draws the collider.
Public Member Functions inherited from PhysicsCSAlevlProject.PolygonSeperatedAxisCollider
override Collider DeepCopy ()
 PolygonSeperatedAxisCollider (Vector2[] vertices)
override bool ContainsPoint (Vector2 point, out Vector2 closestPoint)
Public Member Functions inherited from PhysicsCSAlevlProject.Collider
bool ContainsPoint (Vector2 point, out Vector2 closestPoint)
 Determines if the given point is contained within the collider and calculates the closest point on the collider to the given point. This method is used for collision detection and response, allowing the application to determine if a particle or object is colliding with the collider and to find the nearest point on the collider's surface for accurate physics interactions. The method returns true if the point is inside the collider, and false otherwise, while also providing the closest point on the collider as an output parameter. it outputs the same point if the point is outside the collider, which is used for calculating the collision response direction and magnitude based on how far the point is from the collider's surface.
Collider DeepCopy ()
 Creates a deep copy of the collider,.

Public Attributes

float HalfWidth
 the half width of the rectangle collider used for calculating the vertices and axes of the rectangle
float HalfHeight
 the half height of the rectangle collider used for calculating the vertices and axes of the rectangle
Public Attributes inherited from PhysicsCSAlevlProject.PolygonSeperatedAxisCollider
Vector2[] Vertices
 the vertices of the polygon collider defined in local space
Vector2[] worldVertices
 the vertices of the polygon collider defined in world space

Properties

Vector2[] Axis = new Vector2[4] [get, private set]
 all of the axes of the rectangle collider, which are used for collision detection using the Separating Axis Theorem (SAT)
override Vector2 Position [get, set]
 the position of the rectangle collider, which is the center point of the rectangle. When the position is set, it updates the position of the rectangle used for drawing and recalculates the vertices and axes of the rectangle based on the new position.
float Angle [get, set]
 the angle of the rectangle collider in radians, which determines the rotation of the rectangle. When the angle is set, it updates the rotation of the rectangle used for drawing and recalculates the vertices and axes of the rectangle based on the new angle.
Properties inherited from PhysicsCSAlevlProject.PolygonSeperatedAxisCollider
override Vector2 Position [get, set]
 the position of the polygon collider, which is the center point of the polygon. When the position is set, it updates the position of the polygon used for drawing and recalculates the vertices and axes of the polygon based on the new position.
float angle [get, set]
 the angle of the polygon collider in radians, which determines the rotation of the polygon. When the angle is set, it updates the rotation of the polygon used for drawing and recalculates the vertices and axes of the polygon based on the new angle.
Properties inherited from PhysicsCSAlevlProject.Collider
virtual Vector2 Position [get, set]
 the position of the collider

Private Member Functions

void SetAxis ()
 recreates the axes and vertices of the rectangle collider based on the current angle and half width and half height of the rectangle.

Private Attributes

Vector2 _position
 the position of the rectangle collider, which is the center point of the rectangle
PrimitiveBatch.Rectangle rectangleDraw
 the rectangle used for drawing the collider

Detailed Description

The SeperatedAxisRectangleCollider class represents a rectangle collider that can be rotated and uses the Separating Axis Theorem (SAT) for collision detection.

Member Function Documentation

◆ Draw()

override void PhysicsCSAlevlProject.SeperatedAxisRectangleCollider.Draw ( SpriteBatch spriteBatch,
PrimitiveBatch primitiveBatch )
inlinevirtual

Draws the collider.

Parameters
spriteBatch
primitiveBatch

Reimplemented from PhysicsCSAlevlProject.PolygonSeperatedAxisCollider.


The documentation for this class was generated from the following file:
  • PhysicsCSAlevlProject/Objects.Colliders.cs