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

Behavior instance. More...

Inheritance diagram for Dragengine.Scenery.ECBehaviorAvoidCollision.Instance:
Dragengine.Scenery.DefaultECBehaviorInstance Dragengine.Scenery.ECBehaviorInstance

Classes

class  BTActionSet
 Behavior tree action "avoidCollision.set". More...
 

Public Member Functions

void addIgnoreCollider (Collider collider)
 Add collider to ignore to colliders required for avoiding. More...
 
void addIgnoreCollidersTo (Collider collider)
 Add colliders required for avoiding as colliders to ignore. More...
 
void armTest (Vector direction)
 Arm collision test with direction. More...
 
void avoidBehaviorElement (BehaviorElement element)
 Avoid behavior element. More...
 
void avoidCollision (float elapsed)
 Avoid collision if required. More...
 
Collider bestColliderFor (ECBehaviorAvoidedByActor.Instance behavior)
 Find best collider for avoided by actor behavior. More...
 
void clearAvoiding ()
 Clear avoiding. More...
 
void disarmTest ()
 Disarm collision test. More...
 
void dispose ()
 Dispose of behavior instance. More...
 
void enterFrame ()
 Frame update started. More...
 
ECBehaviorActorMover.Instance getActorMover ()
 Actor mover behavior. More...
 
ElementVisitor getAvoidElement ()
 Avoid element visitor. More...
 
float getAvoidTimeContactCollision ()
 Avoid time contact collision. More...
 
ColliderCollisionTest getCCTAvoidCollision ()
 Avoid collider collision test. More...
 
ColliderCollisionTest getCCTCheckLeft ()
 Check left collider collision test. More...
 
ColliderCollisionTest getCCTCheckRight ()
 Check right collider collision test. More...
 
float getCheckInterval ()
 Check interval in seconds. More...
 
float getCheckOffset ()
 Check offset. More...
 
float getCheckTimer ()
 Check timer. More...
 
float getDeviationAngle ()
 Deviation angle. More...
 
float getDeviationTime ()
 Deviation time. More...
 
ECBehaviorAvoidCollision getECBehavior ()
 Behavior. More...
 
ElementResolver getElementResolver ()
 Element resolver used during loading or null if not set. More...
 
bool getEnabled ()
 Collision avoiding is enabled. More...
 
float getRadius ()
 Avoid radius. More...
 
ECBehaviorRidable.Instance getRidable ()
 Rideable the actor is standing upon or null. More...
 
ECBehaviorRideOn.Instance getRideOn ()
 Ride on behavior. More...
 
float getSpeedMultiplier ()
 Speed multiplier. More...
 
bool getWaitBehindObstacles ()
 Wait behind obstacles instead of moving around them. More...
 
void init (StubElement stub)
 Initialize from stub. More...
 
bool isTestArmed ()
 Collision test is armed. More...
 
void moveAroundAvoidedByActor (ECBehaviorAvoidedByActor.Instance behavior)
 Move around avoided by actor. More...
 
void mutualIgnoreColliders (Collider collider)
 Mutually ignore colliders. More...
 
Instance new (ECBehaviorAvoidCollision ecbehavior, BehaviorElement element)
 Create behavior instance. More...
 
void onModifyMoveTowards (DVector position, float elapsed)
 Apply avoiding to actor mover. More...
 
void onRidableChanged ()
 Ridable changed. More...
 
void readFromFile (PersistencyEnvironment env, FileReader reader)
 Read behavior from file. More...
 
void removeFromGameWorld ()
 Remove element from game world. More...
 
void setAvoidElement (ElementVisitor visitor)
 Set avoid element visitor. More...
 
void setAvoidTimeContactCollision (float time)
 Set avoid time contact collision. More...
 
void setCheckInterval (float interval)
 Set check interval in seconds. More...
 
void setCheckOffset (float offset)
 Set check offset. More...
 
void setCheckTimer (float timer)
 Set check timer. More...
 
void setDeviationAngle (float angle)
 Set deviation angle. More...
 
