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

Keep track of player input converting them into locomotion input values. More...

Inheritance diagram for PlayerInputTracker:

Classes

enum  eLocomotionType
 Locomotion type. More...
 

Public Member Functions

float calculateLookLeftRight (float elapsed)
 Calculate look left right delta value and reset analog input. More...
 
float calculateLookUpDown (float elapsed)
 Calculate look up down delta value and reset analog input. More...
 
float calculateTurnLeftRight ()
 
float getAnalogFactorLookLeftRight ()
 Analog Look left right factor relative to left right input speed. More...
 
float getAnalogFactorLookUpDown ()
 Analog Look up down factor relative to up down input speed. More...
 
float getAnalogLookLeftRight ()
 
float getAnalogLookUpDown ()
 
float getAnalogMoveForwardBackward ()
 
float getAnalogMoveLeftRight ()
 
float getAnalogTurnLeftRight ()
 
bool getCanChangeStance ()
 
bool getCanMove ()
 
bool getCanTurn ()
 
bool getCrouch ()
 
int getLocomotionType ()
 Locomotion type. More...
 
bool getLookDown ()
 
bool getLookLeft ()
 
bool getLookRight ()
 
bool getLookUp ()
 
bool getMoveBackward ()
 
bool getMoveForward ()
 
bool getMoveLeft ()
 
bool getMoveRight ()
 
float getMovingDirection ()
 
float getMovingSpeed ()
 
bool getRun ()
 
float getSpeedLookLeftRight ()
 
float getSpeedLookUpDown ()
 
float getSpeedRunBackward ()
 
float getSpeedRunForward ()
 
float getSpeedRunLeft ()
 
float getSpeedRunRight ()
 
float getSpeedTurnLeftRight ()
 
float getSpeedWalkBackward ()
 
float getSpeedWalkForward ()
 
float getSpeedWalkLeft ()
 
float getSpeedWalkRight ()
 
float getStance ()
 
bool getTurnLeft ()
 
bool getTurnRight ()
 
bool isMoving ()
 
PlayerInputTracker new ()
 Create player input tracker. More...
 
void readFromFile (FileReader reader)
 Read from file. More...
 
void reset ()
 
void resetLook ()
 
void resetMove ()
 
void resetTurn ()
 
void setAnalogFactorLookLeftRight (float factor)
 Set analog look left right factor relative to left right input speed. More...
 
void setAnalogFactorLookUpDown (float factor)
 Set analog look up down factor relative to up down input speed. More...
 
void setAnalogLookLeftRight (float value)
 
void setAnalogLookUpDown (float value)
 
void setAnalogMoveForwardBackward (float value)
 
void setAnalogMoveLeftRight (float value)
 
void setAnalogTurnLeftRight (float value)
 
void setCanChangeStance (bool canChangeStance)
 
void setCanMove (bool canMove)
 
void setCanTurn (bool canTurn)
 
void setCrouch (bool crouch)
 
void setLocomotionType (int type)
 Set locomotion type. More...
 
void setLookDown (bool pressed)
 
void setLookLeft (bool pressed)
 
void setLookRight (bool pressed)
 
void setLookUp (bool pressed)
 
void setMoveBackward (bool pressed)
 
void setMoveForward (bool pressed)
 
void setMoveLeft (bool pressed)
 
void setMoveRight (bool pressed)
 
void setMovingDirection (float direction)
 
void setMovingSpeed (float speed)
 
void setRun (bool pressed)
 
void setSpeedLookLeftRight (float speed)
 
void setSpeedLookUpDown (float speed)
 
void setSpeedRun (float speed)
 
void setSpeedRunBackward (float speed)
 
void setSpeedRunForward (float speed)
 
void setSpeedRunLeft (float speed)
 
void setSpeedRunRight (float speed)
 
void setSpeedTurnLeftRight (float speed)
 
void setSpeedWalk (float speed)
 
void setSpeedWalkBackward (float speed)
 
void setSpeedWalkForward (float speed)
 
void setSpeedWalkLeft (float speed)
 
void setSpeedWalkRight (float speed)
 
void setStance (float stance)
 
void setTurnLeft (bool pressed)
 
void setTurnRight (bool pressed)
 
