group2 0.1.0
CSE 125 Group 2
Loading...
Searching...
No Matches
SweptCollision.hpp File Reference

Swept AABB and sphere collision queries against world geometry. More...

#include "PhysicsPerfStats.hpp"
#include "SurfaceType.hpp"
#include <cmath>
#include <cstdint>
#include <functional>
#include <glm/geometric.hpp>
#include <glm/vec3.hpp>
#include <span>
#include <vector>
Include dependency graph for SweptCollision.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  physics::Plane
 An infinite plane dividing free space from solid geometry. More...
struct  physics::WorldAABB
 An axis-aligned box in world space, used as static collision geometry. More...
struct  physics::WorldBrush
 A convex volume defined by bounding planes (for ramps, angled walls, etc.). More...
struct  physics::WorldCylinder
 A vertical (Y-axis) cylinder in world space. More...
struct  physics::WorldSphere
 A sphere in world space. More...
struct  physics::BVHNode
 A single BVH node for spatial acceleration of triangle meshes. More...
struct  physics::WorldTriMesh
 A triangle mesh with BVH acceleration for collision queries. More...
struct  physics::StaticWorldBroadphase
 Immutable world-level BVH over WorldTriMesh bounds. More...
struct  physics::WorldGeometry
 All world collision geometry for one tick. More...
struct  physics::CapsuleShape
 Capsule shape input for swept-collision queries. More...
struct  physics::HitResult
 Result of a swept AABB collision query. More...
struct  physics::ClearanceResult
 Result of a shape-vs-geometry closest-point clearance query. More...
struct  physics::GroundProbeResult
 Result of a downward ground probe — what's directly under a character's feet, classified for walkability. More...
struct  physics::DepenContact
 Single deepest contact from a capsule against a primitive or the world. More...
struct  physics::DepenetrationOptions
struct  physics::DepenetrationResult
struct  physics::SphereHitResult
 Result of a sphere-cast query (includes world-space hit point). More...

Namespaces

namespace  physics
 Pure physics math — no ECS types, no registry.

Functions

void physics::buildStaticWorldBroadphase (StaticWorldBroadphase &broadphase, std::span< const WorldTriMesh > triMeshes)
 Rebuild the immutable broadphase over all static triangle meshes.
void physics::queryStaticWorldBroadphase (const StaticWorldBroadphase &broadphase, const WorldAABB &query, const std::function< bool(uint32_t meshIndex)> &visit)
 Visit triangle-mesh indices whose mesh bounds overlap query.
bool physics::broadphaseAabbOverlap (const WorldAABB &a, const WorldAABB &b) noexcept
template<class Visit>
void physics::queryStaticWorldBroadphaseFast (const StaticWorldBroadphase &broadphase, const WorldAABB &query, Visit &&visit)
HitResult physics::sweepAABB (glm::vec3 halfExtents, glm::vec3 start, glm::vec3 end, std::span< const Plane > planes)
 Sweep an AABB along the path [start, end] against a list of infinite planes.
HitResult physics::sweepAABBvsBox (glm::vec3 halfExtents, glm::vec3 start, glm::vec3 end, const WorldAABB &box)
 Sweep an AABB against a static axis-aligned box.
HitResult physics::sweepAABBvsBrush (glm::vec3 halfExtents, glm::vec3 start, glm::vec3 end, const WorldBrush &brush)
 Sweep an AABB against a convex brush (set of bounding planes).
HitResult physics::sweepAABBvsCylinder (glm::vec3 halfExtents, glm::vec3 start, glm::vec3 end, const WorldCylinder &cyl)
 Sweep an AABB against a vertical cylinder.
HitResult physics::sweepAABBvsSphere (glm::vec3 halfExtents, glm::vec3 start, glm::vec3 end, const WorldSphere &sph)
 Sweep an AABB against a sphere.
HitResult physics::sweepAll (glm::vec3 halfExtents, glm::vec3 start, glm::vec3 end, const WorldGeometry &world)
 Sweep an AABB against all world geometry, returning the earliest hit.
HitResult physics::sweepCapsuleVsPlanes (CapsuleShape capsule, glm::vec3 start, glm::vec3 end, std::span< const Plane > planes)
 Sweep a capsule along [start, end] against a list of infinite planes.
HitResult physics::sweepCapsuleVsBox (CapsuleShape capsule, glm::vec3 start, glm::vec3 end, const WorldAABB &box)
 Sweep a capsule against a static axis-aligned box. Conservative.
HitResult physics::sweepCapsuleVsBrush (CapsuleShape capsule, glm::vec3 start, glm::vec3 end, const WorldBrush &brush)
 Sweep a capsule against a convex brush. Exact (per-plane Minkowski extent).
HitResult physics::sweepCapsuleVsCylinder (CapsuleShape capsule, glm::vec3 start, glm::vec3 end, const WorldCylinder &cyl)
 Sweep a capsule against a vertical cylinder. Conservative.
HitResult physics::sweepCapsuleVsSphere (CapsuleShape capsule, glm::vec3 start, glm::vec3 end, const WorldSphere &sph)
 Sweep a capsule against a sphere. Conservative.
HitResult physics::sweepAll (CapsuleShape capsule, glm::vec3 start, glm::vec3 end, const WorldGeometry &world)
 Sweep a capsule against all world geometry, returning the earliest hit.
ClearanceResult physics::clearanceCapsuleVsPlanes (CapsuleShape capsule, glm::vec3 pos, std::span< const Plane > planes)
ClearanceResult physics::clearanceCapsuleVsBox (CapsuleShape capsule, glm::vec3 pos, const WorldAABB &box)
ClearanceResult physics::clearanceCapsuleVsBrush (CapsuleShape capsule, glm::vec3 pos, const WorldBrush &brush)
ClearanceResult physics::clearanceCapsuleVsCylinder (CapsuleShape capsule, glm::vec3 pos, const WorldCylinder &cyl)
ClearanceResult physics::clearanceCapsuleVsSphere (CapsuleShape capsule, glm::vec3 pos, const WorldSphere &sph)
ClearanceResult physics::clearanceCapsuleVsWorld (CapsuleShape capsule, glm::vec3 pos, const WorldGeometry &world, float maxMeshSearchRadius=1024.0f)
 Scene-wide minimum clearance.
GroundProbeResult physics::probeGround (CapsuleShape capsule, glm::vec3 pos, float maxDistance, const WorldGeometry &world)
 Downward sweep that classifies the ground under a capsule.
DepenContact physics::deepestCapsuleContact (CapsuleShape capsule, glm::vec3 pos, glm::vec3 vel, const WorldGeometry &world)
 Scene-wide deepest single contact (per-primitive, per-feature).
void physics::depenetrateCapsuleVsWorld (glm::vec3 &pos, glm::vec3 &vel, CapsuleShape capsule, const WorldGeometry &world)
 Per-pass-deepest-first capsule depenetration against the whole world.
DepenetrationResult physics::depenetrateCapsuleVsWorldDetailed (glm::vec3 &pos, glm::vec3 &vel, CapsuleShape capsule, const WorldGeometry &world, DepenetrationOptions options)
bool physics::emergencyUnstick (glm::vec3 &pos, glm::vec3 &vel, CapsuleShape capsule, const WorldGeometry &world)
 Last-resort recovery for a capsule embedded in geometry with no clear depen direction.
SphereHitResult physics::sphereCast (float radius, glm::vec3 start, glm::vec3 end, const WorldGeometry &world)
 Cast a sphere along the path [start, end] against all world geometry.

Detailed Description

Swept AABB and sphere collision queries against world geometry.