void setDeviationTime (float time)
 Set deviation time. More...
 
void setEnabled (bool enabled)
 Set if collision avoiding is enabled. More...
 
void setRadius (float radius)
 Set avoid radius. More...
 
void setShapesSphere (float radius, float distanceAboveGround)
 Set sphere collision test collider shapes. More...
 
void setSpeedMultiplier (float multiplier)
 Set speed multiplier. More...
 
void setWaitBehindObstacles (bool moveAroundActors)
 Set wait behind obstacles instead of moving around them. More...
 
void startTests (float elapsed)
 Start collision tests for the next interval if applicable. More...
 
void think (float elapsed)
 Think about what to do for the next frame update. More...
 
void update (float elapsed)
 Avoid collision if enabled and a collision has been found. More...
 
void waitBehindAvoidedByActor (ECBehaviorAvoidedByActor.Instance behavior)
 Wait behind element. More...
 
void waitBehindContactCollision ()
 Wait behind object contact collision. More...
 
- Public Member Functions inherited from Dragengine.Scenery.DefaultECBehaviorInstance
void addToGameWorld ()
 Add element to game world. More...
 
void attachToParent (Element parent)
 Attach element to object set by the mapper in the IGDE World Editor. More...
 
void geometryChanged ()
 Position or orientation changed. More...
 
BehaviorElement getElement ()
 Behavior element to apply behavior to. More...
 
int getInstanceIndex ()
 Behavior instance index. More...
 
DefaultECBehaviorInstance new (BehaviorElement element)
 Create default composeable instance. More...
 
void postThink (float elapsed)
 Post thinking after physics processing is finished. More...
 
bool requiresEnterFrame ()
 Behavior instance requires enterFrame() to be called. More...
 
bool requiresThink ()
 Behavior instance requires think() to be called. More...
 
void stateChanged ()
 State changed (visble, touchable). More...
 
void writeToFile (PersistencyEnvironment env, FileWriter writer)
 Write behavior instance to file. More...
 

Public Attributes

ECBehaviorActorMover.Instance pActorMover
 
ElementVisitor pAvoidElement
 
float pAvoidTimeContactCollision
 
ColliderCollisionTest pCCTAvoidCollision
 
ColliderCollisionTest pCCTCheckLeft
 
ColliderCollisionTest pCCTCheckRight
 
float pCheckInterval
 
float pCheckOffset
 
float pCheckTimer
 
float pDeviationAngle
 
float pDeviationTime
 
ECBehaviorAvoidCollision pECBehavior
 
ElementResolver pElementResolver
 
bool pEnabled
 
float pRadius
 
ECBehaviorRidable.Instance pRidable
 
ECBehaviorRideOn.Instance pRideOn
 
float pSpeedMultiplier
 
bool pWaitBehindObstacles
 

Protected Member Functions

void avoidElement (Element element)
 Avoid collision with an element if deemded necessary. More...
 
void contactCollision ()
 Get out of contact collision. More...
 
Pair getPointsBorder (Array points, DVector origin)
 Get point with smallest and largest angle relative to origin Y-axis. More...
 
Array getShapeCorners (ECBehaviorAvoidedByActor.Instance behavior, DMatrix matrix)
 Calculate shape corner points transformed to world space 2D coordinates. More...
 
void initBehaviorTree (StubElement stub, ECBehaviorBehaviorTree.Instance behavior)
 Init behavior tree. More...
 
int navSpaceEvadeSide (DVector position, float orientation, float leftAngle, float leftDistance, float rightAngle, float rightDistance)
 Determine side to evade using navigation space. More...
 
- Protected Member Functions inherited from Dragengine.Scenery.DefaultECBehaviorInstance
void setRequiresEnterFrame (bool required)
 Set if behavior instance requires enterFrame() to be called. More...
 
void setRequiresThink (bool required)
 Set if behavior instance requires think() to be called. More...
 

Detailed Description

Behavior instance.

Member Function Documentation

◆ addIgnoreCollider()

