i6engine
1.0
|
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 |
#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 ¶ms) | |
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< componentOptions > | getComponentOptions () 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 ¶ms) | |
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 ¶ms) | |
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< ComPtr > | getSubComponents () 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 ¶ms) |
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 MoverComponent & | operator= (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 ¶ms) |
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.
i6e::api::MoverComponent::MoverComponent | ( | const int64_t | id, |
const attributeMap & | params | ||
) |
|
virtual |
|
protecteddelete |
|
overridevirtual |
finalizes the component
Reimplemented from i6e::api::Component.
|
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.
|
protectedpure virtual |
retrieves the new postion/rotation values
[in] | t | time since starting |
[out] | newPos | new position to be used |
[out] | newRot | new Rotation to be used |
|
overridevirtual |
asks, how to handle a new component with the same type
[in] | comp | component that shall be added |
Reimplemented from i6e::api::Component.
|
overridevirtual |
Initializes the Component.
Reimplemented from i6e::api::ShatterComponent.
|
protectedvirtual |
loads all parameters from a message
|
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.
|
protecteddelete |
|
pure virtual |
resets progress to initial status
Implemented in i6e::api::MoverInterpolateComponent, and i6e::api::MoverCircleComponent.
|
inline |
[in] | duration | time in microseconds |
Definition at line 81 of file MoverComponent.h.
|
inline |
Definition at line 85 of file MoverComponent.h.
|
overridevirtual |
Is called after a collision is detected.
[in] | other | GameObject you collided with |
Implements i6e::api::ShatterComponent.
|
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
|
overridevirtual |
synchronizes the Components state
Reimplemented from i6e::api::ShatterComponent.
Reimplemented in i6e::api::MoverInterpolateComponent, and i6e::api::MoverCircleComponent.
|
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.
|
protected |
duration for one path
Definition at line 119 of file MoverComponent.h.
|
protected |
whether the call to start() will start or continue the movement
Definition at line 162 of file MoverComponent.h.
|
protected |
last position value calculated in imaginary path used for RELATIVE positioning
Definition at line 140 of file MoverComponent.h.
|
protected |
last rotation value calculated in imaginary path used for RELATIVE positioning
Definition at line 152 of file MoverComponent.h.
|
protected |
whether the object on the Mover should be linked and moved with the Mover
Definition at line 172 of file MoverComponent.h.
|
protected |
vector of all linked GameObject IDs
Definition at line 177 of file MoverComponent.h.
|
protected |
current status
Definition at line 157 of file MoverComponent.h.
|
protected |
type of positioning
Definition at line 124 of file MoverComponent.h.
|
protected |
PSC of the GameObject.
Definition at line 129 of file MoverComponent.h.
|
protected |
real starting position needed for synchronizing
Definition at line 146 of file MoverComponent.h.
|
protected |
whether the Mover should be started on creation or not
Definition at line 167 of file MoverComponent.h.
|
protected |
time the moving started
Definition at line 134 of file MoverComponent.h.