|
group2 0.1.0
CSE 125 Group 2
|
Capsule shape input for swept-collision queries. More...
#include <SweptCollision.hpp>
Public Member Functions | |
| glm::vec3 | segA (glm::vec3 center) const noexcept |
| Top endpoint of the inner segment at center. | |
| glm::vec3 | segB (glm::vec3 center) const noexcept |
| Bottom endpoint of the inner segment at center. | |
| glm::vec3 | enclosingHalfExtents () const noexcept |
| Tight half-extents of the AABB that encloses the capsule at center. | |
| float | minkowskiExtent (glm::vec3 n) const noexcept |
| Minkowski half-extent of the capsule along a unit direction n. | |
| float | effectiveStepHeight (float requestedStepHeight) const noexcept |
| Clamp a requested step height to a value the capsule can safely support — never larger than the segment half-length, leaving a small numerical margin so the derived walkShape() always has a positive halfHeight. | |
| CapsuleShape | walkShape (float requestedStepHeight) const noexcept |
| "Walk" capsule — a shorter capsule whose foot is lifted by stepHeight (using effectiveStepHeight) and whose head is unchanged. | |
| glm::vec3 | walkCenterOffset (float requestedStepHeight) const noexcept |
| Centre-position offset that takes a full-capsule centre to the matching walk-capsule centre (head aligned). | |
Public Attributes | |
| float | radius {16.0f} |
| Cylinder cross-section radius. | |
| float | halfHeight {20.0f} |
| Half the segment length (excludes spherical caps). | |
| glm::vec3 | up {0.0f, 1.0f, 0.0f} |
| Unit-length axis direction. | |
Capsule shape input for swept-collision queries.
A capsule is a line segment thickened by a radius. The segment endpoints are center ± up * halfHeight; the surface is every point within radius of the segment. up defaults to +Y but may be any unit vector — this supports gravity-flipped play (where the capsule axis is -Y) and any future arbitrarily-oriented characters without changing the query API.
Functions taking a CapsuleShape treat center as the capsule's centre of mass (the midpoint of the segment), matching the semantics of the AABB family that takes a centre + halfExtents.
|
inlinenodiscardnoexcept |
Clamp a requested step height to a value the capsule can safely support — never larger than the segment half-length, leaving a small numerical margin so the derived walkShape() always has a positive halfHeight.
Crouched players (small halfHeight) get a proportionally smaller effective step.
|
inlinenodiscardnoexcept |
Tight half-extents of the AABB that encloses the capsule at center.
Used for BVH broad-phase culling. For a Y-aligned capsule of radius r and half-height h, this returns (r, h + r, r).
|
inlinenodiscardnoexcept |
Minkowski half-extent of the capsule along a unit direction n.
For a Y-aligned capsule this is r + h * |n.y|; for an arbitrary axis it is r + h * |dot(up, n)|. Used by every plane / slab / Minkowski-sum query as the capsule analogue of |n.x|*hx + |n.y|*hy + |n.z|*hz for an AABB.
|
inlinenodiscardnoexcept |
Top endpoint of the inner segment at center.
|
inlinenodiscardnoexcept |
Bottom endpoint of the inner segment at center.
|
inlinenodiscardnoexcept |
Centre-position offset that takes a full-capsule centre to the matching walk-capsule centre (head aligned).
Always points along +up — for gravity-flipped play the caller should negate the result.
|
inlinenodiscardnoexcept |
"Walk" capsule — a shorter capsule whose foot is lifted by stepHeight (using effectiveStepHeight) and whose head is unchanged.
Used by the two-capsule character controller for horizontal motion: a sweep with this shape is physically incapable of contacting anything ≤ stepHeight tall, so steps / curbs / stair risers within that height are transparently ignored. Vertical settle later snaps the foot onto whatever is below.
| float physics::CapsuleShape::halfHeight {20.0f} |
Half the segment length (excludes spherical caps).
| float physics::CapsuleShape::radius {16.0f} |
Cylinder cross-section radius.
| glm::vec3 physics::CapsuleShape::up {0.0f, 1.0f, 0.0f} |
Unit-length axis direction.