Drag[en]gine Script Module DragonScript  1.21
Dragengine.Scenery.BaseVRHandAction Class Reference

Base VR Hand action. More...

Inheritance diagram for Dragengine.Scenery.BaseVRHandAction:
Dragengine.LoadSave.Persistable

Classes

class  Factory
 Factory for loading actor actions. More...
 

Public Member Functions

void activate (BehaviorElement actor, ECBehaviorVRHand.Instance vrHand)
 Action has been set as active hand action. More...
 
void activateWhileLoading (BehaviorElement actor, ECBehaviorVRHand.Instance vrHand)
 Action has been set as active action in an actor while loading. More...
 
void cancel ()
 Cancel action the next time possible. More...
 
void collisionResponse (Collider owner, CollisionInfo info)
 Collision detected. More...
 
bool conversationWait ()
 Check if conversation actions have to wait for actor to finish this action. More...
 
void deactivate ()
 Action has been unset as active hand action. More...
 
void dispose ()
 Dispose of actor action. More...
 
void enteredGameWorld ()
 Actor entered game world. More...
 
void enterFrame ()
 Actor has been added to game world and enterFrame() is called once. More...
 
BehaviorElement getActor ()
 Actor the action is assigned to or null. More...
 
ECBehaviorConversationActor.Instance getConversationActor ()
 Conversation actor behavior if present. More...
 
ECBehaviorVRHandAction.Instance getHandAction ()
 Behavior VR hand action or null. More...
 
ECBehaviorActorAnimated.Instance getHandAnimated ()
 Hand animated behavior if present. More...
 
ECBehaviorAttachSlot.Instance getHandAttachSlot ()
 Hand Controller Attach Slot. More...
 
ECBehaviorGrabber.Instance getHandGrabber ()
 Hand Controller Grabber. More...
 
ECBehaviorVRHandLaserPointer.Instance getHandLaserPointer ()
 Hand Controller Laser Pointer. More...
 
ECBehaviorVRHandPointAt.Instance getHandPointAt ()
 Hand Controller Point-At. More...
 
ECBehaviorVRHandPose.Instance getHandPose ()
 Hand Pose. More...
 
ECBehaviorLocomotion.Instance getLocomotion ()
 Locomotion behavior. More...
 
ECBehaviorVRHand.Instance getVRHand ()
 VR hand behavior the action is assigned to or null. More...
 
bool isActive ()
 Action is active hand action. More...
 
bool isLeftHand ()
 Action is left hand. More...
 
bool isNotActive ()
 Action is not active hand action. More...
 
bool isRightHand ()
 Action is right hand. More...
 
void leftGameWorld ()
 Actor left game world. More...
 
void log (Console console, Element element, String text)
 Log text about element to console prefixed with actor information. More...
 
void log (Console console, Exception exception)
 Log exception to console prefixed with actor information. More...
 
void log (Console console, String text)
 Log text to console prefixed with actor information. More...
 
void log (Element element, String text)
 Log text about element to BaseGameApp console prefixed with actor information. More...
 
void log (Exception exception)
 Log exception to BaseGameApp console prefixed with actor information. More...
 
void log (String text)
 Log text to BaseGameApp console prefixed with actor information. More...
 
String loggingPrefix ()
 Logging prefix. More...
 
BaseVRHandAction new ()
 Create actor action. More...
 
BaseVRHandAction new (PersistencyEnvironment env, FileReader reader)
 Create actor action from persisted state. More...
 
String persistencyFactoryName ()
 Name of PersistencyFactory required to load object from file. More...
 
void playerReleasesControl ()
 Player released control of actor. More...
 
void playerTakesControl ()
 Player takes control of actor. More...
 
void postThink (float elapsed)
 Post physics. More...
 
void think (float elapsed)
 Thinking. More...
 
void writeObjectToFile (PersistencyEnvironment env, FileWriter writer)
 Write object to file writer. More...
 

Protected Member Functions

void applyAnimations ()
 Apply animations. More...
 
void initAnimator ()
 Initialize animator. More...
 
void initBehaviors ()
 Init behaviors. More...
 
void updateAnimator (float elapsed)
 Update animator controllers. More...
 

Protected Attributes

BehaviorElement actor
 Actor the action is assigned to or null. More...
 
ECBehaviorConversationActor.Instance conversationActor
 Conversation actor behavior if present. More...
 
ECBehaviorVRHandAction.Instance handAction
 Behavior VR hand action or null. More...
 
