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

Base VR Hand action. More...

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

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

Protected Member Functions

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

Protected Attributes

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

Detailed Description

Base VR Hand action.

Action supports the Persistable interface and 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:

References getHandAction(), getHandAnimated(), handAction, and handAnimated.

Referenced by think().

◆ 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.

References handAction, isActive(), and isNotActive().

Referenced by initBehaviors().

◆ applyAnimations()

void Dragengine.Scenery.BaseVRHandAction.applyAnimations ( )
protected

Apply animations.

Default implementation calls these method if the behvaiors are present:

  • ECBehaviorActorAnimated.applyAnimations()

References actor, conversationActor, getConversationActor(), getLocomotion(), handPointAt, initBehaviors(), locomotion, and vrHand.

Referenced by cancel(), initAnimator(), and writeObjectToFile().

◆ cancel()

void Dragengine.Scenery.BaseVRHandAction.cancel ( )

Cancel action the next time possible.

Reimplemented in Dragengine.Scenery.BAAVRHandStateMachine.

References applyAnimations(), handAnimated, and initAnimator().

Referenced by updateAnimator().

◆ collisionResponse()

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

Collision detected.

Reimplemented in Dragengine.Scenery.BAAVRHandStateMachine.

References handAction, handAnimated, handPointAt, and vrHand.

Referenced by writeObjectToFile().

◆ 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.

Reimplemented in Dragengine.Scenery.BAAVRHandStateMachine.

References handAttachSlot, handGrabber, handLaserPointer, handLocomotion, and handPose.

Referenced by writeObjectToFile().

◆ 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.

References handAction.

Referenced by initBehaviors().

◆ dispose()

void Dragengine.Scenery.BaseVRHandAction.dispose ( )

Dispose of actor action.

Reimplemented in Dragengine.Scenery.BAAVRHandStateMachine.

References new().

Referenced by getVRHand().

◆ enteredGameWorld()

void Dragengine.Scenery.BaseVRHandAction.enteredGameWorld ( )

Actor entered game world.

Reimplemented in Dragengine.Scenery.BAAVRHandStateMachine.

References isRightHand(), and pIsRightHand.

Referenced by initBehaviors().

◆ enterFrame()

void Dragengine.Scenery.BaseVRHandAction.enterFrame ( )

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

Reimplemented in Dragengine.Scenery.BAAVRHandStateMachine.

References isLeftHand(), and pIsRightHand.

Referenced by initBehaviors().

◆ getActor()

BehaviorElement Dragengine.Scenery.BaseVRHandAction.getActor ( )

Actor the action is assigned to or null.

References new().

Referenced by getConversationActor().

◆ getConversationActor()

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

Conversation actor behavior if present.

References getActor().

Referenced by applyAnimations(), and getHandPose().

◆ getHandAction()

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

Behavior VR hand action or null.

References getHandLaserPointer(), and handLaserPointer.

Referenced by activate().

◆ getHandAnimated()

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

Hand animated behavior if present.

Referenced by activate().

◆ getHandAttachSlot()

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

Hand Controller Attach Slot.

Referenced by isActive().

◆ getHandGrabber()

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

Hand Controller Grabber.

References getLocomotion(), and locomotion.

Referenced by isRightHand().

◆ getHandLaserPointer()

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

Hand Controller Laser Pointer.

References getVRHand(), and vrHand.

Referenced by getHandAction().

◆ getHandLocomotion()

ECBehaviorVRHandLocomotion.Instance Dragengine.Scenery.BaseVRHandAction.getHandLocomotion ( )

Hand Locomotion.

Version
1.28

References getHandPointAt(), and handPointAt.

Referenced by isLeftHand().

◆ getHandPointAt()

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

Hand Controller Point-At.

References actor.

Referenced by getHandLocomotion().

◆ getHandPose()

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

Hand Pose.

References conversationActor, and getConversationActor().

Referenced by isLeftHand().

◆ getLocomotion()

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

Locomotion behavior.

