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

Base actor action with movement support for vehicle actors. More...

Inheritance diagram for Dragengine.Scenery.BAAVehicle:
Dragengine.Scenery.BaseActorAction Dragengine.Scenery.BAAMovement Dragengine.LoadSave.Persistable

Classes

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

Public Member Functions

void activate (BehaviorElement actor)
 Action has been set as active action in an actor. More...
 
void analogLookLR (float amount, bool sticky)
 Analog looking left/right. More...
 
void analogLookUD (float amount, bool sticky)
 Analog looking up/down. More...
 
void analogMoveFB (float amount, bool sticky)
 Analog moving forward/backward. More...
 
void analogMoveLR (float amount, bool sticky)
 Analog moving left/right. More...
 
bool canHitCollider (Collider owner, Collider collider)
 Two colliders can hit each other. More...
 
void colliderChanged (Collider owner)
 Collider changed. More...
 
void collisionResponse (Collider owner, CollisionInfo info)
 Collision detected. More...
 
void crouchStart ()
 Start crouching. More...
 
void crouchStop ()
 Stop crouching. More...
 
void crouchToggle ()
 Toggle crouching. More...
 
ECBehaviorActorMover.Instance getActorMover ()
 Actor mover behavior. More...
 
ECBehaviorColliderAI.Instance getColliderAI ()
 Collider AI. More...
 
ECBehaviorFootSteps.Instance getFootSteps ()
 Foot steps behavior. More...
 
float getLandingAngle ()
 Angle in degrees between falling direction and ground normal to land. More...
 
ECBehaviorPlayerInputLook.Instance getPlayerInputLook ()
 Player input looking around. More...
 
ECBehaviorPlayerInputMove.Instance getPlayerInputMove ()
 Player input moving. More...
 
ECBehaviorPlayerInputTurn.Instance getPlayerInputTurn ()
 Player input turning. More...
 
ECBehaviorProjectToGround.Instance getProjectToGround ()
 Project to ground. More...
 
void lookDownStart ()
 Start looking down. More...
 
void lookDownStop ()
 Stop looking down. More...
 
void lookLeftStart ()
 Start looking left. More...
 
void lookLeftStop ()
 Stop looking left. More...
 
void lookRightStart ()
 Start looking right. More...
 
void lookRightStop ()
 Stop looking right. More...
 
void lookUpStart ()
 Start looking up. More...
 
void lookUpStop ()
 Stop looking up. More...
 
void moveBackwardStart ()
 Start moving backward. More...
 
void moveBackwardStop ()
 Stop moving backward. More...
 
void moveForwardStart ()
 Start moving forward. More...
 
void moveForwardStop ()
 Stop moving forward. More...
 
void moveLeftStart ()
 Start moving left. More...
 
void moveLeftStop ()
 Stop moving left. More...
 
void moveRightStart ()
 Start moving right. More...
 
void moveRightStop ()
 Stop moving right. More...
 
BAAVehicle new ()
 Create actor action. 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 playerThink (float elapsed)
 Thinking for player controlled actor only. More...
 
void postThink (float elapsed)
 Post physics. More...
 
void runStart ()
 Start running. More...
 
void runStop ()
 Stop running. More...
 
void runToggle ()
 Toggle running. More...
 
void setLandingAngle (float angle)
 Set angle in degrees between falling direction and ground normal to land. More...
 
void think (float elapsed)
 Thinking. More...
 
- Public Member Functions inherited from Dragengine.Scenery.BaseActorAction
void activateWhileLoading (BehaviorElement actor)
 Action has been set as active action in an actor while loading. More...
 
void aiFailed ()
 Notify actor AI this action failed. More...
 
void aiFinished ()
 Notify actor AI this action failed. More...
 
void cancel ()
 Cancel action the next time possible. 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 action in an actor. 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...
 
ECBehaviorActorAnimated.Instance getActorAnimated ()
 Actor animated behavior if present. More...
 
ECBehaviorActorAIAction.Instance getAIAction ()
 Behavior actor ai-action or null. More...
 
ECBehaviorConversationActor.Instance getConversationActor ()
 Conversation actor behavior if present. More...
 
ECBehaviorLocomotion.Instance getLocomotion ()
 Locomotion behavior. More...
 
ECBehaviorPlayerControllable.Instance getPlayerControllable ()
 Behavior player controllable or null. More...
 
bool isActive ()
 Action is active actor action. More...
 
bool isControlledByPlayer ()
 Actor is controlled by player. More...
 
bool isNotActive ()
 Action is not active actor action. 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...
 
BaseActorAction new (PersistencyEnvironment env, FileReader reader)
 Create actor action from persisted state. More...
 
void playerPostThink (float elapsed)
 Post physics for player controlled actor only. More...
 
void writeObjectToFile (PersistencyEnvironment env, FileWriter writer)
 Write object to file writer. More...
 

Protected Member Functions

void applyLookAroundChanges (float deltaHorizontal, float deltaVertical)
 Apply looking around changes. More...
 
bool doesActorLand (Collider owner, CollisionInfo info)
 Free falling actor is landing. More...
 
void doTurnLook (float elapsed)
 Apply turning and looking around. More...
 
void initBehaviors ()
 Init behaviors. More...
 
void initLocomotion ()
 Initialize locomotion. More...
 
void initPlayerInput ()
 Initialize player input tracker. More...
 
void playerUpdateLocomotion (float elapsed)
 Update locomotion. More...
 
void updateAICollider (float elapsed)
 Update collider. More...
 
void updateLocomotion (float elapsed)
 Update locomotion. More...
 
void updateLocomotionPost (float elapsed)
 Post-Update locomotion. More...
 
- Protected Member Functions inherited from Dragengine.Scenery.BaseActorAction
void applyAnimations ()
 Apply animations. More...
 
void initAnimator ()
 Initialize animator. More...
 
void updateAnimator (float elapsed)
 Update animator controllers. More...
 

Protected Attributes

ECBehaviorActorMover.Instance actorMover
 Actor mover behavior. More...
 
ECBehaviorColliderAI.Instance colliderAI
 Collider AI Behavior. More...
 
ECBehaviorFootSteps.Instance footSteps
 Foot steps behavior. More...
 
bool moveIfColliderChanged
 Property update actor geometry on collider changed. More...
 
ECBehaviorPlayerInputLook.Instance playerInputLook
 Player input looking behavior. More...
 
ECBehaviorPlayerInputMove.Instance playerInputMove
 Player input moving behavior. More...
 
ECBehaviorPlayerInputTurn.Instance playerInputTurn
 Player input turning behavior. More...
 
ECBehaviorProjectToGround.Instance projectToGround
 Project to ground behavior. More...
 
- Protected Attributes inherited from Dragengine.Scenery.BaseActorAction
BehaviorElement actor
 Actor the action is assigned to or null. More...
 
ECBehaviorActorAnimated.Instance actorAnimated
 Actor animated behavior if present. More...
 
ECBehaviorActorAIAction.Instance aiAction
 Behavior actor ai-action or null. More...
 
ECBehaviorConversationActor.Instance conversationActor
 Conversation actor behavior if present. More...
 
ECBehaviorLocomotion.Instance locomotion
 Locomotion behavior. More...
 
ECBehaviorPlayerControllable.Instance playerControllable
 Behavior player controllable or null. More...
 

Detailed Description

Base actor action with movement support for vehicle actors.

This class adds movement support to the basic actor action. The movement can be manipulated by the player through input bindings. The supported movement is similar to vehicle oriented actor control with 2-way movement, turning and looking around. This serves as a basis for adding interaction support ontop of movement support.

All binding called methods store the activated state in the PlayerInput* assigned to the actor. This allows both AI and bindings to control the actor movement with one code.

The move* methods are activated by pressing keys or buttons. They move the actor forward and backward as well as turning left and right.

The look* methods are activated by pressing keys or buttons. They adjust the looking direction of the actor without rotating the actor.

The analog* methods are activated by moving mouse or gamepad axes. They are the analog counterpart of the respective move* or look* methods discussed above.

All move*, look* and analog* methods modify only the PlayerInput assigned to the actor. During think() the desired input is applied to the Locomotion assigned to the actor. The result is then applied to the actor as the movement for this frame update.

This class provides vehicle collision handling. This simple stops moving the actor if touching an obstacle but still allows turning.

Requires actor behavior element to contain these behaviors:

Member Function Documentation

◆ activate()

void Dragengine.Scenery.BAAVehicle.activate ( BehaviorElement  actor)

Action has been set as active action in an actor.

Calls these hook methods in addition to BaseActorAction.activate():

Reimplemented from Dragengine.Scenery.BaseActorAction.

◆ analogLookLR()

void Dragengine.Scenery.BAAVehicle.analogLookLR ( float  amount,
bool  sticky 
)

Analog looking left/right.

Implements Dragengine.Scenery.BAAMovement.

◆ analogLookUD()

void Dragengine.Scenery.BAAVehicle.analogLookUD ( float  amount,
bool  sticky 
)

Analog looking up/down.

Implements Dragengine.Scenery.BAAMovement.

◆ analogMoveFB()

void Dragengine.Scenery.BAAVehicle.analogMoveFB ( float  amount,
bool  sticky 
)

Analog moving forward/backward.

Implements Dragengine.Scenery.BAAMovement.

◆ analogMoveLR()

void Dragengine.Scenery.BAAVehicle.analogMoveLR ( float  amount,
bool  sticky 
)

Analog moving left/right.

Implements Dragengine.Scenery.BAAMovement.

◆ applyLookAroundChanges()

void Dragengine.Scenery.BAAVehicle.applyLookAroundChanges ( float  deltaHorizontal,
float  deltaVertical 
)
protected

Apply looking around changes.

Called for player controlled actors only.

◆ canHitCollider()

bool Dragengine.Scenery.BAAVehicle.canHitCollider ( Collider  owner,
Collider  collider 
)

Two colliders can hit each other.

Returns always true.

Reimplemented from Dragengine.Scenery.BaseActorAction.

◆ colliderChanged()

void Dragengine.Scenery.BAAVehicle.colliderChanged ( Collider  owner)

Collider changed.

Reimplemented from Dragengine.Scenery.BaseActorAction.

◆ collisionResponse()

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

Collision detected.

If actor is touching ground applies sliding collision response. Otherwise checks if actor impacts with the ground at opposite direction than the project to ground test direction enable projecting to ground again.

Reimplemented from Dragengine.Scenery.BaseActorAction.

◆ crouchStart()

void Dragengine.Scenery.BAAVehicle.crouchStart ( )

Start crouching.

Implements Dragengine.Scenery.BAAMovement.

◆ crouchStop()

void Dragengine.Scenery.BAAVehicle.crouchStop ( )

Stop crouching.

Implements Dragengine.Scenery.BAAMovement.

◆ crouchToggle()

void Dragengine.Scenery.BAAVehicle.crouchToggle ( )

Toggle crouching.

Implements Dragengine.Scenery.BAAMovement.

◆ doesActorLand()

bool Dragengine.Scenery.BAAVehicle.doesActorLand ( Collider  owner,
CollisionInfo  info 
)
protected

Free falling actor is landing.

Called during collisionResponse() to check if the actor has to switch from free falling to moving on ground again.

Default implementation returns true if the angle between the falling direction and the ground hit normal is larger than the landing angle.

◆ doTurnLook()

void Dragengine.Scenery.BAAVehicle.doTurnLook ( float  elapsed)
protected

Apply turning and looking around.

Called for player controlled actors only. If ECBehaviorActorMover has a goal set does nothing to not interfere.

◆ getActorMover()

ECBehaviorActorMover.Instance Dragengine.Scenery.BAAVehicle.getActorMover ( )

Actor mover behavior.

◆ getColliderAI()

ECBehaviorColliderAI.Instance Dragengine.Scenery.BAAVehicle.getColliderAI ( )

Collider AI.

◆ getFootSteps()

ECBehaviorFootSteps.Instance Dragengine.Scenery.BAAVehicle.getFootSteps ( )

Foot steps behavior.

◆ getLandingAngle()

float Dragengine.Scenery.BAAVehicle.getLandingAngle ( )

Angle in degrees between falling direction and ground normal to land.

◆ getPlayerInputLook()

ECBehaviorPlayerInputLook.Instance Dragengine.Scenery.BAAVehicle.getPlayerInputLook ( )

Player input looking around.

◆ getPlayerInputMove()

ECBehaviorPlayerInputMove.Instance Dragengine.Scenery.BAAVehicle.getPlayerInputMove ( )

Player input moving.

◆ getPlayerInputTurn()

ECBehaviorPlayerInputTurn.Instance Dragengine.Scenery.BAAVehicle.getPlayerInputTurn ( )

Player input turning.

◆ getProjectToGround()

ECBehaviorProjectToGround.Instance Dragengine.Scenery.BAAVehicle.getProjectToGround ( )

Project to ground.

◆ initBehaviors()

void Dragengine.Scenery.BAAVehicle.initBehaviors ( )
protected

Init behaviors.

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

Reimplemented from Dragengine.Scenery.BaseActorAction.

◆ initLocomotion()

void Dragengine.Scenery.BAAVehicle.initLocomotion ( )
protected

Initialize locomotion.

Set ECBehaviorLocomotion.initVehicle().

Sets these initial parameters:

  • Can turn: yes
  • Can turn in-place: yes
  • Linear velocity adjust range: ECBehaviorPlayerInputMove.getSpeedWalk()
  • Linear velocity adjust time: 0.5
  • Moving left right adjust time: 0
  • Looking limits: -80..80 (up-down) and -90..90 (left-right)
  • Looking adjust times: 0
  • Orientation adjust time: 1
  • Turn adjust look left-right: yes
  • Turn in-place limit: -70..70
  • Turn in-place adjust time: 1

These values are suitable for player controlled actors. For non-player controlled actors it might be useful to set these additional parameters:

  • Looking adjust time: 1
  • Linear velocity adjust time: 1

◆ initPlayerInput()

void Dragengine.Scenery.BAAVehicle.initPlayerInput ( )
protected

Initialize player input tracker.

Sets ECBehaviorPlayerInputMove to LocomotionType.vehicle .

◆ lookDownStart()

void Dragengine.Scenery.BAAVehicle.lookDownStart ( )

Start looking down.

Implements Dragengine.Scenery.BAAMovement.

◆ lookDownStop()

void Dragengine.Scenery.BAAVehicle.lookDownStop ( )

Stop looking down.

Implements Dragengine.Scenery.BAAMovement.

◆ lookLeftStart()

void Dragengine.Scenery.BAAVehicle.lookLeftStart ( )

Start looking left.

Implements Dragengine.Scenery.BAAMovement.

◆ lookLeftStop()

void Dragengine.Scenery.BAAVehicle.lookLeftStop ( )

Stop looking left.

Implements Dragengine.Scenery.BAAMovement.

◆ lookRightStart()

void Dragengine.Scenery.BAAVehicle.lookRightStart ( )

Start looking right.

Implements Dragengine.Scenery.BAAMovement.

◆ lookRightStop()

void Dragengine.Scenery.BAAVehicle.lookRightStop ( )

Stop looking right.

Implements Dragengine.Scenery.BAAMovement.

◆ lookUpStart()

void Dragengine.Scenery.BAAVehicle.lookUpStart ( )

Start looking up.

Implements Dragengine.Scenery.BAAMovement.

◆ lookUpStop()

void Dragengine.Scenery.BAAVehicle.lookUpStop ( )

Stop looking up.

Implements Dragengine.Scenery.BAAMovement.

◆ moveBackwardStart()

void Dragengine.Scenery.BAAVehicle.moveBackwardStart ( )

Start moving backward.

Implements Dragengine.Scenery.BAAMovement.

◆ moveBackwardStop()

void Dragengine.Scenery.BAAVehicle.moveBackwardStop ( )

Stop moving backward.

Implements Dragengine.Scenery.BAAMovement.

◆ moveForwardStart()

void Dragengine.Scenery.BAAVehicle.moveForwardStart ( )

Start moving forward.

Implements Dragengine.Scenery.BAAMovement.

◆ moveForwardStop()

void Dragengine.Scenery.BAAVehicle.moveForwardStop ( )

Stop moving forward.

Implements Dragengine.Scenery.BAAMovement.

◆ moveLeftStart()

void Dragengine.Scenery.BAAVehicle.moveLeftStart ( )

Start moving left.

Implements Dragengine.Scenery.BAAMovement.

◆ moveLeftStop()

void Dragengine.Scenery.BAAVehicle.moveLeftStop ( )

Stop moving left.

Implements Dragengine.Scenery.BAAMovement.

◆ moveRightStart()

void Dragengine.Scenery.BAAVehicle.moveRightStart ( )

Start moving right.

Implements Dragengine.Scenery.BAAMovement.

◆ moveRightStop()

void Dragengine.Scenery.BAAVehicle.moveRightStop ( )

Stop moving right.

Implements Dragengine.Scenery.BAAMovement.

◆ new()

BAAVehicle Dragengine.Scenery.BAAVehicle.new ( )

Create actor action.

Reimplemented from Dragengine.Scenery.BaseActorAction.

◆ persistencyFactoryName()

String Dragengine.Scenery.BAAVehicle.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.

Reimplemented from Dragengine.Scenery.BaseActorAction.

◆ playerReleasesControl()

void Dragengine.Scenery.BAAVehicle.playerReleasesControl ( )

Player released control of actor.

Reimplemented from Dragengine.Scenery.BaseActorAction.

◆ playerTakesControl()

void Dragengine.Scenery.BAAVehicle.playerTakesControl ( )

Player takes control of actor.

Reimplemented from Dragengine.Scenery.BaseActorAction.

◆ playerThink()

void Dragengine.Scenery.BAAVehicle.playerThink ( float  elapsed)

Thinking for player controlled actor only.

Calls these hook methods:

Reimplemented from Dragengine.Scenery.BaseActorAction.

◆ playerUpdateLocomotion()

void Dragengine.Scenery.BAAVehicle.playerUpdateLocomotion ( float  elapsed)
protected

Update locomotion.

If ECBehaviorActorMover has a goal set does nothing to not interfere.

◆ postThink()

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

Post physics.

Actor position is updated by ECBehaviorProjectToGround if present in the actor. Otherwise updates the actor element position and orientation from AI collider.

Default implementation does these actions in this order:

Reimplemented from Dragengine.Scenery.BaseActorAction.

◆ runStart()

void Dragengine.Scenery.BAAVehicle.runStart ( )

Start running.

Implements Dragengine.Scenery.BAAMovement.

◆ runStop()

void Dragengine.Scenery.BAAVehicle.runStop ( )

Stop running.

Implements Dragengine.Scenery.BAAMovement.

◆ runToggle()

void Dragengine.Scenery.BAAVehicle.runToggle ( )

Toggle running.

Implements Dragengine.Scenery.BAAMovement.

◆ setLandingAngle()

void Dragengine.Scenery.BAAVehicle.setLandingAngle ( float  angle)

Set angle in degrees between falling direction and ground normal to land.

◆ think()

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

Thinking.

Default implementation does these actions in this order:

Reimplemented from Dragengine.Scenery.BaseActorAction.

◆ updateAICollider()

void Dragengine.Scenery.BAAVehicle.updateAICollider ( float  elapsed)
protected

Update collider.

Sets orientation and linear velocity from locomotion if actor is touching ground. If not touching ground earth type gravitation is applied.

Actor is considered not touching ground if ProjectToGround has not found a ground collider during the last postThink() call.

Reimplemented from Dragengine.Scenery.BaseActorAction.

◆ updateLocomotion()

void Dragengine.Scenery.BAAVehicle.updateLocomotion ( float  elapsed)
protected

Update locomotion.

Reimplemented from Dragengine.Scenery.BaseActorAction.

◆ updateLocomotionPost()

void Dragengine.Scenery.BAAVehicle.updateLocomotionPost ( float  elapsed)
protected

Post-Update locomotion.

Member Data Documentation

◆ actorMover

ECBehaviorActorMover.Instance Dragengine.Scenery.BAAVehicle.actorMover
protected

Actor mover behavior.

◆ colliderAI

ECBehaviorColliderAI.Instance Dragengine.Scenery.BAAVehicle.colliderAI
protected

Collider AI Behavior.

◆ footSteps

ECBehaviorFootSteps.Instance Dragengine.Scenery.BAAVehicle.footSteps
protected

Foot steps behavior.

◆ moveIfColliderChanged

bool Dragengine.Scenery.BAAVehicle.moveIfColliderChanged
protected

Property update actor geometry on collider changed.

For performance reasons updating the actor geometry not done during colliderChanged() but during postThink() when project to ground has been done. Between postThink() and the next elementThink() actor geometry has to be updated or the actor element matrix is out of sync when AI operates on it. This parameter is used to keep track of this.

◆ playerInputLook

ECBehaviorPlayerInputLook.Instance Dragengine.Scenery.BAAVehicle.playerInputLook
protected

Player input looking behavior.

◆ playerInputMove

ECBehaviorPlayerInputMove.Instance Dragengine.Scenery.BAAVehicle.playerInputMove
protected

Player input moving behavior.

◆ playerInputTurn

ECBehaviorPlayerInputTurn.Instance Dragengine.Scenery.BAAVehicle.playerInputTurn
protected

Player input turning behavior.

◆ projectToGround

ECBehaviorProjectToGround.Instance Dragengine.Scenery.BAAVehicle.projectToGround
protected

Project to ground behavior.


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