Class ConvexCollider

Inheritance Relationships

Base Type

Class Documentation

class legion::physics::ConvexCollider : public legion::physics::PhysicsCollider

Public Functions

ConvexCollider() = default
inline ~ConvexCollider()
inline virtual void AddConverganceIdentifier(const physics_contact &contact) override

Given a physics_contact that has been resolved, use its label and lambdas in order to create a ConvexConverganceIdentifier.

inline virtual void CheckCollision(PhysicsCollider *physicsCollider, physics_manifold &manifold) override

given a PhysicsCollider, CheckCollision calls “CheckCollisionWith”. Both colliders are then passed through to the correct “CheckCollisionWith” function with double dispatch.

Parameters
  • physicsCollider: The collider we would like to check collision against

  • [in/out]: manifold A physics_manifold that holds information about the collision

virtual void CheckCollisionWith(ConvexCollider *convexCollider, physics_manifold &manifold) override

Given a ConvexCollider and a physics_manifold, uses the seperating axis test for each HalfEdgeFace and edge of both ConvexColliders.

inline virtual void PopulateContactPoints(PhysicsCollider *physicsCollider, physics_manifold &manifold) override

given a PhysicsCollider, PopulateContactPoints calls PopulateContactPointsWith. Both colliders are then passed through to the corrent FillManifoldWith function with double dispatch.

virtual void PopulateContactPointsWith(ConvexCollider *convexCollider, physics_manifold &manifold) override

Creates the contact points between this physics collider and the given ConvexCollider and stores them in the manifold.

inline virtual void UpdateTransformedTightBoundingVolume(const math::mat4 &transform) override
void UpdateTightAABB(const math::mat4 &transform)

Given the current transform of the entity, creates a tight AABB of the collider;.

virtual void UpdateLocalAABB() override

Using the vertices of the convexCollider,creates a ;.

virtual void DrawColliderRepresentation(const math::mat4 &transform, math::color usedColor, float width, float time, bool ignoreDepth = false) override

Given the transform of the entity that the collider is attached to, draws a visual representation of the collider.

Note

This is called internally by PhysicsSysten

inline void doStep(legion::core::mesh_handle &mesh)

Does one step of the convex hull generation Just for debug purposes.

inline void ConstructConvexHullWithVertices(std::vector<math::vec3> &vertices, math::vec3 spacingAmount = math::vec3())
inline void ConstructConvexHullWithMesh(legion::core::mesh_handle meshHandle, bool shouldDebug = true)

Constructs a polyhedron-shaped convex hull that encompasses the given mesh.

Parameters
  • meshHandle: - The mesh handle to lock the mesh and the mesh to create a hull from

void ConstructConvexHullWithMesh(mesh &mesh, math::vec3 spacingAmount = math::vec3(), bool shouldDebug = false)
inline void ConstructBoxWithMesh()

Constructs a box-shaped convex hull that encompasses the given mesh.

inline void CalculateLocalColliderCentroid()
inline void CreateBox(const cube_collider_params &cubeParams)

Constructs a box-shaped convex hull based on the given parameters.

Parameters
  • cubeParams: The parameters that will be used to create the box.

inline virtual std::vector<HalfEdgeFace*> &GetHalfEdgeFaces() override
inline const std::vector<math::vec3> &GetVertices() const
inline void AssertEdgeValidity()

Public Members

bool debug = false
int step = 0