void Dragengine.Scenery.ECBehaviorAvoidCollision.Instance.addIgnoreCollider ( Collider  collider)

Add collider to ignore to colliders required for avoiding.

Version
1.17

◆ addIgnoreCollidersTo()

void Dragengine.Scenery.ECBehaviorAvoidCollision.Instance.addIgnoreCollidersTo ( Collider  collider)

Add colliders required for avoiding as colliders to ignore.

◆ armTest()

void Dragengine.Scenery.ECBehaviorAvoidCollision.Instance.armTest ( Vector  direction)

Arm collision test with direction.

◆ avoidBehaviorElement()

void Dragengine.Scenery.ECBehaviorAvoidCollision.Instance.avoidBehaviorElement ( BehaviorElement  element)

Avoid behavior element.

Called by AvoidElement visitor. Default implementation calls avoidAvoidedByActor for all ECBehaviorAvoidedByActor instances present in the element.

◆ avoidCollision()

void Dragengine.Scenery.ECBehaviorAvoidCollision.Instance.avoidCollision ( float  elapsed)

Avoid collision if required.

◆ avoidElement()

void Dragengine.Scenery.ECBehaviorAvoidCollision.Instance.avoidElement ( Element  element)
protected

Avoid collision with an element if deemded necessary.

Default implementation does nothing if element is null. Otherwise uses avoid-element visitor on element to apply element specific avoiding.

◆ bestColliderFor()

Collider Dragengine.Scenery.ECBehaviorAvoidCollision.Instance.bestColliderFor ( ECBehaviorAvoidedByActor.Instance  behavior)

Find best collider for avoided by actor behavior.

Uses ECBehaviorColliderAI if present otherwise ECBehaviorCollider.

◆ clearAvoiding()

void Dragengine.Scenery.ECBehaviorAvoidCollision.Instance.clearAvoiding ( )

Clear avoiding.

◆ contactCollision()

void Dragengine.Scenery.ECBehaviorAvoidCollision.Instance.contactCollision ( )
protected

Get out of contact collision.

◆ disarmTest()

void Dragengine.Scenery.ECBehaviorAvoidCollision.Instance.disarmTest ( )

Disarm collision test.

◆ dispose()

void Dragengine.Scenery.ECBehaviorAvoidCollision.Instance.dispose ( )

Dispose of behavior instance.

Reimplemented from Dragengine.Scenery.DefaultECBehaviorInstance.

◆ enterFrame()

void Dragengine.Scenery.ECBehaviorAvoidCollision.Instance.enterFrame ( )

Frame update started.

Reimplemented from Dragengine.Scenery.DefaultECBehaviorInstance.

◆ getActorMover()

ECBehaviorActorMover.Instance Dragengine.Scenery.ECBehaviorAvoidCollision.Instance.getActorMover ( )

Actor mover behavior.

◆ getAvoidElement()

ElementVisitor Dragengine.Scenery.ECBehaviorAvoidCollision.Instance.getAvoidElement ( )

Avoid element visitor.

◆ getAvoidTimeContactCollision()

float Dragengine.Scenery.ECBehaviorAvoidCollision.Instance.getAvoidTimeContactCollision ( )

Avoid time contact collision.

◆ getCCTAvoidCollision()

ColliderCollisionTest Dragengine.Scenery.ECBehaviorAvoidCollision.Instance.getCCTAvoidCollision ( )

Avoid collider collision test.

◆ getCCTCheckLeft()

ColliderCollisionTest Dragengine.Scenery.ECBehaviorAvoidCollision.Instance.getCCTCheckLeft ( )

Check left collider collision test.

◆ getCCTCheckRight()

ColliderCollisionTest Dragengine.Scenery.ECBehaviorAvoidCollision.Instance.getCCTCheckRight ( )

Check right collider collision test.

◆ getCheckInterval()

float Dragengine.Scenery.ECBehaviorAvoidCollision.Instance.getCheckInterval ( )

Check interval in seconds.

◆ getCheckOffset()

