![]() |
Divide Framework 0.1
A free and open-source 3D Framework under heavy development
|
#include <Character.h>
Public Types | |
enum class | CharacterType : U8 { CHARACTER_TYPE_PLAYER = 0 , CHARACTER_TYPE_NPC , COUNT } |
Currently supported character types. More... | |
![]() | |
using | AttributeMap = hashMap< U32, I32 > |
Public Member Functions | |
Character (CharacterType type) | |
virtual void | update (U64 deltaTimeUS) |
virtual void | setPosition (const vec3< F32 > &newPosition) |
Set the current position of this charater. | |
virtual void | setVelocity (const vec3< F32 > &newVelocity) |
Update character velocity. | |
virtual vec3< F32 > | getPosition () const |
The current position of this character. | |
virtual vec3< F32 > | getLookingDirection () |
The direction in which the character is currently looking. | |
virtual void | lookAt (const vec3< F32 > &targetPos) |
Rotate the character to look at another character. | |
const vec3< F32 > & | getRelativeLookingDirection () const noexcept |
void | setRelativeLookingDirection (const vec3< F32 > &direction) noexcept |
void | playAnimation (U32 index) const |
void | playNextAnimation () const |
void | playPreviousAnimation () const |
void | pauseAnimation (bool state) const |
PROPERTY_RW (CharacterType, characterType, CharacterType::COUNT) | |
![]() | |
Unit (UnitType type) | |
virtual bool | moveTo (const vec3< F32 > &targetPosition, const U64 deltaTimeUS) |
virtual bool | moveToX (F32 targetPosition, const U64 deltaTimeUS) |
Move along the X axis. | |
virtual bool | moveToY (F32 targetPosition, const U64 deltaTimeUS) |
Move along the Y axis. | |
virtual bool | moveToZ (F32 targetPosition, const U64 deltaTimeUS) |
Move along the Z axis. | |
virtual bool | teleportTo (const vec3< F32 > &targetPosition) |
teleportTo instantly places the unit at the desired position | |
const vec3< F32 > & | getCurrentPosition () const |
const vec3< F32 > & | getTargetPosition () const |
Get the unit's target coordinates in the world. | |
virtual void | setMovementSpeed (const F32 movementSpeed) |
virtual void | setAcceleration (const F32 acceleration) |
Set the unit's acceleration in metres per second squared. | |
virtual F32 | getMovementSpeed () const |
Get the unit's current movement speed. | |
virtual F32 | getAcceleration () const |
Get the unit's acceleration rate. | |
void | setMovementTolerance (const F32 movementTolerance) |
Set destination tolerance. | |
F32 | getMovementTolerance () const |
Get the units current movement tolerance. | |
SceneGraphNode * | getBoundNode () const |
Get bound node. | |
virtual void | setAttribute (U32 attributeID, I32 initialValue) |
virtual I32 | getAttribute (U32 attributeID) const |
PROPERTY_RW (UnitType, type, UnitType::COUNT) | |
![]() | |
GUIDWrapper () noexcept | |
GUIDWrapper (const GUIDWrapper &old) noexcept | |
GUIDWrapper (GUIDWrapper &&old) noexcept | |
virtual | ~GUIDWrapper ()=default |
FORCE_INLINE I64 | getGUID () const noexcept |
GUIDWrapper & | operator= (const GUIDWrapper &old)=delete |
GUIDWrapper & | operator= (GUIDWrapper &&other)=delete |
Protected Member Functions | |
void | setParentNode (SceneGraphNode *node) override |
virtual void | setParentNode (SceneGraphNode *node) |
Private Attributes | |
vec3< F32 > | _lookingDirection |
vec3< F32 > | _newPosition |
vec3< F32 > | _oldPosition |
vec3< F32 > | _curPosition |
vec3< F32 > | _newVelocity |
vec3< F32 > | _curVelocity |
std::atomic_bool | _positionDirty |
std::atomic_bool | _velocityDirty |
Additional Inherited Members | |
![]() | |
static I64 | generateGUID () noexcept |
![]() | |
F32 | _moveSpeed |
Movement speed (meters per second) | |
F32 | _acceleration |
Acceleration (meters per second squared. | |
F32 | _moveTolerance |
acceptable distance from target | |
vec3< F32 > | _currentPosition |
Unit position in world. | |
vec3< F32 > | _currentTargetPosition |
Current destination point cached. | |
SceneGraphNode * | _node |
AttributeMap | _attributes |
SharedMutex | _unitUpdateMutex |
![]() | |
const I64 | _guid |
Basic character class. Use the internally calculated position to update the attached node's transform!
Definition at line 79 of file Character.h.
|
strong |
Currently supported character types.
Enumerator | |
---|---|
CHARACTER_TYPE_PLAYER | user controlled character |
CHARACTER_TYPE_NPC | non-user(player) character |
COUNT | placeholder |
Definition at line 82 of file Character.h.
|
explicit |
Definition at line 11 of file Character.cpp.
The direction in which the character is currently looking.
Definition at line 76 of file Character.cpp.
The current position of this character.
Definition at line 72 of file Character.cpp.
Definition at line 119 of file Character.h.
Rotate the character to look at another character.
Definition at line 86 of file Character.cpp.
void Divide::Character::pauseAnimation | ( | bool | state | ) | const |
Definition at line 162 of file Character.cpp.
void Divide::Character::playAnimation | ( | U32 | index | ) | const |
Definition at line 97 of file Character.cpp.
void Divide::Character::playNextAnimation | ( | ) | const |
Definition at line 124 of file Character.cpp.
void Divide::Character::playPreviousAnimation | ( | ) | const |
Definition at line 143 of file Character.cpp.
Divide::Character::PROPERTY_RW | ( | CharacterType | , |
characterType | , | ||
CharacterType::COUNT | |||
) |
|
overrideprotectedvirtual |
Reimplemented from Divide::Unit.
Reimplemented in Divide::Player.
Definition at line 22 of file Character.cpp.
Set the current position of this charater.
Definition at line 62 of file Character.cpp.
Definition at line 120 of file Character.h.
Update character velocity.
Definition at line 67 of file Character.cpp.
|
virtual |
Update this character for drawing a new frame. Updates one tick in the render loop. In order for the agents to be updated, you first need to call the detourCrowd update function. What is updated specifically is up to a specific implementation of Character, but at the very least the position in the scene should be updated to reflect the detour agent position (possibly with additional physics engine clipping and collision testing).
Reimplemented in Divide::NPC.
Definition at line 33 of file Character.cpp.
Definition at line 134 of file Character.h.
Definition at line 135 of file Character.h.
Definition at line 133 of file Character.h.
Definition at line 134 of file Character.h.
Definition at line 135 of file Character.h.
Definition at line 134 of file Character.h.
|
private |
Definition at line 136 of file Character.h.
|
private |
Definition at line 137 of file Character.h.