void toggleCanChangeStance ()
 
void toggleCanMove ()
 
void toggleCanTurn ()
 
void toggleLookDown ()
 
void toggleLookLeft ()
 
void toggleLookRight ()
 
void toggleLookUp ()
 
void toggleMoveBackward ()
 
void toggleMoveForward ()
 
void toggleMoveLeft ()
 
void toggleMoveRight ()
 
void toggleRun ()
 
void toggleTurnLeft ()
 
void toggleTurnRight ()
 
void updateLocomotion (Locomotion locomotion, float elapsed)
 
void updateMovingDirection ()
 
void updateMovingSpeed ()
 
void updateStance ()
 
void writeToFile (FileWriter writer)
 Write to file. More...
 

Detailed Description

Keep track of player input converting them into locomotion input values.

Digital Input

Supports digital input by player for looking left-right and up-down using digital input devices like keyboard or game pad buttons. The setSpeedLookLeftRight() and setSpeedLookUpDown() methods set the speed of looking while the input is enabled. The calculation of looking delta by digital input is this:

delta = (+/-) speed * elapsedTime

Whereas + is if left input is enabled while - is used if right input is enabled. Using negative speed switches direction.

Analog Input

Supports analog input by player for looking left-right and up-down using analog input devices like mouse, game pad analog sticksothers. The analog input can be set directly from the input event (for example mouse move deltas). The setAnalogFactorLookLeftRight() and setAnalogFactorLookUpDown() methods set the sensitivity of the input value transforming it into a value comparable to using digital input. The default value is 0.01 resulting in analog input suitable for first person navigation. Smaller values make analog input slower increasing accuracy pointing at specific locations while larger values make analog input faster. The same holds true for changing the digital input speed. The calculation of looking delta by analog input is this:

delta = analogInput * analogFactor * speed

Using negative factor switches direction. Using negative factor and speed keeps the direction unchanged.

Member Function Documentation

◆ calculateLookLeftRight()

float calculateLookLeftRight ( float  elapsed)

Calculate look left right delta value and reset analog input.

◆ calculateLookUpDown()

float calculateLookUpDown ( float  elapsed)

Calculate look up down delta value and reset analog input.

◆ calculateTurnLeftRight()

float calculateTurnLeftRight ( )

Calculate turn left right value and reset analog input.

◆ getAnalogFactorLookLeftRight()

float getAnalogFactorLookLeftRight ( )

Analog Look left right factor relative to left right input speed.

◆ getAnalogFactorLookUpDown()

float getAnalogFactorLookUpDown ( )

Analog Look up down factor relative to up down input speed.

◆ getAnalogLookLeftRight()

float getAnalogLookLeftRight ( )

Analog look left right.

◆ getAnalogLookUpDown()

float getAnalogLookUpDown ( )

Analog look up down.

◆ getAnalogMoveForwardBackward()

float getAnalogMoveForwardBackward ( )

Analog move forward backward.

◆ getAnalogMoveLeftRight()

float getAnalogMoveLeftRight ( )

Analog move left right.

◆ getAnalogTurnLeftRight()

float getAnalogTurnLeftRight ( )

Analog turn left right.

◆ getCanChangeStance()

bool getCanChangeStance ( )

Determine if the player can change stance.

◆ getCanMove()

bool getCanMove ( )

Determine if the player can move.

◆ getCanTurn()

bool getCanTurn ( )

Determine if the player can turn.

◆ getCrouch()

bool getCrouch ( )

Determine if the actor is crouching.

◆ getLocomotionType()

int getLocomotionType ( )

Locomotion type.

◆ getLookDown()

bool getLookDown ( )

Determine if the look down key is pressed.

◆ getLookLeft()

bool getLookLeft ( )

Determine if the look left key is pressed.

◆ getLookRight()

bool getLookRight ( )

Determine if the look right key is pressed.

◆ getLookUp()

bool getLookUp ( )

Determine if the look up key is pressed.

◆ getMoveBackward()

bool getMoveBackward ( )

Determine if the move backward key is pressed.

◆ getMoveForward()

bool getMoveForward ( )

Determine if the move forward key is pressed.

◆ getMoveLeft()

bool getMoveLeft ( )