ECBehaviorActorAnimated.Instance handAnimated
 Hand animated behavior if present. More...
 
ECBehaviorAttachSlot.Instance handAttachSlot
 Hand Controller Attach Slot behavior. More...
 
ECBehaviorGrabber.Instance handGrabber
 Hand Controller Grabber behavior. More...
 
ECBehaviorVRHandLaserPointer.Instance handLaserPointer
 Hand Controller Laser Pointer behavior. More...
 
ECBehaviorVRHandPointAt.Instance handPointAt
 Hand Controller Point-At behavior. More...
 
ECBehaviorVRHandPose.Instance handPose
 Hand Animated Pose behavior. More...
 
ECBehaviorLocomotion.Instance locomotion
 Locomotion behavior. More...
 
ECBehaviorVRHand.Instance vrHand
 VR hand the action is assigned to or null. More...
 

Detailed Description

Base VR Hand action.

Action supports the Persistable interface an can be read from and writen to file writers.

Member Function Documentation

◆ activate()

void Dragengine.Scenery.BaseVRHandAction.activate ( BehaviorElement  actor,
ECBehaviorVRHand.Instance  vrHand 
)

Action has been set as active hand action.

Stores the actor and VR hand behavior and calls initAnimator() and ECBehaviorActorAnimated.applyAnimations().

Calls these hook methods:

◆ activateWhileLoading()

void Dragengine.Scenery.BaseVRHandAction.activateWhileLoading ( BehaviorElement  actor,
ECBehaviorVRHand.Instance  vrHand 
)

Action has been set as active action in an actor while loading.

Similar to activate(BehaviorElement,ECBehaviorVRHand.Instance) but only stores the actor and VR hand behavior and calls initBehaviors(). This is required since while loading behaviors load their state and actions load their states. If activate(BehaviorElement,ECBehaviorVRHand.Instance) is called these states would be reset to initial values.

◆ applyAnimations()

void Dragengine.Scenery.BaseVRHandAction.applyAnimations ( )
protected

Apply animations.

Default implementation calls these method if the behvaiors are present:

  • ECBehaviorActorAnimated.applyAnimations()

◆ cancel()

void Dragengine.Scenery.BaseVRHandAction.cancel ( )

Cancel action the next time possible.

◆ collisionResponse()

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

Collision detected.

◆ conversationWait()

bool Dragengine.Scenery.BaseVRHandAction.conversationWait ( )

Check if conversation actions have to wait for actor to finish this action.

BaseActor adds a listener to ECBehaviorConversationActor using conversationWait() to answer waiting queries by conversation scripts.

The default implementation returns false which equals no waiting required.

◆ deactivate()

void Dragengine.Scenery.BaseVRHandAction.deactivate ( )

Action has been unset as active hand action.

The stored actor is not cleared to avoid problems while cleaning up.

◆ dispose()

void Dragengine.Scenery.BaseVRHandAction.dispose ( )

Dispose of actor action.

◆ enteredGameWorld()

void Dragengine.Scenery.BaseVRHandAction.enteredGameWorld ( )

Actor entered game world.

◆ enterFrame()

void Dragengine.Scenery.BaseVRHandAction.enterFrame ( )

Actor has been added to game world and enterFrame() is called once.

◆ getActor()

BehaviorElement Dragengine.Scenery.BaseVRHandAction.getActor ( )

Actor the action is assigned to or null.

◆ getConversationActor()

ECBehaviorConversationActor.Instance Dragengine.Scenery.BaseVRHandAction.getConversationActor ( )

Conversation actor behavior if present.

◆ getHandAction()

ECBehaviorVRHandAction.Instance Dragengine.Scenery.BaseVRHandAction.getHandAction ( )

Behavior VR hand action or null.

◆ getHandAnimated()

ECBehaviorActorAnimated.Instance Dragengine.Scenery.BaseVRHandAction.getHandAnimated ( )

Hand animated behavior if present.

◆ getHandAttachSlot()

ECBehaviorAttachSlot.Instance Dragengine.Scenery.BaseVRHandAction.getHandAttachSlot ( )

Hand Controller Attach Slot.

◆ getHandGrabber()

ECBehaviorGrabber.Instance Dragengine.Scenery.BaseVRHandAction.getHandGrabber ( )

Hand Controller Grabber.

◆ getHandLaserPointer()

ECBehaviorVRHandLaserPointer.Instance Dragengine.Scenery.BaseVRHandAction.getHandLaserPointer ( )

Hand Controller Laser Pointer.

