Jolt Physics
A multi core friendly Game Physics Engine
|
Base class for character class. More...
#include <CharacterBase.h>
Public Types | |
enum class | EGroundState { OnGround , OnSteepGround , NotSupported , InAir } |
Public Member Functions | |
JPH_OVERRIDE_NEW_DELETE | CharacterBase (const CharacterBaseSettings *inSettings, PhysicsSystem *inSystem) |
Constructor. | |
virtual | ~CharacterBase ()=default |
Destructor. | |
void | SetMaxSlopeAngle (float inMaxSlopeAngle) |
Set the maximum angle of slope that character can still walk on (radians) | |
float | GetCosMaxSlopeAngle () const |
void | SetUp (Vec3Arg inUp) |
Set the up vector for the character. | |
Vec3 | GetUp () const |
bool | IsSlopeTooSteep (Vec3Arg inNormal) const |
Check if the normal of the ground surface is too steep to walk on. | |
const Shape * | GetShape () const |
Get the current shape that the character is using. | |
Public Member Functions inherited from RefTarget< CharacterBase > | |
RefTarget ()=default | |
Constructor. | |
RefTarget (const RefTarget &) | |
~RefTarget () | |
assert no one is referencing us | |
void | SetEmbedded () const |
RefTarget & | operator= (const RefTarget &) |
Assignment operator. | |
uint32 | GetRefCount () const |
Get current refcount of this object. | |
void | AddRef () const |
Add or release a reference to this object. | |
void | Release () const |
Public Member Functions inherited from NonCopyable | |
NonCopyable ()=default | |
NonCopyable (const NonCopyable &)=delete | |
void | operator= (const NonCopyable &)=delete |
Static Public Member Functions | |
static const char * | sToString (EGroundState inState) |
Debug function to convert enum values to string. | |
Static Public Member Functions inherited from RefTarget< CharacterBase > | |
static int | sInternalGetRefCountOffset () |
INTERNAL HELPER FUNCTION USED BY SERIALIZATION. | |
Properties of the ground this character is standing on | |
PhysicsSystem * | mSystem |
RefConst< Shape > | mShape |
Vec3 | mUp |
Plane | mSupportingVolume |
float | mCosMaxSlopeAngle |
EGroundState | mGroundState = EGroundState::InAir |
BodyID | mGroundBodyID |
SubShapeID | mGroundBodySubShapeID |
RVec3 | mGroundPosition = RVec3::sZero() |
Vec3 | mGroundNormal = Vec3::sZero() |
Vec3 | mGroundVelocity = Vec3::sZero() |
RefConst< PhysicsMaterial > | mGroundMaterial = PhysicsMaterial::sDefault |
uint64 | mGroundUserData = 0 |
static constexpr float | cNoMaxSlopeAngle = 0.9999f |
EGroundState | GetGroundState () const |
Current ground state. | |
bool | IsSupported () const |
Returns true if the player is supported by normal or steep ground. | |
RVec3 | GetGroundPosition () const |
Get the contact point with the ground. | |
Vec3 | GetGroundNormal () const |
Get the contact normal with the ground. | |
Vec3 | GetGroundVelocity () const |
Velocity in world space of ground. | |
const PhysicsMaterial * | GetGroundMaterial () const |
Material that the character is standing on. | |
BodyID | GetGroundBodyID () const |
BodyID of the object the character is standing on. Note may have been removed! | |
SubShapeID | GetGroundSubShapeID () const |
Sub part of the body that we're standing on. | |
uint64 | GetGroundUserData () const |
User data value of the body that we're standing on. | |
virtual void | SaveState (StateRecorder &inStream) const |
virtual void | RestoreState (StateRecorder &inStream) |
Additional Inherited Members | |
Protected Attributes inherited from RefTarget< CharacterBase > | |
atomic< uint32 > | mRefCount |
Current reference count. | |
Static Protected Attributes inherited from RefTarget< CharacterBase > | |
static constexpr uint32 | cEmbedded |
A large value that gets added to the refcount to mark the object as embedded. | |
Base class for character class.
|
strong |
Enumerator | |
---|---|
OnGround | Character is on the ground and can move freely. |
OnSteepGround | Character is on a slope that is too steep and can't climb up any further. The caller should start applying downward velocity if sliding from the slope is desired. |
NotSupported | Character is touching an object, but is not supported by it and should fall. The GetGroundXXX functions will return information about the touched object. |
InAir | Character is in the air and is not touching anything. |
JPH_NAMESPACE_BEGIN CharacterBase::CharacterBase | ( | const CharacterBaseSettings * | inSettings, |
PhysicsSystem * | inSystem | ||
) |
Constructor.
|
virtualdefault |
Destructor.
|
inline |
|
inline |
BodyID of the object the character is standing on. Note may have been removed!
|
inline |
Material that the character is standing on.
|
inline |
Get the contact normal with the ground.
|
inline |
Get the contact point with the ground.
|
inline |
Current ground state.
|
inline |
Sub part of the body that we're standing on.
|
inline |
User data value of the body that we're standing on.
|
inline |
Velocity in world space of ground.
|
inline |
Get the current shape that the character is using.
|
inline |
|
inline |
Check if the normal of the ground surface is too steep to walk on.
|
inline |
Returns true if the player is supported by normal or steep ground.
|
virtual |
Reimplemented in CharacterVirtual.
|
virtual |
Reimplemented in CharacterVirtual.
|
inline |
Set the maximum angle of slope that character can still walk on (radians)
|
inline |
Set the up vector for the character.
|
static |
Debug function to convert enum values to string.
|
staticconstexprprotected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |