i6engine  1.0
i6e::api::MoverComponent Class Referenceabstract

This component let's the Object move through the world automatically on fixed paths Use addKeyFrame() to add new keyframes (specific positions in the world) Than call start to start the moving. This component will move the object during each tick. You can control the behaviour by defining a mode, a way and the way of positioning. Consult the enum definitions for a detailed description This Component will soon be split into several subclasses for different Ways. For creating a MoverComponent, these keys are possible:

Name Required Type Description Public
duration yes uint64_t Duration of one movement cycle yes
positioning yes short Absolute or relative positioning yes
continue no "true" continues movement instead of starting no
startTime *) uint64_t *) required when continue set to synchronize time no
lastPos no Vec3 the last position of the circle no
linkable no bool should colliding objects (with correct flags) be linked to this mover and moved with it yes
started yes bool should this mover start directly yes
More...

#include <D:/Projekte/i6engine/libs/i6engine-modules/include/i6engine/api/components/MoverComponent.h>

Public Types

enum  Positioning : uint16_t { Positioning::POSITIONING_ABSOLUTE, Positioning::POSITIONING_RELATIVE }
 

Public Member Functions

 MoverComponent (const int64_t id, const attributeMap &params)
 
virtual ~MoverComponent ()
 
virtual void Tick () override
 Components can have Tick method like normal Subsystems this method is called by the ObjectController during every Tick if the component registered itself at the ObjectFacade. More...
 
virtual void Init () override
 Initializes the Component. More...
 
virtual void Finalize () override
 finalizes the component More...
 
void setDuration (const uint64_t duration)
 
void setPositioning (const Positioning posing)
 
virtual void start (Vec3 &startPos)=0
 starts the moving the startPos position should be the starting position of the movement the object will be moved to this position, or in case of a circle automatically in the circle path More...
 
void stop ()
 stops movement More...
 
virtual void reset ()=0
 resets progress to initial status More...
 
virtual attributeMap synchronize () const override
 synchronizes the Components state More...
 
std::pair< AddStrategy, int64_t > howToAdd (const ComPtr &comp) const override
 asks, how to handle a new component with the same type More...
 
void shatter (const GOPtr &go) override
 Is called after a collision is detected. More...
 
std::vector< componentOptionsgetComponentOptions () override
 returns a vector containing all options of the Component being readable and writeable in the editor More...
 
- Public Member Functions inherited from i6e::api::ShatterComponent
 ShatterComponent (int64_t id, const attributeMap &params)
 Constructor of the component with a given id. More...
 
virtual ~ShatterComponent ()
 Destructor of the component. More...
 
void resetRespawn ()
 
- Public Member Functions inherited from i6e::api::Component
 Component ()
 Constructor for Component. More...
 
 Component (const int64_t id, const attributeMap &params)
 Constructor for Component. More...
 
virtual ~Component ()
 Destructor of Component. Must be implemented in derived class. More...
 
void setOwnerGO (const WeakGOPtr &objGo)
 Sets the GameObject that owns this Component. More...
 
GOPtr getOwnerGO ()
 Get the GameObject that owns this Component. More...
 
uint32_t getComponentID () const
 Returns the component identification string. More...
 
uint32_t getFamilyID () const
 Returns the family identification string. More...
 
std::string getIdentifier () const
 Returns the family identification string. More...
 
void setDie () const
 component will be deleted soon More...
 
int64_t getID () const
 returns the id of the component More...
 
void setSync (bool b)
 sets whether this object has to be synchronized or not More...
 
bool getSync () const
 
void enableTicking (bool allowTicking) const
 triggers doEnableTicking threadsafe More...
 
void setSelf (const WeakComPtr &self)
 sets weak_ptr on self for registration of ticker More...
 
virtual std::string getTemplateName () const =0
 returns the name this template was registered with More...
 
std::vector< ComPtrgetSubComponents () const
 returns all SubComponents attached to this Component More...
 

Protected Member Functions

virtual void News (const GameMessage::Ptr &msg) override=0
 handles incoming messages. Currently only one message is supported: MoverResync - Synchronizes the state of the component after a non-predictable change More...
 
virtual void loadParams (const attributeMap &params)
 loads all parameters from a message More...
 
virtual void getNewPosition (const uint64_t t, Vec3 &newPos, Quaternion &newRot)=0
 retrieves the new postion/rotation values More...
 
 MoverComponent (const MoverComponent &)=delete
 
const MoverComponentoperator= (const MoverComponent &)=delete
 
- Protected Member Functions inherited from i6e::api::Component
void addTicker ()
 adds this component to ticklist More...
 
void removeTicker ()
 removes this component from ticklist More...
 
void doEnableTicking (bool allowTicking)
 sets ticking status for this Component per default all Components are allowed to tick and calling addTicker will start ticking, but in some cases, e.g. for level editor, ticking has to be disabled and just a few components are allowed to tick More...
 

Protected Attributes

uint64_t _duration
 duration for one path More...
 
Positioning _positioning
 type of positioning More...
 
utils::weakPtr< PhysicalStateComponent, Component_psc
 PSC of the GameObject. More...
 
uint64_t _startTime
 time the moving started More...
 
Vec3 _lastPos
 last position value calculated in imaginary path used for RELATIVE positioning More...
 
Vec3 _realStartPos
 real starting position needed for synchronizing More...
 
Quaternion _lastRot
 last rotation value calculated in imaginary path used for RELATIVE positioning More...
 
bool _moving
 current status More...
 
bool _initial
 whether the call to start() will start or continue the movement More...
 
bool _started
 whether the Mover should be started on creation or not More...
 
bool _linkable
 whether the object on the Mover should be linked and moved with the Mover More...
 
std::vector< int64_t > _linked
 vector of all linked GameObject IDs More...
 
- Protected Attributes inherited from i6e::api::Component
int64_t _objOwnerID
 ID of the GameObject that owns this Component. More...
 
WeakGOPtr _objOwnerGO
 Owning GameObject. More...
 
uint32_t _objComponentID
 Component ID of the Component. More...
 
uint32_t _objFamilyID
 Family ID of the Component. More...
 
std::vector< ComPtr_subComps
 vector containing the other componetns of the same type if this is the dispatcher component More...
 
std::string _identifier
 identifies the subcomponent More...
 
int64_t _id
 id of this component More...
 
bool _sync
 
WeakComPtr _self
 a weak_ptr on the own shared_ptr More...
 
bool _tickingAllowed
 status if this object is allowed to tick or not More...
 
bool _wantsToTick
 stores if a Component which isn't allowed to tick want to tick, so it can start ticking when ticking will be allowed More...
 
bool _isTicking
 stores whether this Component is actually ticking More...
 

Additional Inherited Members

- Static Public Member Functions inherited from i6e::api::Component
template<typename T >
static ComPtr createC (const int64_t id, const attributeMap &params)
 

Detailed Description

This component let's the Object move through the world automatically on fixed paths Use addKeyFrame() to add new keyframes (specific positions in the world) Than call start to start the moving. This component will move the object during each tick. You can control the behaviour by defining a mode, a way and the way of positioning. Consult the enum definitions for a detailed description This Component will soon be split into several subclasses for different Ways. For creating a MoverComponent, these keys are possible:

Name Required Type Description Public
duration yes uint64_t Duration of one movement cycle yes
positioning yes short Absolute or relative positioning yes
continue no "true" continues movement instead of starting no
startTime *) uint64_t *) required when continue set to synchronize time no
lastPos no Vec3 the last position of the circle no
linkable no bool should colliding objects (with correct flags) be linked to this mover and moved with it yes
started yes bool should this mover start directly yes

Definition at line 61 of file MoverComponent.h.

Constructor & Destructor Documentation

i6e::api::MoverComponent::MoverComponent ( const int64_t  id,
const attributeMap params 
)
virtual i6e::api::MoverComponent::~MoverComponent ( )
virtual
i6e::api::MoverComponent::MoverComponent ( const MoverComponent )
protecteddelete

Member Function Documentation

virtual void i6e::api::MoverComponent::Finalize ( )
overridevirtual

finalizes the component

Reimplemented from i6e::api::Component.

std::vector<componentOptions> i6e::api::MoverComponent::getComponentOptions ( )
overridevirtual

returns a vector containing all options of the Component being readable and writeable in the editor

Implements i6e::api::Component.

Reimplemented in i6e::api::MoverInterpolateComponent.

virtual void i6e::api::MoverComponent::getNewPosition ( const uint64_t  t,
Vec3 newPos,
Quaternion newRot 
)
protectedpure virtual

retrieves the new postion/rotation values

Parameters
[in]ttime since starting
[out]newPosnew position to be used
[out]newRotnew Rotation to be used
std::pair<AddStrategy, int64_t> i6e::api::MoverComponent::howToAdd ( const ComPtr comp) const
overridevirtual

