#ifndef PX_PHYSICS_CCT_BOX_CONTROLLER
#define PX_PHYSICS_CCT_BOX_CONTROLLER
#include "characterkinematic/PxController.h"
#if !PX_DOXYGEN
namespace physx
{
#endif
class PxBoxControllerDesc : public PxControllerDesc
{
public:
PX_INLINE PxBoxControllerDesc();
PX_INLINE virtual ~PxBoxControllerDesc() {}
PX_INLINE PxBoxControllerDesc(const PxBoxControllerDesc&);
PX_INLINE PxBoxControllerDesc& operator=(const PxBoxControllerDesc&);
PX_INLINE virtual void setToDefault();
PX_INLINE virtual bool isValid() const;
PxF32 halfHeight;
PxF32 halfSideExtent;
PxF32 halfForwardExtent;
protected:
PX_INLINE void copy(const PxBoxControllerDesc&);
};
PX_INLINE PxBoxControllerDesc::PxBoxControllerDesc() :
PxControllerDesc (PxControllerShapeType::eBOX),
halfHeight (1.0f),
halfSideExtent (0.5f),
halfForwardExtent (0.5f)
{
}
PX_INLINE PxBoxControllerDesc::PxBoxControllerDesc(const PxBoxControllerDesc& other) : PxControllerDesc(other)
{
copy(other);
}
PX_INLINE PxBoxControllerDesc& PxBoxControllerDesc::operator=(const PxBoxControllerDesc& other)
{
PxControllerDesc::operator=(other);
copy(other);
return *this;
}
PX_INLINE void PxBoxControllerDesc::copy(const PxBoxControllerDesc& other)
{
halfHeight = other.halfHeight;
halfSideExtent = other.halfSideExtent;
halfForwardExtent = other.halfForwardExtent;
}
PX_INLINE void PxBoxControllerDesc::setToDefault()
{
*this = PxBoxControllerDesc();
}
PX_INLINE bool PxBoxControllerDesc::isValid() const
{
if(!PxControllerDesc::isValid()) return false;
if(halfHeight<=0.0f) return false;
if(halfSideExtent<=0.0f) return false;
if(halfForwardExtent<=0.0f) return false;
if(stepOffset>2.0f*halfHeight) return false; return true;
}
class PxBoxController : public PxController
{
public:
virtual PxF32 getHalfHeight() const = 0;
virtual PxF32 getHalfSideExtent() const = 0;
virtual PxF32 getHalfForwardExtent() const = 0;
virtual bool setHalfHeight(PxF32 halfHeight) = 0;
virtual bool setHalfSideExtent(PxF32 halfSideExtent) = 0;
virtual bool setHalfForwardExtent(PxF32 halfForwardExtent) = 0;
protected:
PX_INLINE PxBoxController() {}
virtual ~PxBoxController() {}
};
#if !PX_DOXYGEN
} #endif
#endif