◆ getHandPointAt()

ECBehaviorVRHandPointAt.Instance Dragengine.Scenery.BaseVRHandAction.getHandPointAt ( )

Hand Controller Point-At.

◆ getHandPose()

ECBehaviorVRHandPose.Instance Dragengine.Scenery.BaseVRHandAction.getHandPose ( )

Hand Pose.

◆ getLocomotion()

ECBehaviorLocomotion.Instance Dragengine.Scenery.BaseVRHandAction.getLocomotion ( )

Locomotion behavior.

◆ getVRHand()

ECBehaviorVRHand.Instance Dragengine.Scenery.BaseVRHandAction.getVRHand ( )

VR hand behavior the action is assigned to or null.

◆ initAnimator()

void Dragengine.Scenery.BaseVRHandAction.initAnimator ( )
protected

Initialize animator.

Overwrite to change animator to use for this actor.

Default implementation does nothing.

Using ECBehaviorActorAnimated

Call setActiveAnimatorID() with the identifier of the desired animator as set up in the "handAnimated.animators" element class property. If you set up controller mappings using handAnimated.setDefaultControllerMappings() or manually you can stop here since controller mappings are automatically updated. By default BaseActorClass does calls setDefaultControllerMappings().

A typical implementation can look like this:

handAnimated.setActiveAnimatorID("default")
ECBehaviorActorAnimated.Instance handAnimated
Hand animated behavior if present.
Definition: BaseVRHandAction.ds:78
Manually handling AnimatorInstance and Animator

If you change the animator you should usually also change the locomotion controller mappings to automatically animate them unless you plan to do it manually.

A typical implementation can look like this:

var Animator animator = ... // animator you would like to set
var AnimatorInstance ainst = ... // animator instance created and handled by yourself
ainst.setAnimator(animator)
var Locomotion locomotion = getActor().getLocomotion()
locomotion.removeAllControllerMappings()
locomotion.addControllerMapping(ainst.getControllerAt(0), Locomotion.ATTR_ELAPSED_TIME)
locomotion.addControllerMapping(ainst.getControllerAt(1), Locomotion.ATTR_DISPLACEMENT)
locomotion.addControllerMapping(ainst.getControllerAt(2), Locomotion.ATTR_LOOK_HORIZONTAL)
locomotion.addControllerMapping(ainst.getControllerAt(3), Locomotion.ATTR_LOOK_VERTICAL)
BehaviorElement getActor()
Actor the action is assigned to or null.
ECBehaviorLocomotion.Instance locomotion
Locomotion behavior.
Definition: BaseVRHandAction.ds:57

This example code sets an animator which is known to have 4 controllers. The mappings are set to automatically update the controllers with values matching their use. In this case the first controller is playback while actor is not moving. The second controller is playback while actor is walking. Using ATTR_DISPLACEMENT uses the distance moved by the actor as controller value. Using distance avoids feet shuffling and works well with variable movement speeds. The other two controllers affect the direction the actor is looking.

◆ initBehaviors()

void Dragengine.Scenery.BaseVRHandAction.initBehaviors ( )
protected

Init behaviors.

Retrieve and store required and optional behavior instances from the actor element.

◆ isActive()

bool Dragengine.Scenery.BaseVRHandAction.isActive ( )

Action is active hand action.

◆ isLeftHand()

bool Dragengine.Scenery.BaseVRHandAction.isLeftHand ( )

Action is left hand.

◆ isNotActive()

bool Dragengine.Scenery.BaseVRHandAction.isNotActive ( )

Action is not active hand action.

◆ isRightHand()

bool Dragengine.Scenery.BaseVRHandAction.isRightHand ( )

Action is right hand.

◆ leftGameWorld()

void Dragengine.Scenery.BaseVRHandAction.leftGameWorld ( )

Actor left game world.

◆ log() [1/6]

void Dragengine.Scenery.BaseVRHandAction.log ( Console  console,
Element  element,
String  text 
)

Log text about element to console prefixed with actor information.

◆ log() [2/6]

void Dragengine.Scenery.BaseVRHandAction.log ( Console  console,
Exception  exception 
)

Log exception to console prefixed with actor information.

◆ log() [3/6]

void Dragengine.Scenery.BaseVRHandAction.log ( Console  console,
String  text 
)

Log text to console prefixed with actor information.

◆ log() [4/6]

void Dragengine.Scenery.BaseVRHandAction.log ( Element  element,
String  text 
)

Log text about element to BaseGameApp console prefixed with actor information.