Determine if the move left key is pressed.

◆ getMoveRight()

bool getMoveRight ( )

Determine if the move right key is pressed.

◆ getMovingDirection()

float getMovingDirection ( )

Locomotion moving direction.

◆ getMovingSpeed()

float getMovingSpeed ( )

Locomotion moving speed.

◆ getRun()

bool getRun ( )

Determine if the run key is pressed.

◆ getSpeedLookLeftRight()

float getSpeedLookLeftRight ( )

Look left right speed in degrees per second.

◆ getSpeedLookUpDown()

float getSpeedLookUpDown ( )

Look up down speed in degrees per second.

◆ getSpeedRunBackward()

float getSpeedRunBackward ( )

Run backward speed.

◆ getSpeedRunForward()

float getSpeedRunForward ( )

Run forward speed.

◆ getSpeedRunLeft()

float getSpeedRunLeft ( )

Run left speed.

◆ getSpeedRunRight()

float getSpeedRunRight ( )

Run right speed.

◆ getSpeedTurnLeftRight()

float getSpeedTurnLeftRight ( )

Turn left right speed in degrees per second.

◆ getSpeedWalkBackward()

float getSpeedWalkBackward ( )

Walk backward speed.

◆ getSpeedWalkForward()

float getSpeedWalkForward ( )

Walk forward speed.

◆ getSpeedWalkLeft()

float getSpeedWalkLeft ( )

Walk left speed.

◆ getSpeedWalkRight()

float getSpeedWalkRight ( )

Walk right speed.

◆ getStance()

float getStance ( )

Locomotion stance.

◆ getTurnLeft()

bool getTurnLeft ( )

Determine if the turn left key is pressed.

◆ getTurnRight()

bool getTurnRight ( )

Determine if the turn right key is pressed.

◆ isMoving()

bool isMoving ( )

Determine if the player is moving.

◆ new()

Create player input tracker.

◆ readFromFile()

void readFromFile ( FileReader  reader)

Read from file.

◆ reset()

void reset ( )

Reset input.

◆ resetLook()

void resetLook ( )

Reset look input.

◆ resetMove()

void resetMove ( )

Reset move input.

◆ resetTurn()

void resetTurn ( )

Reset turn input.

◆ setAnalogFactorLookLeftRight()

void setAnalogFactorLookLeftRight ( float  factor)

Set analog look left right factor relative to left right input speed.

Use negative value to flip analog input direction.

◆ setAnalogFactorLookUpDown()

void setAnalogFactorLookUpDown ( float  factor)

Set analog look up down factor relative to up down input speed.

Use negative value to flip analog input direction.

◆ setAnalogLookLeftRight()

void setAnalogLookLeftRight ( float  value)

Set analog look left right.

◆ setAnalogLookUpDown()

void setAnalogLookUpDown ( float  value)

Set analog look up down.

◆ setAnalogMoveForwardBackward()

void setAnalogMoveForwardBackward ( float  value)

Set analog move forward backward.

◆ setAnalogMoveLeftRight()

void setAnalogMoveLeftRight ( float  value)

Set analog move left right.

◆ setAnalogTurnLeftRight()

void setAnalogTurnLeftRight ( float  value)

Set analog turn left right.

◆ setCanChangeStance()

void setCanChangeStance ( bool  canChangeStance)

Set if the player can change stance.

◆ setCanMove()

void setCanMove ( bool  canMove)

Set if the player can move.

◆ setCanTurn()

void setCanTurn ( bool  canTurn)

Set if the player can turn.

◆ setCrouch()

void setCrouch ( bool  crouch)

Set if the actor is crouching.

◆ setLocomotionType()

void setLocomotionType ( int  type)

Set locomotion type.

◆ setLookDown()

void setLookDown ( bool  pressed)

Set if the look down key is pressed.

◆ setLookLeft()

void setLookLeft ( bool  pressed)

Set if the look left key is pressed.

◆ setLookRight()

void setLookRight ( bool  pressed)

Set if the look right key is pressed.

◆ setLookUp()

void setLookUp ( bool  pressed)

Set if the look up key is pressed.

◆ setMoveBackward()

void setMoveBackward ( bool  pressed)

Set if the move backward key is pressed.

◆ setMoveForward()

void setMoveForward ( bool  pressed)

Set if the move forward key is pressed.

◆ setMoveLeft()

void setMoveLeft ( bool  pressed)

Set if the move left key is pressed.

◆ setMoveRight()

void setMoveRight ( bool  pressed)

Set if the move right key is pressed.

◆ setMovingDirection()

void setMovingDirection ( float  direction)

Set locomotion moving direction.

◆ setMovingSpeed()

void setMovingSpeed ( float  speed)

Set locomotion moving speed.

◆ setRun()

void setRun ( bool  pressed)

Set if the run key is pressed.

◆ setSpeedLookLeftRight()

void setSpeedLookLeftRight ( float  speed)

Set look left right speed in degrees per second.

◆ setSpeedLookUpDown()

void setSpeedLookUpDown ( float  speed)

Set look up down speed in degrees per second.

◆ setSpeedRun()

void setSpeedRun ( float  speed)

Set walk speed all directions.

◆ setSpeedRunBackward()

void setSpeedRunBackward ( float  speed)

Set walk backward speed.

◆ setSpeedRunForward()

void setSpeedRunForward ( float  speed)

Set walk forward speed.

◆ setSpeedRunLeft()

void setSpeedRunLeft ( float  speed)

Set walk left speed.

◆ setSpeedRunRight()

void setSpeedRunRight ( float  speed)

Set walk right speed.

◆ setSpeedTurnLeftRight()

void setSpeedTurnLeftRight ( float  speed)

Set turn left right speed in degrees per second.

◆ setSpeedWalk()

void setSpeedWalk ( float  speed)

Set walk speed all directions.

◆ setSpeedWalkBackward()

void setSpeedWalkBackward ( float  speed)

Set walk backward speed.

◆ setSpeedWalkForward()

void setSpeedWalkForward ( float  speed)

Set walk forward speed.

◆ setSpeedWalkLeft()

void setSpeedWalkLeft ( float  speed)

Set walk left speed.

◆ setSpeedWalkRight()

void setSpeedWalkRight ( float  speed)

Set walk right speed.

◆ setStance()

void setStance ( float  stance)

Set locomotion stance.

◆ setTurnLeft()

void setTurnLeft ( bool  pressed)

Set if the turn left key is pressed.

◆ setTurnRight()

void setTurnRight ( bool  pressed)

Set if the turn right key is pressed.

◆ toggleCanChangeStance()

void toggleCanChangeStance ( )

Toggle can change stance.

◆ toggleCanMove()

void toggleCanMove ( )

Toggle can move.

◆ toggleCanTurn()

void toggleCanTurn ( )

Toggle can turn.

◆ toggleLookDown()

void toggleLookDown ( )

Toggle look down key pressed.

◆ toggleLookLeft()

void toggleLookLeft ( )

Toggle look left key pressed.

◆ toggleLookRight()

void toggleLookRight ( )

Toggle look right key pressed.

◆ toggleLookUp()

void toggleLookUp ( )

Toggle look up key pressed.

◆ toggleMoveBackward()

void toggleMoveBackward ( )

Toggle move backward key pressed.

◆ toggleMoveForward()

void toggleMoveForward ( )

Toggle move forward key pressed.

◆ toggleMoveLeft()

void toggleMoveLeft ( )

Toggle move left key pressed.

◆ toggleMoveRight()

void toggleMoveRight ( )

Toggle move right key pressed.

◆ toggleRun()

void toggleRun ( )

Toggle run key pressed.

◆ toggleTurnLeft()

void toggleTurnLeft ( )

Toggle turn left key pressed.

◆ toggleTurnRight()

void toggleTurnRight ( )

Toggle turn right key pressed.

◆ updateLocomotion()

void updateLocomotion ( Locomotion  locomotion,
float  elapsed 
)

Update locomotion using the tracked parameters.

◆ updateMovingDirection()

void updateMovingDirection ( )

Update moving direction.

◆ updateMovingSpeed()

void updateMovingSpeed ( )

Update moving speed.

◆ updateStance()

void updateStance ( )

Update locomotion stance.

◆ writeToFile()

void writeToFile ( FileWriter  writer)

Write to file.


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