Referenced by applyAnimations(), and getHandGrabber().

◆ getVRHand()

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

VR hand behavior the action is assigned to or null.

References actor, and dispose().

Referenced by getHandLaserPointer().

◆ 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:84
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)
Animator instance.
Definition AnimatorInstance.ds:25
void setAnimator(Animator animator)
Set animator or null if not set.
Animator resources.
Definition Animator.ds:36
BehaviorElement getActor()
Actor the action is assigned to or null.
ECBehaviorLocomotion.Instance locomotion
Locomotion behavior.
Definition BaseVRHandAction.ds:60
Locomotion.
Definition Locomotion.ds:36

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.

References applyAnimations(), postThink(), and updateAnimator().

Referenced by cancel(), and writeObjectToFile().

◆ initBehaviors()

void Dragengine.Scenery.BaseVRHandAction.initBehaviors ( )
protected

Init behaviors.

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

Reimplemented in Dragengine.Scenery.BAAVRHandStateMachine.

References activateWhileLoading(), actor, deactivate(), enteredGameWorld(), enterFrame(), initBehaviors(), leftGameWorld(), pIsRightHand, playerReleasesControl(), playerTakesControl(), think(), and vrHand.

Referenced by applyAnimations(), initBehaviors(), and postThink().

◆ isActive()

bool Dragengine.Scenery.BaseVRHandAction.isActive ( )

◆ isLeftHand()

bool Dragengine.Scenery.BaseVRHandAction.isLeftHand ( )

Action is left hand.

References getHandLocomotion(), getHandPose(), handLocomotion, and handPose.

Referenced by enterFrame().

◆ isNotActive()

bool Dragengine.Scenery.BaseVRHandAction.isNotActive ( )

Action is not active hand action.

References handAttachSlot.

Referenced by activateWhileLoading().

◆ isRightHand()

bool Dragengine.Scenery.BaseVRHandAction.isRightHand ( )

Action is right hand.

References getHandGrabber(), and handGrabber.

Referenced by enteredGameWorld().

◆ leftGameWorld()

void Dragengine.Scenery.BaseVRHandAction.leftGameWorld ( )

Actor left game world.

Reimplemented in Dragengine.Scenery.BAAVRHandStateMachine.

Referenced by initBehaviors().

◆ log() [1/6]

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

Log text about element to console prefixed with actor information.

References conversationActor, and locomotion.

◆ log() [2/6]

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

Log exception to console prefixed with actor information.

References handAction, handAnimated, handAttachSlot, handGrabber, handLaserPointer, handLocomotion, and handPose.

◆ log() [3/6]

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

Log text to console prefixed with actor information.

References handAnimated, handLocomotion, and handPose.

◆ log() [4/6]

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

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

References handAction.

◆ log() [5/6]

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

Log exception to BaseGameApp console prefixed with actor information.

References handPointAt, and vrHand.

◆ log() [6/6]

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

Log text to BaseGameApp console prefixed with actor information.

References handAttachSlot, handGrabber, and handLaserPointer.

Referenced by writeObjectToFile().

◆ loggingPrefix()

String Dragengine.Scenery.BaseVRHandAction.loggingPrefix ( )

Logging prefix.

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

References handAction, handAnimated, handAttachSlot, handGrabber, handLaserPointer, handLocomotion, handPointAt, and handPose.

Referenced by writeObjectToFile().

◆ new() [1/2]

BaseVRHandAction Dragengine.Scenery.BaseVRHandAction.new ( )

Create actor action.

Reimplemented in Dragengine.Scenery.BAAVRHandStateMachine.

References handAction, and pIsRightHand.

Referenced by dispose(), and getActor().

◆ new() [2/2]

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

Create actor action from persisted state.

Reimplemented in Dragengine.Scenery.BAAVRHandStateMachine.

◆ 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.

Reimplemented in Dragengine.Scenery.BAAVRHandStateMachine.

Referenced by writeObjectToFile().

◆ playerReleasesControl()

void Dragengine.Scenery.BaseVRHandAction.playerReleasesControl ( )

Player released control of actor.

Reimplemented in Dragengine.Scenery.BAAVRHandStateMachine.

Referenced by initBehaviors().

◆ playerTakesControl()

void Dragengine.Scenery.BaseVRHandAction.playerTakesControl ( )

Player takes control of actor.

Reimplemented in Dragengine.Scenery.BAAVRHandStateMachine.

Referenced by initBehaviors().

◆ postThink()

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

Post physics.

Reimplemented in Dragengine.Scenery.BAAVRHandStateMachine.

References initBehaviors(), pIsRightHand, and vrHand.

Referenced by initAnimator().

◆ think()

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

Thinking.

Default implementation does these actions in this order:

Reimplemented in Dragengine.Scenery.BAAVRHandStateMachine.

References activate(), and actor.

Referenced by initBehaviors().

◆ 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()

References cancel().

Referenced by initAnimator(), and writeObjectToFile().

◆ writeObjectToFile()

Member Data Documentation

◆ actor

◆ conversationActor

ECBehaviorConversationActor.Instance Dragengine.Scenery.BaseVRHandAction.conversationActor
protected

Conversation actor behavior if present.

Referenced by applyAnimations(), getHandPose(), and log().

◆ handAction

ECBehaviorVRHandAction.Instance Dragengine.Scenery.BaseVRHandAction.handAction
protected

Behavior VR hand action or null.

Referenced by activate(), activateWhileLoading(), collisionResponse(), deactivate(), log(), log(), loggingPrefix(), and new().

◆ handAnimated

ECBehaviorActorAnimated.Instance Dragengine.Scenery.BaseVRHandAction.handAnimated
protected

Hand animated behavior if present.

Referenced by activate(), cancel(), collisionResponse(), log(), log(), loggingPrefix(), and writeObjectToFile().

◆ handAttachSlot

ECBehaviorAttachSlot.Instance Dragengine.Scenery.BaseVRHandAction.handAttachSlot
protected

Hand Controller Attach Slot behavior.

Referenced by conversationWait(), isNotActive(), log(), log(), and loggingPrefix().

◆ handGrabber

ECBehaviorGrabber.Instance Dragengine.Scenery.BaseVRHandAction.handGrabber
protected

Hand Controller Grabber behavior.

Referenced by conversationWait(), isRightHand(), log(), log(), and loggingPrefix().

◆ handLaserPointer

ECBehaviorVRHandLaserPointer.Instance Dragengine.Scenery.BaseVRHandAction.handLaserPointer
protected

Hand Controller Laser Pointer behavior.

Referenced by conversationWait(), getHandAction(), log(), log(), and loggingPrefix().

◆ handLocomotion

ECBehaviorVRHandLocomotion.Instance Dragengine.Scenery.BaseVRHandAction.handLocomotion
protected

Hand Locomotion behavior.

Referenced by conversationWait(), isLeftHand(), log(), log(), and loggingPrefix().

◆ handPointAt

ECBehaviorVRHandPointAt.Instance Dragengine.Scenery.BaseVRHandAction.handPointAt
protected

Hand Controller Point-At behavior.

Referenced by applyAnimations(), collisionResponse(), getHandLocomotion(), log(), and loggingPrefix().

◆ handPose

ECBehaviorVRHandPose.Instance Dragengine.Scenery.BaseVRHandAction.handPose
protected

Hand Pose behavior.

Referenced by conversationWait(), isLeftHand(), log(), log(), loggingPrefix(), and writeObjectToFile().

◆ locomotion

ECBehaviorLocomotion.Instance Dragengine.Scenery.BaseVRHandAction.locomotion
protected

Locomotion behavior.

Referenced by applyAnimations(), getHandGrabber(), and log().

◆ pIsRightHand

bool Dragengine.Scenery.BaseVRHandAction.pIsRightHand
protected

◆ vrHand

ECBehaviorVRHand.Instance Dragengine.Scenery.BaseVRHandAction.vrHand
protected

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