Drag[en]gine Script Module DragonScript 1.35
Loading...
Searching...
No Matches
Dragengine.Scenery.ECBehaviorCollider.Instance Class Reference

Behavior instance. More...

Inheritance diagram for Dragengine.Scenery.ECBehaviorCollider.Instance:
Dragengine.Scenery.DefaultECBehaviorInstance Dragengine.Scenery.ColliderListener Dragengine.Scenery.ECBehaviorInstance

Public Member Functions

void addListener (Listener listener)
 Add listener.
void addToGameWorld ()
 Add element to game world.
bool canHitCollider (Collider owner, Collider collider)
 Colliders can hit each other.
void collisionResponse (Collider owner, CollisionInfo info)
 Collision detected.
void dispose ()
 Dispose of composeable instance.
void geometryChanged ()
 Position or orientation changed.
Collider getCollider ()
 Collider.
ECBehaviorCollider getECBehavior ()
 Behavior.
String getRigShapeProperty (CollisionInfo info, bool owner)
 Rig shape property from collision or null if not possible.
String getRigShapeProperty (int bone, int shape)
 Rig shape property or null if not possible.
void init (StubElement stub)
 Initialize element from stub.
Instance new (ECBehaviorCollider ecbehavior, BehaviorElement element)
 Create element.
void readFromFile (PersistencyEnvironment env, FileReader reader)
 Read behavior from file.
void removeFromGameWorld ()
 Remove element from game world.
void removeListener (Listener listener)
 Remove listener.
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.
BehaviorElement getElement ()
 Behavior element to apply behavior to.
int getInstanceIndex ()
 Behavior instance index.
DefaultECBehaviorInstance new (BehaviorElement element)
 Create default composeable instance.
void postThink (float elapsed)
 Post thinking after physics processing is finished.
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 Member Functions inherited from Dragengine.Scenery.ColliderListener
void colliderChanged (Collider owner)
 Collider properties have changed and attached resources have been updated.

Protected Member Functions

Collider createCollider (StubElement stub, ECBehaviorComponent.Instance component)
 Create collider.
bool readBoneState (PersistencyEnvironment env, FileReader reader, ColliderRig collider)
 Read bone state from file.
void readBoneStates (PersistencyEnvironment env, FileReader reader)
 Read bone states from file.
void readColliderState (PersistencyEnvironment env, FileReader reader)
 Read collider parameters from file.
void writeBoneStates (PersistencyEnvironment env, FileWriter writer)
 Write bone states to file.
void writeDynamicBoneState (FileWriter writer, ColliderRig collider, int bone)
 Write bone state to file.
void writeDynamicBoneStates (FileWriter writer)
 Write dynamic bone states to file.
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.

Additional Inherited Members

Public Attributes inherited from Dragengine.Scenery.DefaultECBehaviorInstance
BehaviorElement pElement
int pInstanceIndex
bool pRequiresEnterFrame
bool pRequiresThink

Detailed Description

Behavior instance.

Member Function Documentation

◆ addListener()

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

Add listener.

Referenced by writeDynamicBoneState().

◆ addToGameWorld()

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

◆ canHitCollider()

bool Dragengine.Scenery.ECBehaviorCollider.Instance.canHitCollider ( Collider owner,
Collider collider )

Colliders can hit each other.

Implements Dragengine.Scenery.ColliderListener.

◆ collisionResponse()

void Dragengine.Scenery.ECBehaviorCollider.Instance.collisionResponse ( Collider owner,
CollisionInfo info )

Collision detected.

If listeners are present calls collisionResponse() on all listeners expecting them to handle collision properly. Otherwise for static and kinematic collision response clears linear and angular velocity. For dynamic collision response nothing is done.

Implements Dragengine.Scenery.ColliderListener.

References Dragengine.Scenery.ECBehaviorCollider.createListeners().

◆ createCollider()

Collider Dragengine.Scenery.ECBehaviorCollider.Instance.createCollider ( StubElement stub,
ECBehaviorComponent.Instance component )
protected

Create collider.

Parameters
stubStub to use.
componentComponent to use or null if absent.

Referenced by readColliderState(), readFromFile(), and removeFromGameWorld().

◆ dispose()

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

Dispose of composeable instance.

Reimplemented from Dragengine.Scenery.DefaultECBehaviorInstance.

References new().

Referenced by getRigShapeProperty(), and removeListener().

◆ geometryChanged()

void Dragengine.Scenery.ECBehaviorCollider.Instance.geometryChanged ( )

Position or orientation changed.

Reimplemented from Dragengine.Scenery.DefaultECBehaviorInstance.

References Dragengine.Scenery.ECBehaviorCollider.getComponent().