float Dragengine.Scenery.ECBehaviorAvoidCollision.Instance.getCheckOffset ( )

Check offset.

◆ getCheckTimer()

float Dragengine.Scenery.ECBehaviorAvoidCollision.Instance.getCheckTimer ( )

Check timer.

◆ getDeviationAngle()

float Dragengine.Scenery.ECBehaviorAvoidCollision.Instance.getDeviationAngle ( )

Deviation angle.

◆ getDeviationTime()

float Dragengine.Scenery.ECBehaviorAvoidCollision.Instance.getDeviationTime ( )

Deviation time.

◆ getECBehavior()

ECBehaviorAvoidCollision Dragengine.Scenery.ECBehaviorAvoidCollision.Instance.getECBehavior ( )

Behavior.

◆ getElementResolver()

ElementResolver Dragengine.Scenery.ECBehaviorAvoidCollision.Instance.getElementResolver ( )

Element resolver used during loading or null if not set.

◆ getEnabled()

bool Dragengine.Scenery.ECBehaviorAvoidCollision.Instance.getEnabled ( )

Collision avoiding is enabled.

◆ getPointsBorder()

Pair Dragengine.Scenery.ECBehaviorAvoidCollision.Instance.getPointsBorder ( Array  points,
DVector  origin 
)
protected

Get point with smallest and largest angle relative to origin Y-axis.

Returns
Pair with smallest point as first and largest point as second.

◆ getRadius()

float Dragengine.Scenery.ECBehaviorAvoidCollision.Instance.getRadius ( )

Avoid radius.

◆ getRidable()

ECBehaviorRidable.Instance Dragengine.Scenery.ECBehaviorAvoidCollision.Instance.getRidable ( )

Rideable the actor is standing upon or null.

◆ getRideOn()

ECBehaviorRideOn.Instance Dragengine.Scenery.ECBehaviorAvoidCollision.Instance.getRideOn ( )

Ride on behavior.

◆ getShapeCorners()

Array Dragengine.Scenery.ECBehaviorAvoidCollision.Instance.getShapeCorners ( ECBehaviorAvoidedByActor.Instance  behavior,
DMatrix  matrix 
)
protected

Calculate shape corner points transformed to world space 2D coordinates.

If shape has no size 1 point is returned. If shape has size 4 points are returned.

◆ getSpeedMultiplier()

float Dragengine.Scenery.ECBehaviorAvoidCollision.Instance.getSpeedMultiplier ( )

Speed multiplier.

◆ getWaitBehindObstacles()

bool Dragengine.Scenery.ECBehaviorAvoidCollision.Instance.getWaitBehindObstacles ( )

Wait behind obstacles instead of moving around them.

◆ init()

void Dragengine.Scenery.ECBehaviorAvoidCollision.Instance.init ( StubElement  stub)

Initialize from stub.

Reimplemented from Dragengine.Scenery.DefaultECBehaviorInstance.

◆ initBehaviorTree()

void Dragengine.Scenery.ECBehaviorAvoidCollision.Instance.initBehaviorTree ( StubElement  stub,
ECBehaviorBehaviorTree.Instance  behavior 
)
protected

Init behavior tree.

Version
1.19

◆ isTestArmed()

bool Dragengine.Scenery.ECBehaviorAvoidCollision.Instance.isTestArmed ( )

Collision test is armed.

◆ moveAroundAvoidedByActor()

void Dragengine.Scenery.ECBehaviorAvoidCollision.Instance.moveAroundAvoidedByActor ( ECBehaviorAvoidedByActor.Instance  behavior)

Move around avoided by actor.

◆ mutualIgnoreColliders()

void Dragengine.Scenery.ECBehaviorAvoidCollision.Instance.mutualIgnoreColliders ( Collider  collider)

Mutually ignore colliders.

Version
1.17

Same as calling addIgnoreCollidersTo() and addIgnoreCollider() for the same collider. Use this call to make sure the given collider is ignored by all colliders required or avoiding and vice versa. The ECBehaviorColliderAI reachable from ECBehaviorActorMover is automatically made mutually ignore.

