Drag[en]gine Script Module DragonScript Script API  1.0
SimpleElement Class Reference

Simple scene element composed of one Component. More...

Inheritance diagram for SimpleElement:
Element ColliderListener

Public Member Functions

void addToGameWorld ()
 Add element to game world. More...
 
void attachComponent (StubElement stub)
 Attach component to collider. More...
 
bool canHitCollider (Collider owner, Collider collider)
 Owner can hit collider. More...
 
void colliderChanged (Collider owner)
 Notify collider changed. More...
 
void collisionResponse (Collider owner, CollisionInfo info)
 Collision detected. More...
 
Collider createCollider (StubElement stub)
 Create collider for the element. More...
 
ShapeList createColliderShape (StubElement stub)
 Create shape for a collision volume. More...
 
CollisionFilter createCollisionFilter (StubElement stub)
 Create collision filter for a collider. More...
 
Component createComponent (StubElement stub)
 Create component for the element. More...
 
Collider createGhostCollider ()
 Create ghost collider. More...
 
void dispose ()
 Dispose of element. More...
 
Collider getCollider ()
 Collider or null if not set. More...
 
Component getComponent ()
 Component or null if not set. More...
 
Dictionary getRigShapeDataMap ()
 Rig shape data dictionary using rig shape property as key. More...
 
void init (StubElement stub)
 Initialize the element from a stub. More...
 
SimpleElement new (SimpleElementClass eclass)
 Create element. More...
 
void onSetGeometry ()
 Position and orientation changed. More...
 
void onSetOrientation ()
 Orientation changed. More...
 
void onSetPosition ()
 Position changed. More...
 
void onSetTouchable ()
 Touchable state changed. More...
 
void onSetVisible ()
 Visible state changed. More...
 
void readFromFile (FileReader reader)
 Read element from a file writer. More...
 
void removeFromGameWorld ()
 Remove element from game world if set. More...
 
void setCollider (Collider collider)
 Set collider or null if not set. More...
 
void setComponent (Component comp)
 Set component or null if not set. More...
 
void visit (ElementVisitor visitor)
 Visit element. More...
 
void writeToFile (FileWriter writer)
 Write element to file writer. More...
 
- Public Member Functions inherited from Element
void addToGameWorld ()
 
void dispose ()
 
ElementClass getClass ()
 
DMatrix getElementMatrix ()
 Matrix to transform from element space into world space. More...
 
GameWorld getGameWorld ()
 
UniqueID getID ()
 
DMatrix getInverseElementMatrix ()
 Matrix to transform from world space into element space. More...
 
Quaternion getOrientation ()
 
Element getParent ()
 
DVector getPosition ()
 
bool getTouchable ()
 
bool getVisible ()
 
void init (StubElement stub)
 
bool isChildOf (Element parent)
 
bool isMyselfOrChildOf (Element parent)
 
Element new (ElementClass elementClass)
 
void onSetGameWorld ()
 
void onSetGeometry ()
 
void onSetOrientation ()
 
void onSetParent ()
 
void onSetPosition ()
 
void onSetTouchable ()
 
void onSetVisible ()
 
void postLoadInit ()
 
void postThink (float elapsed)
 
void readFromFile (FileReader reader)
 
void removeFromGameWorld ()
 
void removeFromGameWorldIfPresent ()
 Remove element from game world if present. More...
 
void setGameWorld (GameWorld gameWorld)
 
void setGeometry (DVector position, Quaternion orientation)
 
void setID (UniqueID id)
 
void setOrientation (Quaternion orientation)
 
void setParent (Element parent)
 
void setPosition (DVector position)
 
void setTouchable (bool touchable)
 
void setVisible (bool visible)
 
void think (float elapsed)
 
String toString ()
 
void visit (ElementVisitor visitor)
 
void writeToFile (FileWriter writer)
 
Notifications.

Detailed Description

Simple scene element composed of one Component.

Author
Roland Pl├╝ss
Version
1.0

Member Function Documentation

§ addToGameWorld()

void addToGameWorld ( )

Add element to game world.

§ attachComponent()

void attachComponent ( StubElement  stub)

Attach component to collider.

The default implementation attaches the component statically if the component and collider exists. For this to work the component has to be in the right position relative to the collider.

§ canHitCollider()

bool canHitCollider ( Collider  owner,
Collider  collider 
)

Owner can hit collider.

Implements ColliderListener.

§ colliderChanged()

void colliderChanged ( Collider  owner)

Notify collider changed.

Can be called more than once per frame.

Implements ColliderListener.

§ collisionResponse()

void collisionResponse ( Collider  owner,
CollisionInfo  info 
)

Collision detected.

Implements ColliderListener.

§ createCollider()

Collider createCollider ( StubElement  stub)

Create collider for the element.

It is not required to create a collider but without a collider no resources can be attached and have to be handled manually. To support attaching but without a collider affecting the world use createGhostCollider(). The default implementation creates a component collider if the element component is not null or a collider volume otherwise. If a collider volume the shape is set using createColliderShape(). The create collider is initilized with parameters stored in the element class modified by the stub. Uses createCollisionFilter() to create the collision filter. If a component exists and a collider volume has been created it is attached to the collider volume. Collider components attach their component automatically so no explicit attaching is required. Overwrite to modify collider creation process using parameters stored in the stub if required.

§ createColliderShape()

ShapeList createColliderShape ( StubElement  stub)

Create shape for a collision volume.

If a component exists with a model set a box is created with the extends of the model. Otherwise a small box shape is created as fallback.

§ createCollisionFilter()

CollisionFilter createCollisionFilter ( StubElement  stub)

Create collision filter for a collider.

The default implementation creates an empty collision filter.

§ createComponent()

Component createComponent ( StubElement  stub)

Create component for the element.

It is not required to create a component. Return null to use no component. The default implementation creates a component using the component parameters stored in the element class. If not all required resources can be found no component is created. Overwrite to modify component creation process using parameters stored in the sub if required.

§ createGhostCollider()

Collider createGhostCollider ( )

Create ghost collider.

A ghost collider can be used to attach resources but does not affect the world. It is disabled and has an empty collision filter. The position and orientation is taken from the stub.

§ dispose()

void dispose ( )

Dispose of element.

§ getCollider()

Collider getCollider ( )

Collider or null if not set.

§ getComponent()

Component getComponent ( )

Component or null if not set.

§ getRigShapeDataMap()

Dictionary getRigShapeDataMap ( )

Rig shape data dictionary using rig shape property as key.

§ init()

void init ( StubElement  stub)

Initialize the element from a stub.

§ new()

Create element.

§ onSetGeometry()

void onSetGeometry ( )

Position and orientation changed.

§ onSetOrientation()

void onSetOrientation ( )

Orientation changed.

§ onSetPosition()

void onSetPosition ( )

Position changed.

§ onSetTouchable()

void onSetTouchable ( )

Touchable state changed.

§ onSetVisible()

void onSetVisible ( )

Visible state changed.

§ readFromFile()

void readFromFile ( FileReader  reader)

Read element from a file writer.

§ removeFromGameWorld()

void removeFromGameWorld ( )

Remove element from game world if set.

Does not dispose of the element.

§ setCollider()

void setCollider ( Collider  collider)

Set collider or null if not set.

§ setComponent()

void setComponent ( Component  comp)

Set component or null if not set.

§ visit()

void visit ( ElementVisitor  visitor)

Visit element.

§ writeToFile()

void writeToFile ( FileWriter  writer)

Write element to file writer.


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