VoltAir
|
Logic which exerts force in a specified direction, causing the actor to roll in that direction. More...
Signals | |
void | directionChanged () |
Emitted when direction changes. More... | |
void | magnetismInfluenceChanged () |
Emitted when magnetismInfluence changes. More... | |
void | speedChanged () |
Emitted when speed changes. More... | |
void | proximityRadiusChanged () |
Emitted when proximityRadius changes. More... | |
void | antiGravityAmountChanged () |
Emitted when antiGravityAmount changes. More... | |
void | turnBoostChanged () |
Emitted when turnBoost changes. More... | |
void | torqueForceRatioChanged () |
Emitted when torqueForceRatio changes. More... | |
void | speedFalloffRatioChanged () |
Emitted when speedFalloffRatio changes. More... | |
![]() | |
void | activeChanged () |
Emitted when active changes. More... | |
Public Member Functions | |
QPointF | getDirection () const |
Returns direction. More... | |
void | setDirection (const QPointF &value) |
Sets direction. More... | |
QPointF | getMagnetismInfluence () const |
Returns magnetismInfluence. More... | |
void | setMagnetismInfluence (const QPointF &value) |
Sets magnetismInfluence. More... | |
float | getSpeed () const |
Returns speed. More... | |
void | setSpeed (float value) |
Sets speed. More... | |
float | getProximityRadius () const |
Returns proximityRadius. More... | |
void | setProximityRadius (float value) |
Sets proximityRadius. More... | |
float | getAntiGravityAmount () const |
Returns antiGravityAmount. More... | |
void | setAntiGravityAmount (float value) |
Sets antiGravityAmount. More... | |
float | getTurnBoost () const |
Returns turnBoost. More... | |
void | setTurnBoost (float value) |
Sets turnBoost. More... | |
float | getTorqueForceRatio () const |
Returns torqueForceRatio. More... | |
void | setTorqueForceRatio (float value) |
Sets torqueForceRatio. More... | |
float | getSpeedFalloffRatio () const |
Returns speedFalloffRatio. More... | |
void | setSpeedFalloffRatio (float value) |
Sets speedFalloffRatio. More... | |
Q_INVOKABLE QPointF | getGroundNormal () const |
Returns the current "up" direction used to orient movement. More... | |
virtual void | update () override |
Computes and applys torque and linear forces on this actor's Body. More... | |
![]() | |
Logic (QObject *parent=nullptr) | |
Constructs a Logic. More... | |
Actor * | getActor () const |
Returns actor. More... | |
bool | isActive () const |
Returns active. More... | |
void | setActive (bool value) |
Sets active. More... | |
virtual void | init () |
Performs initialization of this Logic. More... | |
![]() | |
QObject (QObject *parent) | |
virtual bool | event (QEvent *e) |
virtual bool | eventFilter (QObject *watched, QEvent *event) |
virtual const QMetaObject * | metaObject () const |
QString | objectName () const |
void | setObjectName (const QString &name) |
bool | isWidgetType () const |
bool | isWindowType () const |
bool | signalsBlocked () const |
bool | blockSignals (bool block) |
QThread * | thread () const |
void | moveToThread (QThread *targetThread) |
int | startTimer (int interval, Qt::TimerType timerType) |
void | killTimer (int id) |
T | findChild (const QString &name, QFlags< Qt::FindChildOption > options) const |
QList< T > | findChildren (const QString &name, QFlags< Qt::FindChildOption > options) const |
QList< T > | findChildren (const QRegExp ®Exp, QFlags< Qt::FindChildOption > options) const |
QList< T > | findChildren (const QRegularExpression &re, QFlags< Qt::FindChildOption > options) const |
const QObjectList & | children () const |
void | setParent (QObject *parent) |
void | installEventFilter (QObject *filterObj) |
void | removeEventFilter (QObject *obj) |
QMetaObject::Connection | connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const |
bool | disconnect (const char *signal, const QObject *receiver, const char *method) const |
bool | disconnect (const QObject *receiver, const char *method) const |
void | dumpObjectTree () |
void | dumpObjectInfo () |
bool | setProperty (const char *name, const QVariant &value) |
QVariant | property (const char *name) const |
QList< QByteArray > | dynamicPropertyNames () const |
void | destroyed (QObject *obj) |
void | objectNameChanged (const QString &objectName) |
QObject * | parent () const |
bool | inherits (const char *className) const |
void | deleteLater () |
Properties | |
QPointF | direction |
Direction the actor should move in. More... | |
QPointF | magnetismInfluence |
Direction to the magnetic object this actor is magnetizing to, or a zero vector if there is currently no such object. More... | |
float | speed |
Speed the actor accelerates at. More... | |
float | proximityRadius |
Distance that the actor will sense other bodies to use as orientation references. More... | |
float | antiGravityAmount |
Amount of force the actor can exert against gravity, as a percentage from 0.0f to 1.0f. More... | |
float | turnBoost |
Extra force multiplier applied when turning. More... | |
float | torqueForceRatio |
Balance of torque to linear force. More... | |
float | speedFalloffRatio |
Amount of falloff at higher speeds. More... | |
![]() | |
Actor | actor |
Parent actor that is affected by this Logic's behavior. More... | |
bool | active |
Whether or not Engine calls update() on this Logic during the Engine::LOGICS_PHASE. More... | |
![]() | |
objectName | |
Additional Inherited Members | |
![]() | |
QString | tr (const char *sourceText, const char *disambiguation, int n) |
QString | trUtf8 (const char *sourceText, const char *disambiguation, int n) |
QMetaObject::Connection | connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type) |
QMetaObject::Connection | connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type) |
QMetaObject::Connection | connect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method, Qt::ConnectionType type) |
QMetaObject::Connection | connect (const QObject *sender, PointerToMemberFunction signal, Functor functor) |
QMetaObject::Connection | connect (const QObject *sender, PointerToMemberFunction signal, const QObject *context, Functor functor, Qt::ConnectionType type) |
bool | disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method) |
bool | disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method) |
bool | disconnect (const QMetaObject::Connection &connection) |
bool | disconnect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method) |
![]() | |
QObject * | sender () const |
int | senderSignalIndex () const |
int | receivers (const char *signal) const |
bool | isSignalConnected (const QMetaMethod &signal) const |
virtual void | timerEvent (QTimerEvent *event) |
virtual void | childEvent (QChildEvent *event) |
virtual void | customEvent (QEvent *event) |
virtual void | connectNotify (const QMetaMethod &signal) |
virtual void | disconnectNotify (const QMetaMethod &signal) |
Logic which exerts force in a specified direction, causing the actor to roll in that direction.
The movement direction is specified using the direction property. X represents forwards and backwards movement, while Y represents upwards and downwards movement. This "direction" is not always aligned to world space, or even gravity. When the actor is considered "in the air", the reference direction for "up" is gravity. When the actor is close to a surface (i.e. the ground), that surface's normal will be used as "up". Forward and backwards movement will be oriented to this direction.
The closest surface is found approximately by casting several rays. If no surface is found, the actor is considered "in the air" (and orients to gravity). The distance that rays will be cast is controlled by the proximityRadius property. Alternatively, when magnetism is in effect and the actor is near a magnetic object, the direction to that object's center will be used as "up".
The force that is exerted is a combination of torque (angular acceleration) and linear acceleration (i.e. jetpack-like). Because the actor can exert a jetpack-like force, to prevent the actor from "climbing" unnaturally against gravity, damping is applied in the direction of gravity. For example, if the actor's current reference surface is a vertical wall, when the actor moves forwards, it will attempt to climb up (or down) the wall. Since this is against gravity, the amount of force that is effectively exerted is reduced (compared to the force that is exerted when on the ground). The amount of reduction is controlled through the antiGravityAmount property.
|
signal |
Emitted when antiGravityAmount changes.
|
signal |
Emitted when direction changes.
|
inline |
Returns antiGravityAmount.
Q_INVOKABLE QPointF RollingMovementLogic::getGroundNormal | ( | ) | const |
Returns the current "up" direction used to orient movement.
This is computed internally using one of the following: Gravity, the closest surface, or the magnetic object being attracted.
QPointF RollingMovementLogic::getMagnetismInfluence | ( | ) | const |
Returns magnetismInfluence.
|
inline |
Returns proximityRadius.
|
inline |
Returns speed.
|
inline |
Returns speedFalloffRatio.
|
inline |
Returns torqueForceRatio.
|
inline |
Returns turnBoost.
|
signal |
Emitted when magnetismInfluence changes.
|
signal |
Emitted when proximityRadius changes.
void RollingMovementLogic::setAntiGravityAmount | ( | float | value | ) |
Sets antiGravityAmount.
value | Float to set antiGravityAmount to |
void RollingMovementLogic::setDirection | ( | const QPointF & | value | ) |
void RollingMovementLogic::setMagnetismInfluence | ( | const QPointF & | value | ) |
Sets magnetismInfluence.
value | QPointF to set magnetismInfluence to |
void RollingMovementLogic::setProximityRadius | ( | float | value | ) |
Sets proximityRadius.
value | Float to set proximityRadius to |
void RollingMovementLogic::setSpeed | ( | float | value | ) |
void RollingMovementLogic::setSpeedFalloffRatio | ( | float | value | ) |
Sets speedFalloffRatio.
value | Float to set speedFalloffRatio to |
void RollingMovementLogic::setTorqueForceRatio | ( | float | value | ) |
Sets torqueForceRatio.
value | Float to set torqueForceRatio to |
void RollingMovementLogic::setTurnBoost | ( | float | value | ) |
|
signal |
Emitted when speed changes.
|
signal |
Emitted when speedFalloffRatio changes.
|
signal |
Emitted when torqueForceRatio changes.
|
signal |
Emitted when turnBoost changes.
|
overridevirtual |
|
readwrite |
|
readwrite |
|
readwrite |
Direction to the magnetic object this actor is magnetizing to, or a zero vector if there is currently no such object.
This property is used to determine whether the normal "up" reference direction should be overridden, and the direction to the magnetic object used instead.
|
readwrite |
Distance that the actor will sense other bodies to use as orientation references.
|
readwrite |
|
readwrite |
Amount of falloff at higher speeds.
A higher falloff causes the actor to reach top speed more quickly, but reduces top speed.
|
readwrite |
Balance of torque to linear force.
|
readwrite |
Extra force multiplier applied when turning.