Drag[en]gine Script Module DragonScript  1.23
Dragengine.Scenery.ECBehaviorClearPath Class Reference

Behavior adding support to actors to make other actors get out of the way. More...

Inheritance diagram for Dragengine.Scenery.ECBehaviorClearPath:
Dragengine.Scenery.DefaultECBehavior Dragengine.Scenery.ECBehavior Dragengine.Scenery.BehaviorCompatiblePersistency

Classes

class  Instance
 Behavior instance. More...
 

Public Member Functions

void dispose ()
 Dispose of behavior. More...
 
ECPFloat getCheckInterval ()
 Check interval in seconds. More...
 
ECPFloat getClearPathTime ()
 Clear path time in seconds indicating how far ahead the actors clear path. More...
 
ECComposeCollisionFilter getCollisionFilter ()
 Collision filter. More...
 
ECPBoolean getEnabled ()
 Behavior is initially enabled. More...
 
ECBehaviorLocomotion getLocomotion ()
 Locomotion behavior. More...
 
Instance instance (BehaviorElement element)
 Get instance in element from owner element class. More...
 
ECBehaviorClearPath new (BehaviorElementClass eclass, ECBehaviorLocomotion locomotion)
 Create behavior element class. More...
 
ECBehaviorClearPath new (BehaviorElementClass eclass, ECBehaviorLocomotion locomotion, String prefix)
 
- Public Member Functions inherited from Dragengine.Scenery.DefaultECBehavior
void assignInstanceIndex (int instanceIndex)
 Assign instance index. More...
 
String getBehaviorID ()
 Unique identifier of behavior. More...
 
String getID ()
 Identifier. More...
 
int getInstanceIndex ()
 Instance index. More...
 
void loadSupportedData (String identifier, PersistencyEnvironment env, FileReader reader, ECBehaviorInstance instance)
 Load instance data of another behavior. More...
 
bool supportsBehaviorID (String identifier)
 Behavior supports loading instance data of another behavior. More...
 
- Public Member Functions inherited from Dragengine.Scenery.ECBehavior
ECBehaviorInstance createInstance (BehaviorElement element)
 Create Behavior instance. More...
 

Static Public Member Functions

static ECBehaviorClearPath getBehaviorIn (BehaviorElementClass eclass)
 Get behavior in element class or null if absent. More...
 

Public Attributes

ECPFloat pCheckInterval
 
ECPFloat pClearPathTime
 
ECComposeCollisionFilter pCollisionFilter
 
ECPBoolean pEnabled
 
ECBehaviorLocomotion pLocomotion
 

Additional Inherited Members

- Protected Member Functions inherited from Dragengine.Scenery.DefaultECBehavior
DefaultECBehavior new (BehaviorElementClass eclass)
 Create default composeable behavior with empty identifier. More...
 
DefaultECBehavior new (BehaviorElementClass eclass, String id)
 Create default composeable behavior. More...
 
void setBehaviorID (String identifier)
 Set behavior identifier. More...
 
void useClassNameAsBehaviorID ()
 Set behavior identifier to "<class-name>:<identifier>". More...
 
void useFullyQualifiedClassNameAsBehaviorID ()
 Set behavior identifier to "<fully-qualified-class-name>:<identifier>". More...
 

Detailed Description

Behavior adding support to actors to make other actors get out of the way.

This behavior is useful for situations where actors can get in the way of the player or other actors. The behavior uses a collider collision test along the movement direction to periodically check for obstacles. If an obstacle is detected and it has ECBehaviorStepAside support it is told to step aside if possible.

This behavior can be used together with ECBehaviorAvoidCollision but the two can potentially affect each other depending on the configuration used for this behavior. Should this happen either adjust the configuration or make sure only one behavior is enabled at each time.

This behavior can be disabled temporarily.

To use this behavior add it to the element class and make sure to call setShapeSphere() to set up the collision test shapes. The best time to do this is either in BehaviorElement.init() or inside BaseActorAction if you need to change them per action.

