i6engine
1.0
|
Represents an object's physical state and synchronizes with the Physics subsystem. For creating a PhysicalStateComponent, these keys are possible:
Name | Required | Type | Description | Public |
---|---|---|---|---|
syncPrio | no | int | priority from which upwards updates should be sent through network | yes |
gravity | no | Vec3 | gravity for this object. Replaces default | yes |
pos | yes | Vec3 | position of the SceneNode | yes |
rot | yes | Quaternion | rotation of the SceneNode | yes |
scale | yes | Vec3 | scale of the SceneNode | yes |
collisionGroup | yes | int int int | ResponseType CrashType CrashMask | yes |
shapeType | yes | int | one of the shapeTypes from ShapeType enum | yes |
shatterInterest | yes | int | one of the shatterInterests from ShatterInterest enum | yes |
compound | yes | bool | should this PSC be used as a compound shape together with other ones of this GameObject | yes |
#include <D:/Projekte/i6engine/libs/i6engine-modules/include/i6engine/api/components/PhysicalStateComponent.h>
Public Types | |
enum | ShapeType : uint16_t { ShapeType::PLANE, ShapeType::BOX, ShapeType::SPHERE, ShapeType::FILE } |
Different shape types supported by i6engine. More... | |
enum | RayTestRepetition : uint16_t { RayTestRepetition::STOP, RayTestRepetition::ONCE, RayTestRepetition::PERIODIC } |
Different flags for kind of raytest repetition. More... | |
enum | RayTestNotify : uint16_t { RayTestNotify::ALWAYS, RayTestNotify::CHANGE, RayTestNotify::FOUND, RayTestNotify::NOTFOUND, RayTestNotify::OBJECTCHANGE } |
Different flags for the kind of notify mechanism of raytest. More... | |
Public Member Functions | |
PhysicalStateComponent (const int64_t id, const attributeMap ¶ms) | |
constructor More... | |
~PhysicalStateComponent () | |
destructor More... | |
Vec3 | getPosition () const |
Returns the position of the object. More... | |
void | setPosition (const Vec3 &position, uint32_t prio) |
Changes the position of the object. More... | |
Quaternion | getRotation () const |
Returns the rotation of the object. More... | |
void | setRotation (const Quaternion &rotation, uint32_t prio) |
Changes the rotation of the object. More... | |
Vec3 | getScale () const |
returns the current scale value More... | |
void | setScale (const Vec3 &scale, uint32_t prio) |
sets the current scale value More... | |
void | setCollisionFlags (const CollisionGroup &col) |
sets the collision flags of this GameObject More... | |
CollisionGroup | getCollisionFlags () const |
returns a reference to the Collision Flags of this GameObject More... | |
void | reset () |
Clears all forces and sets the velocity to 0 doesn't still move after resetting. More... | |
void | setCollisionShape (ShapeType st, const attributeMap ¶ms) |
sets type of the collision shape for this entity More... | |
void | applyRotation (const Quaternion &rotation) |
rotates the Object and the velocity More... | |
Vec3 | getLinearVelocity () const |
returns linear velocity More... | |
void | setLinearVelocity (const Vec3 &linVel, uint32_t prio) |
sets linear velocity During each Tick, only the change with highest priority will be propagated towards the physic. A value of 0 is reserved for the physic itself indicating the lowest priority More... | |
void | applyCentralForce (const Vec3 &cForce, bool forceIsLocalSpace) |
applies a force to an object all forces applied during one frame will be applied at the same time More... | |
void | applyForce (const Vec3 &force, const Vec3 &offset, bool forceIsLocalSpace) |
void | setShatterInterest (ShatterInterest si) |
sets type of the collision interest for this entity More... | |
void | setGravity (const Vec3 &gravity) |
sets the gravity More... | |
attributeMap | synchronize () const override |
synchronizes the Components state More... | |
void | rayTest (const Vec3 &from, const Vec3 &to, RayTestRepetition rtr, RayTestNotify rtn, const GameMessage::Ptr &msg) |
performs raytest with given parameters, only one periodic ray for each direction possible // FIXME: (Daniel) not really nice More... | |
std::string | getTemplateName () const override |
returns the name this template was registered with More... | |
void | addPosition (const Vec3 &pos) |
adds the given position to the real position 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::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... | |
std::vector< ComPtr > | getSubComponents () const |
returns all SubComponents attached to this Component 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) |
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 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... | |
Represents an object's physical state and synchronizes with the Physics subsystem. For creating a PhysicalStateComponent, these keys are possible:
Name | Required | Type | Description | Public |
---|---|---|---|---|
syncPrio | no | int | priority from which upwards updates should be sent through network | yes |
gravity | no | Vec3 | gravity for this object. Replaces default | yes |
pos | yes | Vec3 | position of the SceneNode | yes |
rot | yes | Quaternion | rotation of the SceneNode | yes |
scale | yes | Vec3 | scale of the SceneNode | yes |
collisionGroup | yes | int int int | ResponseType CrashType CrashMask | yes |
shapeType | yes | int | one of the shapeTypes from ShapeType enum | yes |
shatterInterest | yes | int | one of the shatterInterests from ShatterInterest enum | yes |
compound | yes | bool | should this PSC be used as a compound shape together with other ones of this GameObject | yes |
Definition at line 190 of file PhysicalStateComponent.h.
i6e::api::PhysicalStateComponent::PhysicalStateComponent | ( | const int64_t | id, |
const attributeMap & | params | ||
) |
constructor
i6e::api::PhysicalStateComponent::~PhysicalStateComponent | ( | ) |
destructor
void i6e::api::PhysicalStateComponent::addPosition | ( | const Vec3 & | pos | ) |
adds the given position to the real position
void i6e::api::PhysicalStateComponent::applyCentralForce | ( | const Vec3 & | cForce, |
bool | forceIsLocalSpace | ||
) |
applies a force to an object all forces applied during one frame will be applied at the same time
void i6e::api::PhysicalStateComponent::applyForce | ( | const Vec3 & | force, |
const Vec3 & | offset, | ||
bool | forceIsLocalSpace | ||
) |
void i6e::api::PhysicalStateComponent::applyRotation | ( | const Quaternion & | rotation | ) |
rotates the Object and the velocity
|
inline |
returns a reference to the Collision Flags of this GameObject
Definition at line 285 of file PhysicalStateComponent.h.
|
overridevirtual |
returns a vector containing all options of the Component being readable and writeable in the editor
Implements i6e::api::Component.
|
inline |
returns linear velocity
Definition at line 306 of file PhysicalStateComponent.h.
Vec3 i6e::api::PhysicalStateComponent::getPosition | ( | ) | const |
Returns the position of the object.
|
inline |
Returns the rotation of the object.
Definition at line 253 of file PhysicalStateComponent.h.
|
inline |
returns the current scale value
Definition at line 268 of file PhysicalStateComponent.h.
|
inlineoverridevirtual |
returns the name this template was registered with
Implements i6e::api::Component.
Definition at line 354 of file PhysicalStateComponent.h.
void i6e::api::PhysicalStateComponent::rayTest | ( | const Vec3 & | from, |
const Vec3 & | to, | ||
RayTestRepetition | rtr, | ||
RayTestNotify | rtn, | ||
const GameMessage::Ptr & | msg | ||
) |
performs raytest with given parameters, only one periodic ray for each direction possible // FIXME: (Daniel) not really nice
[in] | to | vector, the ray should be send to, relative to current position |
[in] | rtr | repetition behavior for this ray |
[in] | rtn | notify behavior for this ray |
[in] | msg | message to be send on notify |
void i6e::api::PhysicalStateComponent::reset | ( | ) |
Clears all forces and sets the velocity to 0 doesn't still move after resetting.
void i6e::api::PhysicalStateComponent::setCollisionFlags | ( | const CollisionGroup & | col | ) |
sets the collision flags of this GameObject
void i6e::api::PhysicalStateComponent::setCollisionShape | ( | ShapeType | st, |
const attributeMap & | params | ||
) |
sets type of the collision shape for this entity
void i6e::api::PhysicalStateComponent::setGravity | ( | const Vec3 & | gravity | ) |
sets the gravity
void i6e::api::PhysicalStateComponent::setLinearVelocity | ( | const Vec3 & | linVel, |
uint32_t | prio | ||
) |
sets linear velocity During each Tick, only the change with highest priority will be propagated towards the physic. A value of 0 is reserved for the physic itself indicating the lowest priority
void i6e::api::PhysicalStateComponent::setPosition | ( | const Vec3 & | position, |
uint32_t | prio | ||
) |
Changes the position of the object.
[in] | position | new position for the object |
[in] | prio | priority of the change |
Also sets the dirty flag to true. During each Tick, only the change with highest priority will be propagated towards the physic. A value of 0 is reserved for the physic itself indicating the lowest priority
void i6e::api::PhysicalStateComponent::setRotation | ( | const Quaternion & | rotation, |
uint32_t | prio | ||
) |
Changes the rotation of the object.
[in] | rotation | new rotation for the object |
Also sets the dirty flag to true. During each Tick, only the change with highest priority will be propagated towards the physic. A value of 0 is reserved for the physic itself indicating the lowest priority
void i6e::api::PhysicalStateComponent::setScale | ( | const Vec3 & | scale, |
uint32_t | prio | ||
) |
sets the current scale value
void i6e::api::PhysicalStateComponent::setShatterInterest | ( | ShatterInterest | si | ) |
sets type of the collision interest for this entity
|
overridevirtual |
synchronizes the Components state
Implements i6e::api::Component.