Drag[en]gine Script Module DragonScript
1.23
|
Behavior instance. More...
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... | |
Behavior instance.
void Dragengine.Scenery.ECBehaviorProjectToGround.Instance.addListener | ( | Listener | listener | ) |
Add listener.
void Dragengine.Scenery.ECBehaviorProjectToGround.Instance.addToGameWorld | ( | ) |
Add element to game world.
Reimplemented from Dragengine.Scenery.DefaultECBehaviorInstance.
|
protected |
Create touch sensor.
void Dragengine.Scenery.ECBehaviorProjectToGround.Instance.dispose | ( | ) |
Dispose of composeable instance.
Reimplemented from Dragengine.Scenery.DefaultECBehaviorInstance.
bool Dragengine.Scenery.ECBehaviorProjectToGround.Instance.getApplyToActor | ( | ) |
Automatically apply grounded position to actor.
ECBehaviorCollider.Instance Dragengine.Scenery.ECBehaviorProjectToGround.Instance.getCollider | ( | ) |
Collider behavior instance or null.
ECBehaviorColliderAI.Instance Dragengine.Scenery.ECBehaviorProjectToGround.Instance.getColliderAI | ( | ) |
ColliderAI behavior instance or null.
Vector Dragengine.Scenery.ECBehaviorProjectToGround.Instance.getDirection | ( | ) |
Test direction.
ECBehaviorProjectToGround Dragengine.Scenery.ECBehaviorProjectToGround.Instance.getECBehavior | ( | ) |
Behavior.
bool Dragengine.Scenery.ECBehaviorProjectToGround.Instance.getEnabled | ( | ) |
Enable projecting to ground.
Collider Dragengine.Scenery.ECBehaviorProjectToGround.Instance.getGroundCollider | ( | ) |
Ground collider or null.
CollisionInfo Dragengine.Scenery.ECBehaviorProjectToGround.Instance.getGroundCollisionInfo | ( | ) |
Ground collision information or null.
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.
|
protected |
Project to ground collider collision test.
|
protected |
Collier to attach collision tests to.
bool Dragengine.Scenery.ECBehaviorProjectToGround.Instance.getTouchesGround | ( | ) |
Actor is touching ground.
TouchSensor Dragengine.Scenery.ECBehaviorProjectToGround.Instance.getTouchSensor | ( | ) |
Touch sensor.
void Dragengine.Scenery.ECBehaviorProjectToGround.Instance.init | ( | StubElement | stub | ) |
Initialize element from stub.
Reimplemented from Dragengine.Scenery.DefaultECBehaviorInstance.
Instance Dragengine.Scenery.ECBehaviorProjectToGround.Instance.new | ( | ECBehaviorProjectToGround | ecbehavior, |
BehaviorElement | element | ||
) |
Create element.
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.
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 contains then either collider.getPosition() or the down projected position. Project to ground does not adjust orientation only position.
void Dragengine.Scenery.ECBehaviorProjectToGround.Instance.readFromFile | ( | PersistencyEnvironment | env, |
FileReader | reader | ||
) |
Read behavior from file.
Reimplemented from Dragengine.Scenery.DefaultECBehaviorInstance.
void Dragengine.Scenery.ECBehaviorProjectToGround.Instance.removeFromGameWorld | ( | ) |
Remove element from game world.
Reimplemented from Dragengine.Scenery.DefaultECBehaviorInstance.
void Dragengine.Scenery.ECBehaviorProjectToGround.Instance.removeListener | ( | Listener | listener | ) |
Remove listener.
void Dragengine.Scenery.ECBehaviorProjectToGround.Instance.setApplyToActor | ( | bool | applyToActor | ) |
Set if grounded position to automatically applied to actor.
void Dragengine.Scenery.ECBehaviorProjectToGround.Instance.setCollisionFilter | ( | CollisionFilter | filter | ) |
Set test collision filter.
void Dragengine.Scenery.ECBehaviorProjectToGround.Instance.setDirection | ( | float | distance | ) |
Set test direction.
distance | Distance 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. |
void Dragengine.Scenery.ECBehaviorProjectToGround.Instance.setDirection | ( | Vector | distance | ) |
Set test direction.
distance | Distance 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. |
void Dragengine.Scenery.ECBehaviorProjectToGround.Instance.setEnabled | ( | bool | enabled | ) |
Set if projecting to ground is enabled.
void Dragengine.Scenery.ECBehaviorProjectToGround.Instance.setGroundedPosition | ( | DVector | position | ) |
Set grounded position.
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 .
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.
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.
void Dragengine.Scenery.ECBehaviorProjectToGround.Instance.stateChanged | ( | ) |
State changed (visble, touchable).
Reimplemented from Dragengine.Scenery.DefaultECBehaviorInstance.
void Dragengine.Scenery.ECBehaviorProjectToGround.Instance.writeToFile | ( | PersistencyEnvironment | env, |
FileWriter | writer | ||
) |
Write behavior to file.
Reimplemented from Dragengine.Scenery.DefaultECBehaviorInstance.
bool Dragengine.Scenery.ECBehaviorProjectToGround.Instance.pApplyToActor |
ECBehaviorCollider.Instance Dragengine.Scenery.ECBehaviorProjectToGround.Instance.pCollider |
ECBehaviorColliderAI.Instance Dragengine.Scenery.ECBehaviorProjectToGround.Instance.pColliderAI |
ECBehaviorProjectToGround Dragengine.Scenery.ECBehaviorProjectToGround.Instance.pECBehavior |
DVector Dragengine.Scenery.ECBehaviorProjectToGround.Instance.pGroundedPosition |
Array Dragengine.Scenery.ECBehaviorProjectToGround.Instance.pListeners |
DVector Dragengine.Scenery.ECBehaviorProjectToGround.Instance.pNormTestDirection |
Collider Dragengine.Scenery.ECBehaviorProjectToGround.Instance.pProjectCollider |
ColliderCollisionTest Dragengine.Scenery.ECBehaviorProjectToGround.Instance.pTest |
ColliderVolume Dragengine.Scenery.ECBehaviorProjectToGround.Instance.pTestCollider |
bool Dragengine.Scenery.ECBehaviorProjectToGround.Instance.pTouchesGround |
TouchSensor Dragengine.Scenery.ECBehaviorProjectToGround.Instance.pTouchSensor |