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

Implementation of swept AABB and sphere collision queries. More...

#include "SweptCollision.hpp"
#include "Movement.hpp"
#include "PhysicsConstants.hpp"
#include "PhysicsPerfStats.hpp"
#include "TriMeshCollision.hpp"
#include <algorithm>
#include <cmath>
#include <glm/common.hpp>
#include <glm/geometric.hpp>
Include dependency graph for SweptCollision.cpp:

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.
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::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 (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::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).
DepenetrationResult physics::depenetrateCapsuleVsWorldDetailed (glm::vec3 &pos, glm::vec3 &vel, CapsuleShape capsule, const WorldGeometry &world, DepenetrationOptions options)
void physics::depenetrateCapsuleVsWorld (glm::vec3 &pos, glm::vec3 &vel, CapsuleShape capsule, const WorldGeometry &world)
 Per-pass-deepest-first capsule depenetration against the whole world.
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

Implementation of swept AABB and sphere collision queries.