Drag[en]gine Game Engine  1.21
deForceField Class Reference

Force Field. More...

#include <deForceField.h>

Inheritance diagram for deForceField:
deResource deObject

Public Types

enum  eApplicationTypes { eatDirect , eatSurface , eatMass , eatSpeed }
 Force application types. More...
 
enum  eFieldTypes { eftRadial , eftLinear , eftVortex }
 Field types. More...
 
typedef deTObjectReference< deForceFieldRef
 Type holding strong reference. More...
 
- Public Types inherited from deResource
typedef deTObjectReference< deResourceRef
 Type holding strong reference. More...
 
- Public Types inherited from deObject
typedef deTObjectReference< deObjectRef
 Type holding strong reference. More...
 

Public Member Functions

Management
const decDVectorGetPosition () const
 Position. More...
 
void SetPosition (const decDVector &position)
 Set position. More...
 
const decQuaternionGetOrientation () const
 Orientation. More...
 
void SetOrientation (const decQuaternion &orientation)
 Set orientation. More...
 
const decShapeListGetInfluenceArea () 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 decVectorGetDirection () 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 decShapeListGetShape () const
 Sound shape. More...
 
void SetShape (const decShapeList &shape)
 Set sound shape. More...
 
const decCollisionFilterGetCollisionFilter () 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
deBasePhysicsForceFieldGetPeerPhysics () const
 Physics system peer object. More...
 
void SetPeerPhysics (deBasePhysicsForceField *peer)
 Set physics system peer object. More...
 
Linked List
deWorldGetParentWorld () const
 Parent world or NULL. More...
 
void SetParentWorld (deWorld *world)
 Set parent world or NULL. More...
 
deForceFieldGetLLWorldPrev () 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...
 
deForceFieldGetLLWorldNext () 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
deResourceManagerGetResourceManager () const
 Resource manager or NULL if resource is leaking. More...
 
deEngineGetEngine () const
 Game engine object from resource manager. More...
 
deResourceGetLLManagerPrev () const
 Previous resource in the resource manager linked list. More...
 
void SetLLManagerPrev (deResource *resource)
 Set next resource in the resource manager linked list. More...
 
deResourceGetLLManagerNext () 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...
 

Detailed Description

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.

Todo:
using a 3d image as custom force field? like red=x-axis, green=y-axis and blue=z-axis?
Todo:
Force fields can be set to be blocked by non-dynamic colliders? Force fields have no effect on objects along the force direction if a non-dynamic colliders is crossed? (bool pBlocked?)

Member Typedef Documentation

◆ Ref

Type holding strong reference.

Member Enumeration Documentation

◆ eApplicationTypes

Force application types.

Enumerator
eatDirect 

Apply force equally to all elements independend of shape.

eatSurface 

Apply force on exposed surface area.

eatMass 

Apply force on mass.

eatSpeed 

Apply force relative to speed of element.

◆ eFieldTypes

Field types.

Enumerator
eftRadial 

Force is applied radial from the center.

eftLinear 

Force is applied along the force direction.

eftVortex 

Force is applied vortex like swirling around.

Constructor & Destructor Documentation

◆ deForceField()

deForceField::deForceField ( deForceFieldManager manager)

Create force field.

◆ ~deForceField()

virtual deForceField::~deForceField ( )
protectedvirtual

Clean up force field.

Note
Subclasses should set their destructor protected too to avoid users accidently deleting a reference counted object through the object pointer. Only FreeReference() is allowed to delete the object.

Member Function Documentation

◆ GetApplicationType()

eApplicationTypes deForceField::GetApplicationType ( ) const
inline

Force application type.

◆ GetCollisionFilter()

const decCollisionFilter& deForceField::GetCollisionFilter ( ) const
inline

Collision filter.

◆ GetDirection()

const decVector& deForceField::GetDirection ( ) const
inline

Force direction.

◆ GetEnabled()

bool deForceField::GetEnabled ( ) const
inline

Force field is enabled.

◆ GetExponent()

float deForceField::GetExponent ( ) const
inline

Falloff exponent.

◆ GetFieldType()

eFieldTypes deForceField::GetFieldType ( ) const
inline

Field type.

◆ GetFluctuationDirection()

float deForceField::GetFluctuationDirection ( ) const
inline

Fluctuation of direction in radians.

◆ GetFluctuationForce()

float deForceField::GetFluctuationForce ( ) const
inline

Fluctuation of force in newton.

◆ GetForce()

float deForceField::GetForce ( ) const
inline

Force in newton.

◆ GetInfluenceArea()

const decShapeList& deForceField::GetInfluenceArea ( ) const
inline

Influence area.

◆ GetLLWorldNext()

deForceField* deForceField::GetLLWorldNext ( ) const
inline

Next force field in the parent world linked list.

◆ GetLLWorldPrev()

deForceField* deForceField::GetLLWorldPrev ( ) const
inline

Previous force field in the parent world linked list.

◆ GetOrientation()

const decQuaternion& deForceField::GetOrientation ( ) const
inline

Orientation.

◆ GetParentWorld()

deWorld* deForceField::GetParentWorld ( ) const
inline

Parent world or NULL.

◆ GetPeerPhysics()

deBasePhysicsForceField* deForceField::GetPeerPhysics ( ) const
inline

Physics system peer object.

◆ GetPosition()

const decDVector& deForceField::GetPosition ( ) const
inline

Position.

◆ GetRadius()

float deForceField::GetRadius ( ) const
inline

Falloff radius.

◆ GetShape()

const decShapeList& deForceField::GetShape ( ) const
inline

Sound shape.

◆ SetApplicationType()

void deForceField::SetApplicationType ( eApplicationTypes  type)

Set application type.

◆ SetCollisionFilter()

void deForceField::SetCollisionFilter ( const decCollisionFilter filter)

Set collision filter.

◆ SetDirection()

void deForceField::SetDirection ( const decVector direction)

Set force direction.

◆ SetEnabled()

void deForceField::SetEnabled ( bool  enabled)

Set if force field is enabled.

◆ SetExponent()

void deForceField::SetExponent ( float  exponent)

Set falloff exponent.

◆ SetFieldType()

void deForceField::SetFieldType ( eFieldTypes  type)

Set field type.

◆ SetFluctuationDirection()

void deForceField::SetFluctuationDirection ( float  fluctuation)

Set fluctuation of direction in radians.

◆ SetFluctuationForce()

void deForceField::SetFluctuationForce ( float  fluctuation)

Set fluctuation of force in newton.

◆ SetForce()

void deForceField::SetForce ( float  force)

Set force in newton.

◆ SetInfluenceArea()

void deForceField::SetInfluenceArea ( const decShapeList area)

Set influence area.

◆ SetLLWorldNext()

void deForceField::SetLLWorldNext ( deForceField forceField)

Set next force field in the parent world linked list.

◆ SetLLWorldPrev()

void deForceField::SetLLWorldPrev ( deForceField forceField)

Set next force field in the parent world linked list.

◆ SetOrientation()

void deForceField::SetOrientation ( const decQuaternion orientation)

Set orientation.

◆ SetParentWorld()

void deForceField::SetParentWorld ( deWorld world)

Set parent world or NULL.

◆ SetPeerPhysics()

void deForceField::SetPeerPhysics ( deBasePhysicsForceField peer)

Set physics system peer object.

◆ SetPosition()

void deForceField::SetPosition ( const decDVector position)

Set position.

◆ SetRadius()

void deForceField::SetRadius ( float  radius)

Set falloff radius.

◆ SetShape()

void deForceField::SetShape ( const decShapeList shape)

Set sound shape.


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