◆ getCollider()

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

Collider.

References new().

Referenced by readBoneStates(), and readColliderState().

◆ getECBehavior()

ECBehaviorCollider Dragengine.Scenery.ECBehaviorCollider.Instance.getECBehavior ( )

Behavior.

Referenced by readBoneStates().

◆ getRigShapeProperty() [1/2]

String Dragengine.Scenery.ECBehaviorCollider.Instance.getRigShapeProperty ( CollisionInfo info,
bool owner )

Rig shape property from collision or null if not possible.

◆ getRigShapeProperty() [2/2]

String Dragengine.Scenery.ECBehaviorCollider.Instance.getRigShapeProperty ( int bone,
int shape )

Rig shape property or null if not possible.

References dispose().

Referenced by readBoneStates(), writeBoneStates(), and writeDynamicBoneStates().

◆ init()

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

Initialize element from stub.

Reimplemented from Dragengine.Scenery.DefaultECBehaviorInstance.

Referenced by stateChanged().

◆ new()

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

Create element.

References new().

Referenced by dispose(), getCollider(), new(), and writeDynamicBoneState().

◆ readBoneState()

bool Dragengine.Scenery.ECBehaviorCollider.Instance.readBoneState ( PersistencyEnvironment env,
FileReader reader,
ColliderRig collider )
protected

Read bone state from file.

Version
1.15

Reads first the bone name. If the name is empty string this marks the end of the bone state list and the function exits. Otherwise reads position (DVector), orientation (Quaternion), linear velocity (Vector) and angular velocity (Vector). If the bone name is found int he collider the respective bone parameters are set. If the bone name is not found in the rig nothing is done. This allows loading bone states from file in case the rig does not match anymore. The so restored bone states are potentially incomplete but at last the bone states can be successfully read from file.

The parameter collider can be null if collider is not of the matching type. In this case bone state has to be read but not applied as if the bone name is not found.

Returns
true if bone state has been read or false if empty string has been read.

◆ readBoneStates()

void Dragengine.Scenery.ECBehaviorCollider.Instance.readBoneStates ( PersistencyEnvironment env,
FileReader reader )
protected

Read bone states from file.

Version
1.15

Calls readBoneState() until the false is returned. If any bone states have been read and collider is castable to ColliderComponent then copyStatesToComponent() is called to ensure component bone states match collider bone states.

References getCollider(), getECBehavior(), and getRigShapeProperty().

◆ readColliderState()

void Dragengine.Scenery.ECBehaviorCollider.Instance.readColliderState ( PersistencyEnvironment env,
FileReader reader )
protected

Read collider parameters from file.

Version
1.15

References createCollider(), and getCollider().

◆ readFromFile()

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

Read behavior from file.

Reimplemented from Dragengine.Scenery.DefaultECBehaviorInstance.

References createCollider().

◆ removeFromGameWorld()

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

Remove element from game world.

Reimplemented from Dragengine.Scenery.DefaultECBehaviorInstance.

References createCollider().

◆ removeListener()

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

Remove listener.

References dispose().

Referenced by writeDynamicBoneState().

◆ stateChanged()

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

State changed (visble, touchable).

Reimplemented from Dragengine.Scenery.DefaultECBehaviorInstance.

References Dragengine.Scenery.DefaultECBehaviorInstance.getElement(), and init().

◆ writeBoneStates()

void Dragengine.Scenery.ECBehaviorCollider.Instance.writeBoneStates ( PersistencyEnvironment env,
FileWriter writer )
protected

Write bone states to file.

Version
1.15

Subclass can overwrite to determine which bone states to write. Default implementation calls writeDynamicBoneStates() if collider response type is CollisionResponse.dynamic. For each bone state to write call writeBoneStates(). After writing all bone states write an empty 8-bit string to mark the end of the bone state list.

References getRigShapeProperty().

◆ writeDynamicBoneState()

void Dragengine.Scenery.ECBehaviorCollider.Instance.writeDynamicBoneState ( FileWriter writer,
ColliderRig collider,
int bone )
protected

Write bone state to file.

Version
1.15

Writes bone name as 8-bit string then position (DVector), orientation (Quaternion) linear velocity (Vector) and angular velocity (Vector).

References addListener(), new(), and removeListener().

◆ writeDynamicBoneStates()

void Dragengine.Scenery.ECBehaviorCollider.Instance.writeDynamicBoneStates ( FileWriter writer)
protected

Write dynamic bone states to file.

Version
1.15

References getRigShapeProperty().

◆ writeToFile()

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

Write behavior to file.

Reimplemented from Dragengine.Scenery.DefaultECBehaviorInstance.


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