Drag[en]gine Script Module DragonScript 1.35
Loading...
Searching...
No Matches
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.
void addToGameWorld ()
 Add element to game world.
void dispose ()
 Dispose of composeable instance.
bool getApplyToActor ()
 Automatically apply grounded position to actor.
ECBehaviorCollider.Instance getCollider ()
 Collider behavior instance or null.
ECBehaviorColliderAI.Instance getColliderAI ()
 ColliderAI behavior instance or null.
Vector getDirection ()
 Test direction.
ECBehaviorProjectToGround getECBehavior ()
 Behavior.
bool getEnabled ()
 Enable projecting to ground.
BehaviorElement getGroundBehaviorElement ()
 Ground behavior element or null.
Collider getGroundCollider ()
 Ground collider or null.
CollisionInfo getGroundCollisionInfo ()
 Ground collision information or null.
Element getGroundElement ()
 Ground element or null.
bool getTouchesGround ()
 Actor is touching ground.
TouchSensor getTouchSensor ()
 Touch sensor.
float hitAngle (CollisionInfo info)
 Angle between collision normal and project to ground direction.
void init (StubElement stub)
 Initialize element from stub.
Instance new (ECBehaviorProjectToGround ecbehavior, BehaviorElement element)
 Create element.
void postThink (float elapsed)
 Post thinking after physics processing is finished.
DVector projectToGround ()
 Project to ground.
void readFromFile (PersistencyEnvironment env, FileReader reader)
 Read behavior from file.
void removeFromCollider ()
 Remove collider collision test from collider.
void removeFromGameWorld ()
 Remove element from game world.
void removeListener (Listener listener)
 Remove listener.
void setApplyToActor (bool applyToActor)
 Set if grounded position to automatically applied to actor.
void setCollisionFilter (CollisionFilter filter)
 Set test collision filter.
void setDirection (float distance)
 Set test direction.
void setDirection (Vector distance)
 Set test direction.
void setEnabled (bool enabled)
 Set if projecting to ground is enabled.
void setGroundedPosition (DVector position)
 Set grounded position.
void setShape (ShapeList shape)
 Set shape of test collider.
void setShapesHumanoid (float radius)
 Set project to ground shapes for humanoid actors.
void setTouchesGround (bool touchesGround)
 Set if actor is touching ground.
void stateChanged ()
 State changed (visble, touchable).
void writeToFile (PersistencyEnvironment env, FileWriter writer)
 Write behavior to file.
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.
void enterFrame ()
 Frame update started.
void geometryChanged ()
 Position or orientation changed.
BehaviorElement getElement ()
 Behavior element to apply behavior to.
int getInstanceIndex ()
 Behavior instance index.
DefaultECBehaviorInstance new (BehaviorElement element)
 Create default composeable instance.
bool requiresEnterFrame ()
 Behavior instance requires enterFrame() to be called.
bool requiresThink ()
 Behavior instance requires think() to be called.
void think (float elapsed)
 Think about what to do for the next frame update.

Public Attributes

bool pApplyToActor
ECComposeBTSM.Instance pBTSMs
ECBehaviorCollider.Instance pCollider
ECBehaviorColliderAI.Instance pColliderAI
ECBehaviorProjectToGround pECBehavior
DVector pGroundedPosition
float pLandingAngle
Array pListeners
DVector pNormTestDirection
Collider pProjectCollider
ColliderCollisionTest pTest
ColliderVolume pTestCollider
bool pTouchesGround
TouchSensor pTouchSensor
Public Attributes inherited from Dragengine.Scenery.DefaultECBehaviorInstance
BehaviorElement pElement
int pInstanceIndex
bool pRequiresEnterFrame
bool pRequiresThink

Protected Member Functions

TouchSensor createTouchSensor (StubElement stub, Collider collider)
 Create touch sensor.
ColliderCollisionTest getTest ()
 Project to ground collider collision test.
ColliderVolume getTestCollider ()
 Collier to attach collision tests to.
Protected Member Functions inherited from Dragengine.Scenery.DefaultECBehaviorInstance
void setRequiresEnterFrame (bool required)
 Set if behavior instance requires enterFrame() to be called.
void setRequiresThink (bool required)
 Set if behavior instance requires think() to be called.

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.

References getGroundBehaviorElement().

◆ dispose()

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

Dispose of composeable instance.

Reimplemented from Dragengine.Scenery.DefaultECBehaviorInstance.

References new().

◆ 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.

References hitAngle().

◆ getECBehavior()

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

Behavior.

◆ getEnabled()

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

Enable projecting to ground.

Referenced by setApplyToActor().

◆ getGroundBehaviorElement()

BehaviorElement Dragengine.Scenery.ECBehaviorProjectToGround.Instance.getGroundBehaviorElement ( )

Ground behavior element or null.

Version
1.26

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

Referenced by createTouchSensor().

◆ 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.

Referenced by setApplyToActor().

◆ getTouchSensor()

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

Touch sensor.

◆ hitAngle()

float Dragengine.Scenery.ECBehaviorProjectToGround.Instance.hitAngle ( CollisionInfo info)

Angle between collision normal and project to ground direction.

Version
1.26

Referenced by getDirection(), and setShape().

◆ 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.

Referenced by dispose(), and setTouchesGround().

◆ 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.

◆ removeFromCollider()

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

Remove collider collision test from collider.

◆ 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.

References getEnabled(), and getTouchesGround().

◆ 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 .

References hitAngle().

◆ 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.

References new().

◆ 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

◆ pBTSMs

ECComposeBTSM.Instance Dragengine.Scenery.ECBehaviorProjectToGround.Instance.pBTSMs

◆ 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

◆ pLandingAngle

float Dragengine.Scenery.ECBehaviorProjectToGround.Instance.pLandingAngle

◆ 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: