general polygon collider that uses the Separating Axis Theorem (SAT) for collision detection, which can represent any shape not self intersectiong such as rectangles, triangles, and more complex polygons.
More...
|
|
override Collider | DeepCopy () |
|
| PolygonSeperatedAxisCollider (Vector2[] vertices) |
|
override bool | ContainsPoint (Vector2 point, out Vector2 closestPoint) |
| override void | Draw (SpriteBatch spriteBatch, PrimitiveBatch primitiveBatch) |
| | Draws the 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,.
|
|
|
Vector2[] | Vertices |
| | the vertices of the polygon collider defined in local space
|
|
Vector2[] | worldVertices |
| | the vertices of the polygon collider defined in world space
|
|
|
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.
|
|
virtual Vector2 | Position [get, set] |
| | the position of the collider
|
|
|
void | UpdateWorldCacheIfNeeded () |
|
bool | IsEar (Vector2 A, Vector2 B, Vector2 C, Vector2[] points) |
|
bool | PointInTriangle (Vector2 P, Vector2 A, Vector2 B, Vector2 C) |
|
Vector2 | GetClosestPointOnLineSegment (Vector2 A, Vector2 B, Vector2 P) |
|
float | Area (Vector2 A, Vector2 B, Vector2 C) |
|
bool | IsPointInPolygon (Vector2 point, Vector2[] polygon) |
|
|
static Rectangle | CreateBroadPhase (Vector2[] vertices) |
|
|
List< Vector2[]> | Triangles = new() |
| | the triangles used for drawing the polygon collider
|
|
Vector2[] | _axisPrivate |
| | the axis of the polygon collider used for collision detection using the Separating Axis Theorem (SAT)
|
|
Vector2 | _position |
| | the position
|
|
float | _angle |
| | the angle of the polygon collider in radians
|
|
Rectangle | _localBroadPhase |
| | the broadphase rectangle used for a quick check to see if a point is potentially colliding with the polygon collider
|
|
Rectangle | _worldBroadPhase |
| | the broadphase rectangle used for a quick check to see if a point is potentially colliding with the polygon collider
|
|
bool | _worldCacheDirty |
| | a boolean flag to indicate whether the world vertices and world broadphase cache needs to be updated
|
general polygon collider that uses the Separating Axis Theorem (SAT) for collision detection, which can represent any shape not self intersectiong such as rectangles, triangles, and more complex polygons.
◆ Draw()
| override void PhysicsCSAlevlProject.PolygonSeperatedAxisCollider.Draw |
( |
SpriteBatch | spriteBatch, |
|
|
PrimitiveBatch | primitiveBatch ) |
|
inlinevirtual |
The documentation for this class was generated from the following file:
- PhysicsCSAlevlProject/Objects.Colliders.cs