Configurations

There are usually two possible configurations used for this behavior.

The first configuration applies to short distances only. In this configuration the check interval is around 1s or lower and the clear path time is around 0.05s. This results in the actor clearing the path up ahead of only 0.06m (assuming a walk speed of 1.25 m/s). This configuration results in the actor clearing path only if he is nearly bumping into other actors. The advantage of this configuration is that actors do not move away other actors when approaching them but still moves them away if blocking the path. This configuration works best if you just want to ensure actors can not block the path of other actors without needing them to have a clear path a long distance ahead.

The second configuration applies to long distance clearing of path. In this configuration the check interval is around 1s and the clear path time is around 2s. This results in the actor clearing the path up ahead to 2.5m (assuming a walk speed of 1.25 m/s). In this configuration the actor usually does not get in contact with actors standing in his way. The downside is though actors trying to approach other actors. In this case they are easily made stepping aside which is not always what you want.

For most situations the first configuration is the one to choose since it prevents the actor-actor stuck problems while exhibiting the least side effects. The second configuration though can be insteresting to switch to if actors need a clear path for example while running away. For this reason the first configuration is used as default.

Requires these behaviors to be present:

Member Function Documentation

◆ dispose()

void Dragengine.Scenery.ECBehaviorClearPath.dispose ( )

Dispose of behavior.

Reimplemented from Dragengine.Scenery.DefaultECBehavior.

◆ getBehaviorIn()

static ECBehaviorClearPath Dragengine.Scenery.ECBehaviorClearPath.getBehaviorIn ( BehaviorElementClass  eclass)
static

Get behavior in element class or null if absent.

Use this method to check if a particular BehaviorElementClass contains a behavior of type ECBehaviorClearPath.

◆ getCheckInterval()

ECPFloat Dragengine.Scenery.ECBehaviorClearPath.getCheckInterval ( )

Check interval in seconds.

◆ getClearPathTime()

ECPFloat Dragengine.Scenery.ECBehaviorClearPath.getClearPathTime ( )

Clear path time in seconds indicating how far ahead the actors clear path.

◆ getCollisionFilter()

ECComposeCollisionFilter Dragengine.Scenery.ECBehaviorClearPath.getCollisionFilter ( )

Collision filter.

◆ getEnabled()

ECPBoolean Dragengine.Scenery.ECBehaviorClearPath.getEnabled ( )

Behavior is initially enabled.

◆ getLocomotion()

ECBehaviorLocomotion Dragengine.Scenery.ECBehaviorClearPath.getLocomotion ( )

Locomotion behavior.

◆ instance()

Instance Dragengine.Scenery.ECBehaviorClearPath.instance ( BehaviorElement  element)

Get instance in element from owner element class.

◆ new() [1/2]

ECBehaviorClearPath Dragengine.Scenery.ECBehaviorClearPath.new ( BehaviorElementClass  eclass,
ECBehaviorLocomotion  locomotion 
)

Create behavior element class.

◆ new() [2/2]

ECBehaviorClearPath Dragengine.Scenery.ECBehaviorClearPath.new ( BehaviorElementClass  eclass,
ECBehaviorLocomotion  locomotion,
String  prefix 
)

Member Data Documentation

◆ pCheckInterval

ECPFloat Dragengine.Scenery.ECBehaviorClearPath.pCheckInterval

◆ pClearPathTime

ECPFloat Dragengine.Scenery.ECBehaviorClearPath.pClearPathTime

◆ pCollisionFilter

ECComposeCollisionFilter Dragengine.Scenery.ECBehaviorClearPath.pCollisionFilter

◆ pEnabled

ECPBoolean Dragengine.Scenery.ECBehaviorClearPath.pEnabled

◆ pLocomotion

ECBehaviorLocomotion Dragengine.Scenery.ECBehaviorClearPath.pLocomotion

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