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

Behavior element behavior adding support to control desktop by player. More...

Inheritance diagram for Dragengine.Scenery.ECBehaviorControlDesktop:
Dragengine.Scenery.DefaultECBehavior Dragengine.Scenery.ECBehavior Dragengine.Scenery.BehaviorCompatiblePersistency

Classes

class  Instance
 Behavior instance. More...
 

Public Member Functions

void dispose ()
 Dispose of behavior. More...
 
ECPString getBone ()
 Bone name or empty string to not use. More...
 
ECPVector getLowerLeft ()
 Virtual plane lower left position. More...
 
ECPVector getLowerRight ()
 Virtual plane lower right position. More...
 
ECBehaviorRenderableDesktop getRenderableDesktop ()
 Renderable desktop behavior. More...
 
ECPVector getUpperLeft ()
 Virtual plane upper left position. More...
 
Instance instance (BehaviorElement element)
 Get instance in element from owner element class. More...
 
ECBehaviorControlDesktop new (BehaviorElementClass eclass, ECBehaviorRenderableDesktop renderableDesktop)
 Create behavior element class. More...
 
ECBehaviorControlDesktop new (BehaviorElementClass eclass, ECBehaviorRenderableDesktop renderableDesktop, String id)
 
ECBehaviorControlDesktop new (BehaviorElementClass eclass, ECBehaviorRenderableDesktop renderableDesktop, String id, String prefix)
 
- Public Member Functions inherited from Dragengine.Scenery.DefaultECBehavior
void assignInstanceIndex (int instanceIndex)
 Assign instance index. More...
 
String getBehaviorID ()
 Unique identifier of behavior. More...
 
String getID ()
 Identifier. More...
 
int getInstanceIndex ()
 Instance index. More...
 
void loadSupportedData (String identifier, PersistencyEnvironment env, FileReader reader, ECBehaviorInstance instance)
 Load instance data of another behavior. More...
 
bool supportsBehaviorID (String identifier)
 Behavior supports loading instance data of another behavior. More...
 
- Public Member Functions inherited from Dragengine.Scenery.ECBehavior
ECBehaviorInstance createInstance (BehaviorElement element)
 Create Behavior instance. More...
 

Static Public Member Functions

static ECBehaviorControlDesktop getBehaviorIn (BehaviorElementClass eclass)
 Get behavior in element class or null if absent. More...
 

Additional Inherited Members

- Protected Member Functions inherited from Dragengine.Scenery.DefaultECBehavior
DefaultECBehavior new (BehaviorElementClass eclass)
 Create default composeable behavior with empty identifier. More...
 
DefaultECBehavior new (BehaviorElementClass eclass, String id)
 Create default composeable behavior. More...
 
void setBehaviorID (String identifier)
 Set behavior identifier. More...
 
void useClassNameAsBehaviorID ()
 Set behavior identifier to "<class-name>:<identifier>". More...
 
void useFullyQualifiedClassNameAsBehaviorID ()
 Set behavior identifier to "<fully-qualified-class-name>:<identifier>". More...
 

Detailed Description

Behavior element behavior adding support to control desktop by player.

Version
1.7

The behavior allows player (or other actors) to move the mouse pointer on a ECBehaviorRenderableDesktop by looking or pointing at the desired position. Also the player can simulate a left or right mouse click by using an input binding defined by the actor himself. This kind of input is typically used for VR games but can be also used for non VR games like first person shooters.

The behavior defines three corner points of a virtual rectangular plane. The player looking or pointing direction is intersected with this virtual plane. The relative position of this hit point is mapped to the Desktop widget. The three corners of the virtual plane are the lower left, lower right and upper left corner.

Optionally a bone name can be specified. If the bone name is not empty the virtual plane corners are relative to the bone. This allows to create desktop input zones which can be displaced.

The behavior can be optionally disabled to allow the input to be available to the player only if certain conditions are fulfilled.

The actor is responsible to move the mouse pointer. This behavior provides convenience methods to do the calculation and updating of the mouse pointer.

A typical usage of this behavior looks like this:

class MyPlayerAction extends BAAFirstPersonVR
public func new()
end
public func void playerThink(float elapsed)
super.think(elapsed)
// Check if right hand controller is pointing at an element
if vrRightHandPointAt.hasVRHandPointAtElement()
// Store the hit element and hit point in world space. Typically you want
// to test them against mulitple supported interactions.
var BehaviorElement element = vrRightHandPointAt.getPointAtBehaviorElement()
var DVector hitPoint = vrRightHandPointAt.getPointAtHitPoint()
// Move mouse on the desktop controller if present in the pointed at element
var ECBehaviorControlDesktop.Instance controlDesktop = ECBehaviorControlDesktop.getInstanceIn(element)
if controlDesktop != null
// The call moveMouse() converts the hit point in world space to desktop
// coordinates. If the world position is outside the desktop area nothing
// is done and false is returned. Otherwise the mouse position is updated
// and true is returned. In this example we stop here if we updated the
// desktop mouse position in case more interactions are check below
if controlDesktop.moveMouse(hitPoint)
return
end
end
// Here you could check for other supported interactions
end
// The same could be done for vrLeftHandPointAt too
end
end
ECBehaviorControlDesktop new(BehaviorElementClass eclass, ECBehaviorRenderableDesktop renderableDesktop)
Create behavior element class.

The same example can be done using ECBehaviorLookAt instead of ECBehaviorVRHandPointAt.

This behavior can be used multiple times for example to control different renderable desktops. Element class properties have the prefix "controlDesktop{(id)}.".

This behavior requires ECBehaviorRenderableDesktop to be present.

This behavior require the element class to be persistable (setPersistable).

Member Function Documentation

◆ dispose()

void Dragengine.Scenery.ECBehaviorControlDesktop.dispose ( )

Dispose of behavior.

Reimplemented from Dragengine.Scenery.DefaultECBehavior.

◆ getBehaviorIn()

static ECBehaviorControlDesktop Dragengine.Scenery.ECBehaviorControlDesktop.getBehaviorIn ( BehaviorElementClass  eclass)
static

Get behavior in element class or null if absent.

Use this method to check if a particular BehaviorElementClass contains a behavior of type ECBehaviorComponent.

◆ getBone()

ECPString Dragengine.Scenery.ECBehaviorControlDesktop.getBone ( )

Bone name or empty string to not use.

◆ getLowerLeft()

ECPVector Dragengine.Scenery.ECBehaviorControlDesktop.getLowerLeft ( )

Virtual plane lower left position.

◆ getLowerRight()

ECPVector Dragengine.Scenery.ECBehaviorControlDesktop.getLowerRight ( )

Virtual plane lower right position.

◆ getRenderableDesktop()

ECBehaviorRenderableDesktop Dragengine.Scenery.ECBehaviorControlDesktop.getRenderableDesktop ( )

Renderable desktop behavior.

◆ getUpperLeft()

ECPVector Dragengine.Scenery.ECBehaviorControlDesktop.getUpperLeft ( )

Virtual plane upper left position.

◆ instance()

Instance Dragengine.Scenery.ECBehaviorControlDesktop.instance ( BehaviorElement  element)

Get instance in element from owner element class.

◆ new() [1/3]

ECBehaviorControlDesktop Dragengine.Scenery.ECBehaviorControlDesktop.new ( BehaviorElementClass  eclass,
ECBehaviorRenderableDesktop  renderableDesktop 
)

Create behavior element class.

◆ new() [2/3]

ECBehaviorControlDesktop Dragengine.Scenery.ECBehaviorControlDesktop.new ( BehaviorElementClass  eclass,
ECBehaviorRenderableDesktop  renderableDesktop,
String  id 
)

◆ new() [3/3]

ECBehaviorControlDesktop Dragengine.Scenery.ECBehaviorControlDesktop.new ( BehaviorElementClass  eclass,
ECBehaviorRenderableDesktop  renderableDesktop,
String  id,
String  prefix 
)

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