VR-Forces 4.0.4 Class Documentation
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes
DtDIGuyController Class Reference

Controls appearances and animations for an entity that is represented by a DI-Guy 3D visual representation. More...

Inheritance diagram for DtDIGuyController:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 DtDIGuyController (const DtString &name, DtVrfObject *owner, DtSimManager *simManager, DtComponentDescriptor *desc=0, DtReaderWriterRegistry *parentRegistry=0)
 (const DtString&,DtVrfObject*,DtSimManager*,
virtual ~DtDIGuyController ()
 destructor
virtual DtString type () const
 Returns a string identifies the class type of component.
virtual bool init ()
 Initialize the component.
virtual bool createPSR ()
 Creates myProcessState data member, and adds it to our process state repository manager.
virtual void tick ()
 Calculate new control values.
virtual void taskedTick (DtTime &dT)
 Called if we are tasked to perform an animation.
virtual bool intrinsicOverride ()
 Checks if there's some intrinsic behaviour like collision avoidance or shooting the enemy that needs to break in and happen during a tasked animation.
virtual bool intrinsicTick (DtLifeformStaticPosture post, double speed, DtWeaponState weapon, DtString &demeanor)
 When the entity is not tasked to perform an animation, this controller looks at the entity's current posture, speed, weapon state( if any), and demeanor( dead, aiming, sick...) to determine the best animation for the entity.
virtual bool tickWhileDestroyed () const
virtual DtBooleanOutputPortmovementDisablePort () const
virtual void setCurrentAnimation (DtDIGuyAnimation *animation)
virtual void sendSetPosture (DtLifeformState post)
 Sends out our animation's posture when we're finished performing the animation so the actuator knows what the ending posture was and doesn't revert to an old posture.
virtual void processSetCharacterAppearance (DtSimMessage *msg)
virtual void processSetRestore (DtSimMessage *msg)
virtual void processAnimationTask (DtSimMessage *msg)
virtual void clearTask ()
 Both call reset to clear out the tasked animation, set the posture correctly and release control of movement and posture to the other movement components.
virtual void taskComplete (bool success=true)
 If we are currently tasked, this will cause us to notify the entity that we're done and delete the task.
virtual void reset ()
virtual void updateAnimationState (DtLifeformStaticPosture post, double speed, DtWeaponState weapon, const DtString &demeanor)
virtual DtDIGuyDirectionType directionStringToEnum (const DtString &direction)
 Given a DI-Guy direction string return the enum that goes with it.

Static Public Member Functions

static void setAppearanceCallback (DtSimMessage *msg, void *usr)
 Calls processSetArmed().
static void setRestoreCallback (DtSimMessage *msg, void *usrData)
static void animationTaskCallback (DtSimMessage *msg, void *usrData)
static DtSimComponentcreator (const DtString &name, DtVrfObject *owner, DtSimManager *simManager, DtComponentDescriptor *desc=0, DtReaderWriterRegistry *parentRegistry=0)
 (const DtString&,DtVrfObject*,DtSimManager*,

Protected Member Functions

virtual void registerRadioMessageCallbacks ()
 Registers for setCharacterAppearanceDataRequest from the local entity's radio.
virtual void registerTaskMsgCallbacks ()
 Registers for animation tasks.
 DtDIGuyController ()
 Not implemented.
 DtDIGuyController (const DtDIGuyController &orig)
 Not implemented.
const DtDIGuyControlleroperator= (const DtDIGuyController &orig)
 Not implemented.
virtual bool createPorts ()
 Overridden to create the local ports.
virtual bool createCollisionPort ()
 These are called in init to create the ports used to communicate with the controller.
virtual bool createAimDirectionPort ()
virtual bool createMovementDisablePort ()
virtual bool determineDemeanor (DtWeaponState weapon, DtString &demeanor)
virtual void determineDirection ()
virtual void updatePosition (const DtTime &dT, DtTaitBryan &localOrientation)

Protected Attributes

DtDIGuyCharacterDatamyCharacterData
DtVrfMovingObjectStateRepositorymyLocalState
DtDIGuyAnimationmyDefaultAnimation
DtLifeformStaticPosture myDefaultAnimationPosture
bool myTaskInterrupted
DtDIGuyAnimationmyTaskedAnimation
DtTaitBryan myTaskedOrientation
DtDIGuyAnimationmyCurrentAnimation
DtWeaponState myCurrentAnimationWeaponState
DtLifeformStaticPosture myCurrentAnimationPosture
double myCurrentAnimationSpeed
double myAnimationDuration
 These values are stored in the PSR Do we want this animation to be performed only once? Indefinitely? Or for a specified period of time? some number in seconds;.
DtTime myTimeElapsed
bool myAmRotating
double myDirectionOfMovement
DtDIGuyControllerPSRmyProcessState
 Container for state data associated with this component.
DtBooleanInputPortmyCollisionPort
 Input Port Name: collision
Input Port Description: Checks to see if we're avoiding a collision.
DtAnalogInputPortmyAimDirectionPort
 Input Port Name: aim-direction
Input Port Description: Specifies the heading in which the entity should aim its weapon.
DtBooleanOutputPortmyMovementDisablePort
 Output Port Name: movement-disable
Output Port Description: When true, the movement actuator is disabled.
bool myTickWhileDead
bool myFirstTick
bool myNeedUpdate
bool myDisableMovement

Detailed Description

Controls appearances and animations for an entity that is represented by a DI-Guy 3D visual representation.

End User Description: This controller is used on entities that have a DI-Guy driven 3D visual representation. This controller enables Set DI-Guy Appearance and DI-Guy animation tasks, and handles these set/task messages by sending out special DI-Guy control messages to the visual system. in the case of DI-Guy animations, this controller will suppress movement by a normal actuator and move the the entity directly in line with the selected animation. Uses Descriptor Type: DtComponentDescriptor


Constructor & Destructor Documentation

DtDIGuyController::DtDIGuyController ( const DtString name,
DtVrfObject owner,
DtSimManager simManager,
DtComponentDescriptor desc = 0,
DtReaderWriterRegistry parentRegistry = 0 
)

(const DtString&,DtVrfObject*,DtSimManager*,

Parameters:
nameReader writer name of this component.
ownerThe DtVrfObject that owns this component
simManagerThe simulation manager (provides access to terrain, message interface, simulation clock).
descThe component descriptor used to initialize this component.
parentRegistryPointer to the parent reader writer registry (the containing object that reads/writes this object).
(const DtString&,DtVrfObject*,DtSimManager*, DtComponentDescriptor*,DtReaderWriterRegistry* parentRegistry)

destructor

Not implemented.

Not implemented.


Member Function Documentation

virtual DtString DtDIGuyController::type ( ) const [virtual]

Returns a string identifies the class type of component.

Type values are defined in compTypes.h. DtSimComponent creation functions are registered with the DtSimComponentFactory using the type values as the key.

Returns:
DtDiGuyControllerType

Implements DtTaskControllerComponent.

virtual bool DtDIGuyController::init ( ) [virtual]

Initialize the component.

Calls registerRadioMessageCallbacks()

Reimplemented from DtControllerComponent.

virtual bool DtDIGuyController::createPSR ( ) [virtual]

Creates myProcessState data member, and adds it to our process state repository manager.

Passes in the name and type specified in the component descriptor (if they exist) to the DtVrfProcessStateRepository::createRepository factory method. If name and/or type is not specified, uses the appropriate default strings defined in procSRTypes.h.

virtual void DtDIGuyController::tick ( ) [virtual]

Calculate new control values.

Reimplemented from DtSimComponent.

virtual void DtDIGuyController::taskedTick ( DtTime &  dT) [virtual]

Called if we are tasked to perform an animation.

Disables the movement actuator so that position and velocity settings are controlled from this controller. Updates the position and velocity each tick.

Checks if there's some intrinsic behaviour like collision avoidance or shooting the enemy that needs to break in and happen during a tasked animation.

virtual bool DtDIGuyController::intrinsicTick ( DtLifeformStaticPosture  post,
double  speed,
DtWeaponState  weapon,
DtString demeanor 
) [virtual]

When the entity is not tasked to perform an animation, this controller looks at the entity's current posture, speed, weapon state( if any), and demeanor( dead, aiming, sick...) to determine the best animation for the entity.

virtual bool DtDIGuyController::tickWhileDestroyed ( ) const [virtual]
Returns:
true.

Reimplemented from DtSimComponent.

virtual void DtDIGuyController::setCurrentAnimation ( DtDIGuyAnimation animation) [virtual]
virtual void DtDIGuyController::sendSetPosture ( DtLifeformState  post) [virtual]

Sends out our animation's posture when we're finished performing the animation so the actuator knows what the ending posture was and doesn't revert to an old posture.

static void DtDIGuyController::setAppearanceCallback ( DtSimMessage msg,
void *  usr 
) [static]

Calls processSetArmed().

static void DtDIGuyController::setRestoreCallback ( DtSimMessage msg,
void *  usrData 
) [static]
virtual void DtDIGuyController::processSetRestore ( DtSimMessage msg) [virtual]
static void DtDIGuyController::animationTaskCallback ( DtSimMessage msg,
void *  usrData 
) [static]
virtual void DtDIGuyController::processAnimationTask ( DtSimMessage msg) [virtual]
virtual void DtDIGuyController::clearTask ( ) [virtual]

Both call reset to clear out the tasked animation, set the posture correctly and release control of movement and posture to the other movement components.

Reimplemented from DtSingleTaskControllerComponent.

virtual void DtDIGuyController::taskComplete ( bool  success = true) [virtual]

If we are currently tasked, this will cause us to notify the entity that we're done and delete the task.

To indicate that the task has failed (and is being abandoned) call this method with success set to false.

Reimplemented from DtSingleTaskControllerComponent.

virtual void DtDIGuyController::reset ( ) [virtual]
virtual void DtDIGuyController::updateAnimationState ( DtLifeformStaticPosture  post,
double  speed,
DtWeaponState  weapon,
const DtString demeanor 
) [virtual]

Given a DI-Guy direction string return the enum that goes with it.

static DtSimComponent* DtDIGuyController::creator ( const DtString name,
DtVrfObject owner,
DtSimManager simManager,
DtComponentDescriptor desc = 0,
DtReaderWriterRegistry parentRegistry = 0 
) [static]

(const DtString&,DtVrfObject*,DtSimManager*,

Parameters:
nameReader writer name of this component.
ownerThe DtVrfObject that owns this component
simManagerThe simulation manager (provides access to terrain, message interface, simulation clock).
descThe component descriptor used to initialize this component.
parentRegistryPointer to the parent reader writer registry (the containing object that reads/writes this object).
(const DtString&,DtVrfObject*,DtSimManager*, DtComponentDescriptor*,DtReaderWriterRegistry* parentRegistry)

Returns:
New instance of this class.
virtual void DtDIGuyController::registerRadioMessageCallbacks ( ) [protected, virtual]

Registers for setCharacterAppearanceDataRequest from the local entity's radio.

virtual void DtDIGuyController::registerTaskMsgCallbacks ( ) [protected, virtual]

Registers for animation tasks.

Reimplemented from DtTaskControllerComponent.

const DtDIGuyController& DtDIGuyController::operator= ( const DtDIGuyController orig) [protected]

Not implemented.

virtual bool DtDIGuyController::createPorts ( ) [protected, virtual]

Overridden to create the local ports.

Reimplemented from DtSimComponent.

virtual bool DtDIGuyController::createCollisionPort ( ) [protected, virtual]

These are called in init to create the ports used to communicate with the controller.

virtual bool DtDIGuyController::createAimDirectionPort ( ) [protected, virtual]
virtual bool DtDIGuyController::createMovementDisablePort ( ) [protected, virtual]
virtual bool DtDIGuyController::determineDemeanor ( DtWeaponState  weapon,
DtString demeanor 
) [protected, virtual]
virtual void DtDIGuyController::determineDirection ( ) [protected, virtual]
virtual void DtDIGuyController::updatePosition ( const DtTime &  dT,
DtTaitBryan &  localOrientation 
) [protected, virtual]

Member Data Documentation

DtTaitBryan DtDIGuyController::myTaskedOrientation [protected]

These values are stored in the PSR Do we want this animation to be performed only once? Indefinitely? Or for a specified period of time? some number in seconds;.

Container for state data associated with this component.

This state is saved and restored as part of a scenario (or checkpoint).

Input Port Name: collision
Input Port Description: Checks to see if we're avoiding a collision.

Overrides DI-Guy tasked animations. Need to avoid collisions first.
Input Port Range:
Input Port Default Value:
Input Group Parent:

Input Port Name: aim-direction
Input Port Description: Specifies the heading in which the entity should aim its weapon.

This information will override DI-Guy Tasked animations.
Input Port Range: Heading value in radians.
Input Port Default Value: N/A
Input Group Parent:

Output Port Name: movement-disable
Output Port Description: When true, the movement actuator is disabled.

When an entity's DI-Guy representation is performing an animation the movement actuator is no longer controlling the entity's movements. This controller takes over those responsibilities by providing very simple translational and directional changes that are associated with the tasked animation if any. Once the animation task is complete the movement controls are given back to the movement actuators. Output Port Default Value: False


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

Document ID: Generated on Fri Jun 29 16:33:32 EDT 2012 from SVN revision 116588
Copyright © 2005-2012 VT MÄK Inc. All Rights Reserved (www.mak.com)