Drag[en]gine Game Engine
1.21
|
Force Field. More...
#include <deForceField.h>
Public Types | |
enum | eApplicationTypes { eatDirect , eatSurface , eatMass , eatSpeed } |
Force application types. More... | |
enum | eFieldTypes { eftRadial , eftLinear , eftVortex } |
Field types. More... | |
typedef deTObjectReference< deForceField > | Ref |
Type holding strong reference. More... | |
Public Types inherited from deResource | |
typedef deTObjectReference< deResource > | Ref |
Type holding strong reference. More... | |
Public Types inherited from deObject | |
typedef deTObjectReference< deObject > | Ref |
Type holding strong reference. More... | |
Public Member Functions | |
Management | |
const decDVector & | GetPosition () const |
Position. More... | |
void | SetPosition (const decDVector &position) |
Set position. More... | |
const decQuaternion & | GetOrientation () const |
Orientation. More... | |
void | SetOrientation (const decQuaternion &orientation) |
Set orientation. More... | |
const decShapeList & | GetInfluenceArea () const |
Influence area. More... | |
void | SetInfluenceArea (const decShapeList &area) |
Set influence area. More... | |
float | GetRadius () const |
Falloff radius. More... | |
void | SetRadius (float radius) |
Set falloff radius. More... | |
float | GetExponent () const |
Falloff exponent. More... | |
void | SetExponent (float exponent) |
Set falloff exponent. More... | |
eFieldTypes | GetFieldType () const |
Field type. More... | |
void | SetFieldType (eFieldTypes type) |
Set field type. More... | |
eApplicationTypes | GetApplicationType () const |
Force application type. More... | |
void | SetApplicationType (eApplicationTypes type) |
Set application type. More... | |
const decVector & | GetDirection () const |
Force direction. More... | |
void | SetDirection (const decVector &direction) |
Set force direction. More... | |
float | GetForce () const |
Force in newton. More... | |
void | SetForce (float force) |
Set force in newton. More... | |
float | GetFluctuationDirection () const |
Fluctuation of direction in radians. More... | |
void | SetFluctuationDirection (float fluctuation) |
Set fluctuation of direction in radians. More... | |
float | GetFluctuationForce () const |
Fluctuation of force in newton. More... | |
void | SetFluctuationForce (float fluctuation) |
Set fluctuation of force in newton. More... | |
const decShapeList & | GetShape () const |
Sound shape. More... | |
void | SetShape (const decShapeList &shape) |
Set sound shape. More... | |
const decCollisionFilter & | GetCollisionFilter () const |
Collision filter. More... | |
void | SetCollisionFilter (const decCollisionFilter &filter) |
Set collision filter. More... | |
bool | GetEnabled () const |
Force field is enabled. More... | |
void | SetEnabled (bool enabled) |
Set if force field is enabled. More... | |
System Peers | |
deBasePhysicsForceField * | GetPeerPhysics () const |
Physics system peer object. More... | |
void | SetPeerPhysics (deBasePhysicsForceField *peer) |
Set physics system peer object. More... | |
Linked List | |
deWorld * | GetParentWorld () const |
Parent world or NULL. More... | |
void | SetParentWorld (deWorld *world) |
Set parent world or NULL. More... | |
deForceField * | GetLLWorldPrev () const |
Previous force field in the parent world linked list. More... | |
void | SetLLWorldPrev (deForceField *forceField) |
Set next force field in the parent world linked list. More... | |
deForceField * | GetLLWorldNext () const |
Next force field in the parent world linked list. More... | |
void | SetLLWorldNext (deForceField *forceField) |
Set next force field in the parent world linked list. More... | |
Public Member Functions inherited from deResource | |
deResourceManager * | GetResourceManager () const |
Resource manager or NULL if resource is leaking. More... | |
deEngine * | GetEngine () const |
Game engine object from resource manager. More... | |
deResource * | GetLLManagerPrev () const |
Previous resource in the resource manager linked list. More... | |
void | SetLLManagerPrev (deResource *resource) |
Set next resource in the resource manager linked list. More... | |
deResource * | GetLLManagerNext () const |
Next resource in the resource manager linked list. More... | |
void | SetLLManagerNext (deResource *resource) |
Set next resource in the resource manager linked list. More... | |
void | MarkLeaking () |
Marks the resource leaking. More... | |
deResource (deResourceManager *resourceManager) | |
Create resource. More... | |
Public Member Functions inherited from deObject | |
int | GetRefCount () const |
Reference count. More... | |
void | AddReference () |
Add reference increasing reference count by 1. More... | |
void | FreeReference () |
Decrease reference count by one and delete object if count reaches 0. More... | |
deObject () | |
Create object with reference count of 1. More... | |
Constructors and Destructors | |
deForceField (deForceFieldManager *manager) | |
Create force field. More... | |
virtual | ~deForceField () |
Clean up force field. More... | |
Additional Inherited Members | |
Protected Member Functions inherited from deResource | |
virtual | ~deResource () |
Clean up resource. More... | |
Protected Member Functions inherited from deObject | |
virtual | ~deObject () |
Clean up object. More... | |
Force Field.
Applies a force to prop fields, particles cast by particle systems and dynamic colliders.
The field affects elements inside its area of effect defined by a shape list. The force is at the maximum inside the shape. Optionally it diminishes by distance from the border of the shape. An exponent can be defined to alter the falloff from the border. No area shape equals a point force field.
The force is applied either radially from the center, linearily along direction or vertex like swirrling around the direction. Negative force creates a force field attracting elements instead of repelling them. For vortrex type positive force swirls around counter-clock-wise while negative force swirls around clock-wise. The force direction is relative to the force field orientation allowing to alter the force direction without needing to adjust the area of influence shape which is oriented to the force field orientation itself. The force is measured in newton and can be applied directly, by surface or by volume.
Directly applied the force affects all elements exactly the same. This can be used for example for paranomal effects where the shape of elements is unimportant.
Applied by surface the set force is Newton per Meter-Squared. The area used to calculate the force is the surface area exposed to the force direction. This can be used for wind or water forces pushing against exposed surface area. Physics modules are free to approximate this surface area as they see fit.
Applied by volume the set force is Newton per Meter-Cubic. The volume used to calculate the force is the real or representative volume of elements. For elements having a shape the volume is the volume of all space occupied by all shapes combined. For particles the shape is usually a sphere roughly representing the particle. This can be used for field effects like magentism which do not care about exposed surface area only the volume they can affect. Physics modules are free to approximate this volume as they see fit.
The force direction and force can be subject to fluctuation to make the force field more life-like. Physics modules alter the applied force direction and force strength randomly over time.
Force fields can be disabled avoiding the need to remove and add them to the world.
Default settings are radial type, apply direct, no shape, 1N force, 1m radius, exponent 1, no fluctuations and enabled.
Type holding strong reference.
deForceField::deForceField | ( | deForceFieldManager * | manager | ) |
Create force field.
|
protectedvirtual |
Clean up force field.
|
inline |
Force application type.
|
inline |
Collision filter.
|
inline |
Force direction.
|
inline |
Force field is enabled.
|
inline |
Falloff exponent.
|
inline |
Field type.
|
inline |
Fluctuation of direction in radians.
|
inline |
Fluctuation of force in newton.
|
inline |
Force in newton.
|
inline |
Influence area.
|
inline |
Next force field in the parent world linked list.
|
inline |
Previous force field in the parent world linked list.
|
inline |
Orientation.
|
inline |
Parent world or NULL.
|
inline |
Physics system peer object.
|
inline |
Position.
|
inline |
Falloff radius.
|
inline |
Sound shape.
void deForceField::SetApplicationType | ( | eApplicationTypes | type | ) |
Set application type.
void deForceField::SetCollisionFilter | ( | const decCollisionFilter & | filter | ) |
Set collision filter.
void deForceField::SetDirection | ( | const decVector & | direction | ) |
Set force direction.
void deForceField::SetEnabled | ( | bool | enabled | ) |
Set if force field is enabled.
void deForceField::SetExponent | ( | float | exponent | ) |
Set falloff exponent.
void deForceField::SetFieldType | ( | eFieldTypes | type | ) |
Set field type.
void deForceField::SetFluctuationDirection | ( | float | fluctuation | ) |
Set fluctuation of direction in radians.
void deForceField::SetFluctuationForce | ( | float | fluctuation | ) |
Set fluctuation of force in newton.
void deForceField::SetForce | ( | float | force | ) |
Set force in newton.
void deForceField::SetInfluenceArea | ( | const decShapeList & | area | ) |
Set influence area.
void deForceField::SetLLWorldNext | ( | deForceField * | forceField | ) |
Set next force field in the parent world linked list.
void deForceField::SetLLWorldPrev | ( | deForceField * | forceField | ) |
Set next force field in the parent world linked list.
void deForceField::SetOrientation | ( | const decQuaternion & | orientation | ) |
Set orientation.
void deForceField::SetParentWorld | ( | deWorld * | world | ) |
Set parent world or NULL.
void deForceField::SetPeerPhysics | ( | deBasePhysicsForceField * | peer | ) |
Set physics system peer object.
void deForceField::SetPosition | ( | const decDVector & | position | ) |
Set position.
void deForceField::SetRadius | ( | float | radius | ) |
Set falloff radius.
void deForceField::SetShape | ( | const decShapeList & | shape | ) |
Set sound shape.