◆ log() [5/6]

void Dragengine.Scenery.BaseVRHandAction.log ( Exception  exception)

Log exception to BaseGameApp console prefixed with actor information.

◆ log() [6/6]

void Dragengine.Scenery.BaseVRHandAction.log ( String  text)

Log text to BaseGameApp console prefixed with actor information.

◆ loggingPrefix()

String Dragengine.Scenery.BaseVRHandAction.loggingPrefix ( )

Logging prefix.

Returns string in the form "<actor-class>/<action-class>".

◆ new() [1/2]

BaseVRHandAction Dragengine.Scenery.BaseVRHandAction.new ( )

Create actor action.

◆ new() [2/2]

BaseVRHandAction Dragengine.Scenery.BaseVRHandAction.new ( PersistencyEnvironment  env,
FileReader  reader 
)

Create actor action from persisted state.

◆ persistencyFactoryName()

String Dragengine.Scenery.BaseVRHandAction.persistencyFactoryName ( )

Name of PersistencyFactory required to load object from file.

Name of PersistencyFactory is first written to the file as string with 8-bit length. Then writeToFile() is called to write the object itself. Empty name is not allowed as is names longer than 255 characters. Name has to match a PersistencyFactory present in the Persistency instance used for loading objects. Object is read using PersistencyFactory.readObjectFromFile() of the matching PersistencyFactory.

Implements Dragengine.LoadSave.Persistable.

◆ playerReleasesControl()

void Dragengine.Scenery.BaseVRHandAction.playerReleasesControl ( )

Player released control of actor.

◆ playerTakesControl()

void Dragengine.Scenery.BaseVRHandAction.playerTakesControl ( )

Player takes control of actor.

◆ postThink()

void Dragengine.Scenery.BaseVRHandAction.postThink ( float  elapsed)

Post physics.

◆ think()

void Dragengine.Scenery.BaseVRHandAction.think ( float  elapsed)

Thinking.

Default implementation does these actions in this order:

◆ updateAnimator()

void Dragengine.Scenery.BaseVRHandAction.updateAnimator ( float  elapsed)
protected

Update animator controllers.

Default implementation calls these method if the behvaiors are present:

  • ECBehaviorLocomotion.updateAnimator()
  • ECBehaviorActorAnimated.notifyControllersChanged()

◆ writeObjectToFile()

void Dragengine.Scenery.BaseVRHandAction.writeObjectToFile ( PersistencyEnvironment  env,
FileWriter  writer 
)

Write object to file writer.

Implements Dragengine.LoadSave.Persistable.

Member Data Documentation

◆ actor

BehaviorElement Dragengine.Scenery.BaseVRHandAction.actor
protected

Actor the action is assigned to or null.

◆ conversationActor

ECBehaviorConversationActor.Instance Dragengine.Scenery.BaseVRHandAction.conversationActor
protected

Conversation actor behavior if present.

◆ handAction

ECBehaviorVRHandAction.Instance Dragengine.Scenery.BaseVRHandAction.handAction
protected

Behavior VR hand action or null.

◆ handAnimated

ECBehaviorActorAnimated.Instance Dragengine.Scenery.BaseVRHandAction.handAnimated
protected

Hand animated behavior if present.

◆ handAttachSlot

ECBehaviorAttachSlot.Instance Dragengine.Scenery.BaseVRHandAction.handAttachSlot
protected

Hand Controller Attach Slot behavior.

◆ handGrabber

ECBehaviorGrabber.Instance Dragengine.Scenery.BaseVRHandAction.handGrabber
protected

Hand Controller Grabber behavior.

◆ handLaserPointer

ECBehaviorVRHandLaserPointer.Instance Dragengine.Scenery.BaseVRHandAction.handLaserPointer
protected

Hand Controller Laser Pointer behavior.

◆ handPointAt

ECBehaviorVRHandPointAt.Instance Dragengine.Scenery.BaseVRHandAction.handPointAt
protected

Hand Controller Point-At behavior.

◆ handPose

ECBehaviorVRHandPose.Instance Dragengine.Scenery.BaseVRHandAction.handPose
protected

Hand Animated Pose behavior.

◆ locomotion

ECBehaviorLocomotion.Instance Dragengine.Scenery.BaseVRHandAction.locomotion
protected

Locomotion behavior.

◆ vrHand

ECBehaviorVRHand.Instance Dragengine.Scenery.BaseVRHandAction.vrHand
protected

VR hand the action is assigned to or null.


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