Open 3D Engine AzCore API Reference  24.09
O3DE is an open-source, fully-featured, high-fidelity, modular 3D engine for building games and simulations, available to every industry.
AZ::Capsule Class Reference

A class representing a capsule (a cylinder with a hemispherical cap at each end). More...

#include <Capsule.h>

Public Member Functions

 AZ_TYPE_INFO (Capsule, "{4B7E9154-B258-40D2-81A4-A27A25030588}")
 
 Capsule (const Vector3 &firstHemisphereCenter, const Vector3 &secondHemisphereCenter, float radius)
 Constructs a Capsule from the centers of the two hemispherical caps (the order is arbitrary), and the radius.
 
 Capsule (const LineSegment &lineSegment, float radius)
 
const Vector3GetFirstHemisphereCenter () const
 Gets the center of the first hemispherical cap (the order of the caps is arbitrary).
 
const Vector3GetSecondHemisphereCenter () const
 Gets the center of the second hemispherical cap (the order of the caps is arbitrary).
 
Vector3 GetCenter () const
 Gets the overall center of the capsule.
 
float GetRadius () const
 Gets the radius of the capsule.
 
float GetCylinderHeight () const
 Gets the height of the cylindrical section of the capsule.
 
float GetTotalHeight () const
 Gets the total height of the capsule, including the cylindrical section and both hemispherical caps.
 
void SetFirstHemisphereCenter (const Vector3 &firstHemisphereCenter)
 Sets the center of the first hemispherical cap (the order of the caps is arbitrary).
 
void SetSecondHemisphereCenter (const Vector3 &secondHemisphereCenter)
 Sets the center of the second hemispherical cap (the order of the caps is arbitrary).
 
void SetRadius (float radius)
 Sets the radius of the capsule.
 
bool IsClose (const Capsule &rhs, float tolerance=Constants::Tolerance) const
 Returns whether this capsule is identical to another within the tolerance (allowing either order for the caps).
 
bool Contains (const AZ::Vector3 &point) const
 Returns true if the point is inside or on the surface of the capsule.
 

Detailed Description

A class representing a capsule (a cylinder with a hemispherical cap at each end).

Constructor & Destructor Documentation

◆ Capsule()

AZ_MATH_INLINE AZ::Capsule::Capsule ( const LineSegment lineSegment,
float  radius 
)

Constructs a Capsule using the ends of the provided LineSegment as the centers of the hemispherical caps, and using the provided radius.


The documentation for this class was generated from the following files: