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

Behavior instance. More...

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

Public Member Functions

void addListener (Listener listener)
 Add listener. More...
 
void addToGameWorld ()
 Add element to game world. More...
 
void dispose ()
 Dispose of composeable instance. More...
 
bool getApplyToActor ()
 Automatically apply grounded position to actor. More...
 
ECBehaviorCollider.Instance getCollider ()
 Collider behavior instance or null. More...
 
ECBehaviorColliderAI.Instance getColliderAI ()
 ColliderAI behavior instance or null. More...
 
Vector getDirection ()
 Test direction. More...
 
ECBehaviorProjectToGround getECBehavior ()
 Behavior. More...
 
bool getEnabled ()
 Enable projecting to ground. More...
 
Collider getGroundCollider ()
 Ground collider or null. More...
 
CollisionInfo getGroundCollisionInfo ()
 Ground collision information or null. More...
 
Element getGroundElement ()
 Ground element or null. More...
 
bool getTouchesGround ()
 Actor is touching ground. More...
 
TouchSensor getTouchSensor ()
 Touch sensor. More...
 
void init (StubElement stub)
 Initialize element from stub. More...
 
Instance new (ECBehaviorProjectToGround ecbehavior, BehaviorElement element)
 Create element. More...
 
void postThink (float elapsed)
 Post thinking after physics processing is finished. More...
 
DVector projectToGround ()
 Project to ground. More...
 
void readFromFile (PersistencyEnvironment env, FileReader reader)
 Read behavior from file. More...
 
void removeFromGameWorld ()
 Remove element from game world. More...
 
void removeListener (Listener listener)
 Remove listener. More...
 
void setApplyToActor (bool applyToActor)
 Set if grounded position to automatically applied to actor. More...
 
void setCollisionFilter (CollisionFilter filter)
 Set test collision filter. More...
 
void setDirection (float distance)
 Set test direction. More...
 
void setDirection (Vector distance)
 Set test direction. More...
 
void setEnabled (bool enabled)
 Set if projecting to ground is enabled. More...
 
void setGroundedPosition (DVector position)
 Set grounded position. More...
 
void setShape (ShapeList shape)
 Set shape of test collider. More...
 
void setShapesHumanoid (float radius)
 Set project to ground shapes for humanoid actors. More...
 
void setTouchesGround (bool touchesGround)
 Set if actor is touching ground. More...
 
void stateChanged ()
 State changed (visble, touchable). More...
 
void writeToFile (PersistencyEnvironment env, FileWriter writer)
 Write behavior to file. More...
 
- Public Member Functions inherited from Dragengine.Scenery.DefaultECBehaviorInstance
void attachToParent (Element parent)
 Attach element to object set by the mapper in the IGDE World Editor. More...
 
void enterFrame ()
 Frame update started. 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...
 
bool requiresEnterFrame ()
 Behavior instance requires enterFrame() to be called. More...
 
bool requiresThink ()
 Behavior instance requires think() to be called. More...
 
void think (float elapsed)
 Think about what to do for the next frame update. More...
 

Public Attributes

bool pApplyToActor
 
ECBehaviorCollider.Instance pCollider
 
ECBehaviorColliderAI.Instance pColliderAI
 
ECBehaviorProjectToGround pECBehavior
 
DVector pGroundedPosition
 
Array pListeners
 
DVector pNormTestDirection
 
Collider pProjectCollider
 
ColliderCollisionTest pTest
 
ColliderVolume pTestCollider
 
bool pTouchesGround
 
TouchSensor pTouchSensor
 

Protected Member Functions

TouchSensor createTouchSensor (StubElement stub, Collider collider)
 Create touch sensor. More...
 
ColliderCollisionTest getTest ()
 Project to ground collider collision test. More...
 
ColliderVolume getTestCollider ()
 Collier to attach collision tests to. 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

◆ addListener()

void Dragengine.Scenery.ECBehaviorProjectToGround.Instance.addListener ( Listener  listener)

Add listener.

◆ addToGameWorld()

void Dragengine.Scenery.ECBehaviorProjectToGround.Instance.addToGameWorld ( )

Add element to game world.

Reimplemented from Dragengine.Scenery.DefaultECBehaviorInstance.

◆ createTouchSensor()

TouchSensor Dragengine.Scenery.ECBehaviorProjectToGround.Instance.createTouchSensor ( StubElement  stub,
Collider  collider 
)
protected

Create touch sensor.

◆ dispose()

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

Dispose of composeable instance.

Reimplemented from Dragengine.Scenery.DefaultECBehaviorInstance.

◆ getApplyToActor()

bool Dragengine.Scenery.ECBehaviorProjectToGround.Instance.getApplyToActor ( )

Automatically apply grounded position to actor.

◆ getCollider()

ECBehaviorCollider.Instance Dragengine.Scenery.ECBehaviorProjectToGround.Instance.getCollider ( )

Collider behavior instance or null.

◆ getColliderAI()

ECBehaviorColliderAI.Instance Dragengine.Scenery.ECBehaviorProjectToGround.Instance.getColliderAI ( )

ColliderAI behavior instance or null.

◆ getDirection()

Vector Dragengine.Scenery.ECBehaviorProjectToGround.Instance.getDirection ( )

Test direction.

◆ getECBehavior()

ECBehaviorProjectToGround Dragengine.Scenery.ECBehaviorProjectToGround.Instance.getECBehavior ( )

Behavior.

◆ getEnabled()

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

Enable projecting to ground.

◆ getGroundCollider()

Collider Dragengine.Scenery.ECBehaviorProjectToGround.Instance.getGroundCollider ( )

Ground collider or null.

◆ getGroundCollisionInfo()

CollisionInfo Dragengine.Scenery.ECBehaviorProjectToGround.Instance.getGroundCollisionInfo ( )

Ground collision information or null.

◆ getGroundElement()

Element Dragengine.Scenery.ECBehaviorProjectToGround.Instance.getGroundElement ( )

Ground element or null.

If last ground collider is not null and collider owner is castable to Element returns the owner element. Otherwise null is returned.

◆ getTest()

ColliderCollisionTest Dragengine.Scenery.ECBehaviorProjectToGround.Instance.getTest ( )
protected

Project to ground collider collision test.

◆ getTestCollider()

ColliderVolume Dragengine.Scenery.ECBehaviorProjectToGround.Instance.getTestCollider ( )
protected

Collier to attach collision tests to.

◆ getTouchesGround()

bool Dragengine.Scenery.ECBehaviorProjectToGround.Instance.getTouchesGround ( )

Actor is touching ground.

◆ getTouchSensor()

TouchSensor Dragengine.Scenery.ECBehaviorProjectToGround.Instance.getTouchSensor ( )

Touch sensor.

◆ init()

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

Initialize element from stub.

Reimplemented from Dragengine.Scenery.DefaultECBehaviorInstance.

◆ new()

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

Create element.

◆ postThink()

void Dragengine.Scenery.ECBehaviorProjectToGround.Instance.postThink ( float  elapsed)

Post thinking after physics processing is finished.

Projects actor down to ground if enabled storing result. Ground position will be always valid and is either the grounded position or the current collider position.

If apply-to-actor is enabled calls BehaviorElement.setGeometry() with grounded position and collider orientation.

Reimplemented from Dragengine.Scenery.DefaultECBehaviorInstance.

◆ projectToGround()

DVector Dragengine.Scenery.ECBehaviorProjectToGround.Instance.projectToGround ( )

Project to ground.

Call this method during postThink() calls of parent element if getTouchesGround() is true. This method does not check if touches ground is true to allow users of this class to project elements down to ground using whatever logic required.

If collider is enabled and collision test contains a ground collision the collider position is adjusted. Touching ground parameter is updated with the test result. The collider is not modified. Method returns either the current collider position or the desired new collider position. This allows to use this method like this:

position = projectToGround.projectToGround()

Position contains then either collider.getPosition() or the down projected position. Project to ground does not adjust orientation only position.

◆ readFromFile()

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

Read behavior from file.

Reimplemented from Dragengine.Scenery.DefaultECBehaviorInstance.

◆ removeFromGameWorld()

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

Remove element from game world.

Reimplemented from Dragengine.Scenery.DefaultECBehaviorInstance.

◆ removeListener()

void Dragengine.Scenery.ECBehaviorProjectToGround.Instance.removeListener ( Listener  listener)

Remove listener.

◆ setApplyToActor()

void Dragengine.Scenery.ECBehaviorProjectToGround.Instance.setApplyToActor ( bool  applyToActor)

Set if grounded position to automatically applied to actor.

◆ setCollisionFilter()

void Dragengine.Scenery.ECBehaviorProjectToGround.Instance.setCollisionFilter ( CollisionFilter  filter)

Set test collision filter.

◆ setDirection() [1/2]

void Dragengine.Scenery.ECBehaviorProjectToGround.Instance.setDirection ( float  distance)

Set test direction.

Parameters
distanceDistance to test along. This is the furthest distance the actor can be projected down to. Typical value is -0.3 to project the actor down by at most 0.3 meters.

◆ setDirection() [2/2]

void Dragengine.Scenery.ECBehaviorProjectToGround.Instance.setDirection ( Vector  distance)

Set test direction.

Parameters
distanceDistance to test along. This is the furthest distance the actor can be projected down to. Typical value is (0, -0.3, 0) to project the actor down by at most 0.3 meters.

◆ setEnabled()

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

Set if projecting to ground is enabled.

◆ setGroundedPosition()

void Dragengine.Scenery.ECBehaviorProjectToGround.Instance.setGroundedPosition ( DVector  position)

Set grounded position.

◆ setShape()

void Dragengine.Scenery.ECBehaviorProjectToGround.Instance.setShape ( ShapeList  shape)

Set shape of test collider.

For best results a shape should be used which is slightly smaller than the shape of the collider used to move an element through the game world. If the shape used for the test collider is equal or larger strange behavior can be the result (for example climbing).

Recommended is setting a ShapeList with a sphere at origin and radius 0.3 .

◆ setShapesHumanoid()

void Dragengine.Scenery.ECBehaviorProjectToGround.Instance.setShapesHumanoid ( float  radius)

Set project to ground shapes for humanoid actors.

Assigns a box shape to the project to ground touch sensor. The shape is located at the actor position and has a radius of slightly more than the radius used for the collider AI (0.31m) and a height of the same value. This is a reasonable collider AI shape for a humanoid actor.

Assigns a sphere shape to the project to ground instance. This is usually the same shape as used for the collider AI but can be optimized. For example if the shape is a capcule the project to ground shape can be opzimized to a sphere of the matching radius. The default implementation does apply this optimization and uses a sphere with the same radius as used for the collider AI capsule.

◆ setTouchesGround()

void Dragengine.Scenery.ECBehaviorProjectToGround.Instance.setTouchesGround ( bool  touchesGround)

Set if actor is touching ground.

Set by projectToGround if enabled. If element is free falling set this to true when the element touches ground again. This has to be done manually since projectToGround() has to be skipped to avoid elements being sucked to the ground as soon as they get into projecting distance.

◆ stateChanged()

void Dragengine.Scenery.ECBehaviorProjectToGround.Instance.stateChanged ( )

State changed (visble, touchable).

Reimplemented from Dragengine.Scenery.DefaultECBehaviorInstance.

◆ writeToFile()

void Dragengine.Scenery.ECBehaviorProjectToGround.Instance.writeToFile ( PersistencyEnvironment  env,
FileWriter  writer 
)

Write behavior to file.

Reimplemented from Dragengine.Scenery.DefaultECBehaviorInstance.

Member Data Documentation

◆ pApplyToActor

bool Dragengine.Scenery.ECBehaviorProjectToGround.Instance.pApplyToActor

◆ pCollider

ECBehaviorCollider.Instance Dragengine.Scenery.ECBehaviorProjectToGround.Instance.pCollider

◆ pColliderAI

ECBehaviorColliderAI.Instance Dragengine.Scenery.ECBehaviorProjectToGround.Instance.pColliderAI

◆ pECBehavior

ECBehaviorProjectToGround Dragengine.Scenery.ECBehaviorProjectToGround.Instance.pECBehavior

◆ pGroundedPosition

DVector Dragengine.Scenery.ECBehaviorProjectToGround.Instance.pGroundedPosition

◆ pListeners

Array Dragengine.Scenery.ECBehaviorProjectToGround.Instance.pListeners

◆ pNormTestDirection

DVector Dragengine.Scenery.ECBehaviorProjectToGround.Instance.pNormTestDirection

◆ pProjectCollider

Collider Dragengine.Scenery.ECBehaviorProjectToGround.Instance.pProjectCollider

◆ pTest

ColliderCollisionTest Dragengine.Scenery.ECBehaviorProjectToGround.Instance.pTest

◆ pTestCollider

ColliderVolume Dragengine.Scenery.ECBehaviorProjectToGround.Instance.pTestCollider

◆ pTouchesGround

bool Dragengine.Scenery.ECBehaviorProjectToGround.Instance.pTouchesGround

◆ pTouchSensor

TouchSensor Dragengine.Scenery.ECBehaviorProjectToGround.Instance.pTouchSensor

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