◆ navSpaceEvadeSide()

int Dragengine.Scenery.ECBehaviorAvoidCollision.Instance.navSpaceEvadeSide ( DVector  position,
float  orientation,
float  leftAngle,
float  leftDistance,
float  rightAngle,
float  rightDistance 
)
protected

Determine side to evade using navigation space.

Evaluates the left and right side using deviation angle and deviation distance. If both sides are possible compares the costs. The angles are positive in the respective direction.

Return values
-1No side is possible to evade to.
0Evade to both sides is equally recommended.
1Evade to the left side is recommended.
2Evade to the right side is recommended.

◆ new()

Instance Dragengine.Scenery.ECBehaviorAvoidCollision.Instance.new ( ECBehaviorAvoidCollision  ecbehavior,
BehaviorElement  element 
)

Create behavior instance.

◆ onModifyMoveTowards()

void Dragengine.Scenery.ECBehaviorAvoidCollision.Instance.onModifyMoveTowards ( DVector  position,
float  elapsed 
)

Apply avoiding to actor mover.

◆ onRidableChanged()

void Dragengine.Scenery.ECBehaviorAvoidCollision.Instance.onRidableChanged ( )

Ridable changed.

Called by RidableChanged. If overwritten do not forget to super-call.

◆ readFromFile()

void Dragengine.Scenery.ECBehaviorAvoidCollision.Instance.readFromFile ( PersistencyEnvironment  env,
FileReader  reader 
)

Read behavior from file.

Reimplemented from Dragengine.Scenery.DefaultECBehaviorInstance.

◆ removeFromGameWorld()

void Dragengine.Scenery.ECBehaviorAvoidCollision.Instance.removeFromGameWorld ( )

Remove element from game world.

Reimplemented from Dragengine.Scenery.DefaultECBehaviorInstance.

◆ setAvoidElement()

void Dragengine.Scenery.ECBehaviorAvoidCollision.Instance.setAvoidElement ( ElementVisitor  visitor)

Set avoid element visitor.

◆ setAvoidTimeContactCollision()

void Dragengine.Scenery.ECBehaviorAvoidCollision.Instance.setAvoidTimeContactCollision ( float  time)

Set avoid time contact collision.

◆ setCheckInterval()

void Dragengine.Scenery.ECBehaviorAvoidCollision.Instance.setCheckInterval ( float  interval)

Set check interval in seconds.

◆ setCheckOffset()

void Dragengine.Scenery.ECBehaviorAvoidCollision.Instance.setCheckOffset ( float  offset)

Set check offset.

◆ setCheckTimer()

void Dragengine.Scenery.ECBehaviorAvoidCollision.Instance.setCheckTimer ( float  timer)

Set check timer.

◆ setDeviationAngle()

void Dragengine.Scenery.ECBehaviorAvoidCollision.Instance.setDeviationAngle ( float  angle)

Set deviation angle.

◆ setDeviationTime()

void Dragengine.Scenery.ECBehaviorAvoidCollision.Instance.setDeviationTime ( float  time)

Set deviation time.

◆ setEnabled()

void Dragengine.Scenery.ECBehaviorAvoidCollision.Instance.setEnabled ( bool  enabled)

Set if collision avoiding is enabled.

◆ setRadius()

void Dragengine.Scenery.ECBehaviorAvoidCollision.Instance.setRadius ( float  radius)

Set avoid radius.

◆ setShapesSphere()

void Dragengine.Scenery.ECBehaviorAvoidCollision.Instance.setShapesSphere ( float  radius,
float  distanceAboveGround 
)

Set sphere collision test collider shapes.

Uses sphere shape located a distance above ground.

◆ setSpeedMultiplier()

void Dragengine.Scenery.ECBehaviorAvoidCollision.Instance.setSpeedMultiplier ( float  multiplier)

Set speed multiplier.

◆ setWaitBehindObstacles()