asks, how to handle a new component with the same type

Parameters
[in]compcomponent that shall be added
Returns
pair containing the strategy to use as well as an additional value

Reimplemented from i6e::api::Component.

virtual void i6e::api::MoverComponent::Init ( )
overridevirtual

Initializes the Component.

Reimplemented from i6e::api::ShatterComponent.

virtual void i6e::api::MoverComponent::loadParams ( const attributeMap params)
protectedvirtual

loads all parameters from a message

virtual void i6e::api::MoverComponent::News ( const GameMessage::Ptr msg)
overrideprotectedpure virtual

handles incoming messages. Currently only one message is supported: MoverResync - Synchronizes the state of the component after a non-predictable change

Reimplemented from i6e::api::ShatterComponent.

const MoverComponent& i6e::api::MoverComponent::operator= ( const MoverComponent )
protecteddelete
virtual void i6e::api::MoverComponent::reset ( )
pure virtual

resets progress to initial status

Implemented in i6e::api::MoverInterpolateComponent, and i6e::api::MoverCircleComponent.

void i6e::api::MoverComponent::setDuration ( const uint64_t  duration)
inline
Parameters
[in]durationtime in microseconds

Definition at line 81 of file MoverComponent.h.

void i6e::api::MoverComponent::setPositioning ( const Positioning  posing)
inline

Definition at line 85 of file MoverComponent.h.

void i6e::api::MoverComponent::shatter ( const GOPtr other)
overridevirtual

Is called after a collision is detected.

Parameters
[in]otherGameObject you collided with

Implements i6e::api::ShatterComponent.

virtual void i6e::api::MoverComponent::start ( Vec3 startPos)
pure virtual

starts the moving the startPos position should be the starting position of the movement the object will be moved to this position, or in case of a circle automatically in the circle path

Implemented in i6e::api::MoverInterpolateComponent, and i6e::api::MoverCircleComponent.

void i6e::api::MoverComponent::stop ( )

stops movement

virtual attributeMap i6e::api::MoverComponent::synchronize ( ) const
overridevirtual

synchronizes the Components state

Reimplemented from i6e::api::ShatterComponent.

Reimplemented in i6e::api::MoverInterpolateComponent, and i6e::api::MoverCircleComponent.

virtual void i6e::api::MoverComponent::Tick ( )
overridevirtual

Components can have Tick method like normal Subsystems this method is called by the ObjectController during every Tick if the component registered itself at the ObjectFacade.

Reimplemented from i6e::api::Component.

Member Data Documentation

uint64_t i6e::api::MoverComponent::_duration
protected

duration for one path

Definition at line 119 of file MoverComponent.h.

bool i6e::api::MoverComponent::_initial
protected

whether the call to start() will start or continue the movement

Definition at line 162 of file MoverComponent.h.

Vec3 i6e::api::MoverComponent::_lastPos
protected

last position value calculated in imaginary path used for RELATIVE positioning

Definition at line 140 of file MoverComponent.h.

Quaternion i6e::api::MoverComponent::_lastRot
protected

last rotation value calculated in imaginary path used for RELATIVE positioning

Definition at line 152 of file MoverComponent.h.

bool i6e::api::MoverComponent::_linkable
protected

whether the object on the Mover should be linked and moved with the Mover

Definition at line 172 of file MoverComponent.h.

std::vector<int64_t> i6e::api::MoverComponent::_linked
protected

vector of all linked GameObject IDs

Definition at line 177 of file MoverComponent.h.

bool i6e::api::MoverComponent::_moving
protected

current status

Definition at line 157 of file MoverComponent.h.

Positioning i6e::api::MoverComponent::_positioning
protected

type of positioning

Definition at line 124 of file MoverComponent.h.

utils::weakPtr<PhysicalStateComponent, Component> i6e::api::MoverComponent::_psc
protected

PSC of the GameObject.

Definition at line 129 of file MoverComponent.h.

Vec3 i6e::api::MoverComponent::_realStartPos
protected

real starting position needed for synchronizing

Definition at line 146 of file MoverComponent.h.

bool i6e::api::MoverComponent::_started
protected

whether the Mover should be started on creation or not

Definition at line 167 of file MoverComponent.h.

uint64_t i6e::api::MoverComponent::_startTime
protected

time the moving started

Definition at line 134 of file MoverComponent.h.


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