void Dragengine.Scenery.ECBehaviorAvoidCollision.Instance.setWaitBehindObstacles ( bool  moveAroundActors)

Set wait behind obstacles instead of moving around them.

◆ startTests()

void Dragengine.Scenery.ECBehaviorAvoidCollision.Instance.startTests ( float  elapsed)

Start collision tests for the next interval if applicable.

◆ think()

void Dragengine.Scenery.ECBehaviorAvoidCollision.Instance.think ( float  elapsed)

Think about what to do for the next frame update.

Reimplemented from Dragengine.Scenery.DefaultECBehaviorInstance.

◆ update()

void Dragengine.Scenery.ECBehaviorAvoidCollision.Instance.update ( float  elapsed)

Avoid collision if enabled and a collision has been found.

Called by think().

◆ waitBehindAvoidedByActor()

void Dragengine.Scenery.ECBehaviorAvoidCollision.Instance.waitBehindAvoidedByActor ( ECBehaviorAvoidedByActor.Instance  behavior)

Wait behind element.

Warning
For use by avoid element visitor only.

◆ waitBehindContactCollision()

void Dragengine.Scenery.ECBehaviorAvoidCollision.Instance.waitBehindContactCollision ( )

Wait behind object contact collision.

Warning
For use by avoid element visitor only.

Member Data Documentation

◆ pActorMover

ECBehaviorActorMover.Instance Dragengine.Scenery.ECBehaviorAvoidCollision.Instance.pActorMover

◆ pAvoidElement

ElementVisitor Dragengine.Scenery.ECBehaviorAvoidCollision.Instance.pAvoidElement

◆ pAvoidTimeContactCollision

float Dragengine.Scenery.ECBehaviorAvoidCollision.Instance.pAvoidTimeContactCollision

◆ pCCTAvoidCollision

ColliderCollisionTest Dragengine.Scenery.ECBehaviorAvoidCollision.Instance.pCCTAvoidCollision

◆ pCCTCheckLeft

ColliderCollisionTest Dragengine.Scenery.ECBehaviorAvoidCollision.Instance.pCCTCheckLeft

◆ pCCTCheckRight

ColliderCollisionTest Dragengine.Scenery.ECBehaviorAvoidCollision.Instance.pCCTCheckRight

◆ pCheckInterval

float Dragengine.Scenery.ECBehaviorAvoidCollision.Instance.pCheckInterval

◆ pCheckOffset

float Dragengine.Scenery.ECBehaviorAvoidCollision.Instance.pCheckOffset

◆ pCheckTimer

float Dragengine.Scenery.ECBehaviorAvoidCollision.Instance.pCheckTimer

◆ pDeviationAngle

float Dragengine.Scenery.ECBehaviorAvoidCollision.Instance.pDeviationAngle

◆ pDeviationTime

float Dragengine.Scenery.ECBehaviorAvoidCollision.Instance.pDeviationTime

◆ pECBehavior

ECBehaviorAvoidCollision Dragengine.Scenery.ECBehaviorAvoidCollision.Instance.pECBehavior

◆ pElementResolver

ElementResolver Dragengine.Scenery.ECBehaviorAvoidCollision.Instance.pElementResolver

◆ pEnabled

bool Dragengine.Scenery.ECBehaviorAvoidCollision.Instance.pEnabled

◆ pRadius

float Dragengine.Scenery.ECBehaviorAvoidCollision.Instance.pRadius

◆ pRidable

ECBehaviorRidable.Instance Dragengine.Scenery.ECBehaviorAvoidCollision.Instance.pRidable

◆ pRideOn

ECBehaviorRideOn.Instance Dragengine.Scenery.ECBehaviorAvoidCollision.Instance.pRideOn

◆ pSpeedMultiplier

float Dragengine.Scenery.ECBehaviorAvoidCollision.Instance.pSpeedMultiplier

◆ pWaitBehindObstacles

bool Dragengine.Scenery.ECBehaviorAvoidCollision.Instance.pWaitBehindObstacles

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