VR-Engage  2.2
Loading...
Searching...
No Matches
makVre::DtHumanLadderClimbingController Class Reference

Detailed Description

DtHumanLadderClimbingController enables joystick control of a human entity's ladder climbing capabilities. It manages detection of nearby ladders, movement up and down ladders, and transitions between ground movement and ladder climbing states. This controller provides realistic ladder interaction behavior including positioning, orientation, and animation control.

Uses Descriptor Type: DtVreHumanJoystickMovementControllerDescriptor

#include <humanLadderClimbingController.h>

Inheritance diagram for makVre::DtHumanLadderClimbingController:
[legend]

Public Member Functions

 DtHumanLadderClimbingController (const DtString &name, DtLocalObject *owner, DtSimulationServices *simManager, DtComponentDescriptor *desc, DtReaderWriterRegistry *parentRegistry=0)
 
virtual ~DtHumanLadderClimbingController () override
 
virtual const char * type () const override
 
virtual bool createPorts () override
 
virtual bool init () override
 
virtual void tick () override
 
- Public Member Functions inherited from makVre::DtVreSimComponent< DtControllerComponent >
 DtVreSimComponent (const DtString &name, DtLocalObject *owner, DtSimulationServices *simManager, DtComponentDescriptor *desc=0, DtReaderWriterRegistry *parentRegistry=0)
 
virtual ~DtVreSimComponent ()
 
bool isPlayerControlled (const std::string &role="") const
 
DtString entitySystemName () const
 

Static Public Member Functions

static DtSimComponent * creator (const DtString &name, DtLocalObject *owner, DtSimulationServices *simManager, DtComponentDescriptor *desc=0, DtReaderWriterRegistry *parentRegistry=0)
 

Protected Member Functions

virtual void calcAndSetPortValues (const DtString &functionGroup, const DtString &function, double value, bool repeat) override
 
virtual void joystickConnected () override
 
virtual void joystickDisconnected () override
 
virtual void lookupAndCacheProcessSR ()
 
virtual bool postAddComponentsInit () override
 
virtual bool initLadderMovementControl ()
 
virtual void tickLadderMovementControl ()
 
virtual bool atLadder (DtLadder &ladder, DtVector &accessPoint)
 
virtual bool atLadderAccessPoint (const DtVector &localPosition, const DtVector &ladderAccessPoint, double radiusSquared)
 
virtual bool atLadderExitPoint (const DtLadder &ladder, DtVector &ladderAccessPoint, DtVector &ladderTerrainAccessPoint)
 
virtual void setNearestLadderAndGetOnLadderPoint (const DtLadder &ladder, const DtVector &ladderAccessPoint)
 
virtual void setEntityLocation (const DtVector &localPosition)
 
virtual void setEntityHeading (double heading)
 
virtual void sendDataRequest (DtSetDataRequest *setRequest)
 
virtual void stowWeapon ()
 
virtual void enableLadderClimbingAnimation ()
 
virtual void disableLadderClimbingAnimation ()
 
virtual bool facingLadder (const DtLadder &ladder, const DtVector &ladderAccessPoint)
 
virtual void snapToLadder (const DtVector &ladderAccessPoint, const DtVector &offset, double heading)
 
virtual DtVector localStandoffFromLadder (const DtLadder &ladder) const
 

Protected Attributes

double myForward
 
DtVreLadderClimbingPSRmyProcessState
 
double myMaxLadderClimbingSpeed
 
DtLadderLocatormyLadderLocator
 
Ports and Port Groups
DtAnalogOutputPort * myLadderClimbingMovementDirectionPort
 

Static Protected Attributes

static double theLadderSearchRadius
 
static double theOnLadderAtLadderPointDistanceSqr
 
static double theApproachingAtLadderPointDistanceSqr
 
static double theLeavingAtLadderPointDistanceSqr
 
static double theFacingHalfAzimuthAngle
 
static double theTimeItTakesToGetOnOffLadderAtTop
 
static double theStandoffDistanceFromLadder
 
static double theHalfLadderLengthSquared
 

Private Member Functions

 DtHumanLadderClimbingController ()
 
 DtHumanLadderClimbingController (const DtHumanLadderClimbingController &orig)
 
DtHumanLadderClimbingControlleroperator= (const DtHumanLadderClimbingController &orig)
 

Constructor & Destructor Documentation

◆ DtHumanLadderClimbingController() [1/3]

makVre::DtHumanLadderClimbingController::DtHumanLadderClimbingController ( const DtString & name,
DtLocalObject * owner,
DtSimulationServices * simManager,
DtComponentDescriptor * desc,
DtReaderWriterRegistry * parentRegistry = 0 )

Constructor.

Parameters
nameThe name of this component
ownerThe local object that owns this component
simManagerThe simulation services manager
descComponent descriptor with configuration parameters
parentRegistryOptional parent registry for reader/writer functionality

Creates a new human ladder climbing controller component with the specified parameters.

Referenced by DtHumanLadderClimbingController(), and operator=().

◆ ~DtHumanLadderClimbingController()

virtual makVre::DtHumanLadderClimbingController::~DtHumanLadderClimbingController ( )
overridevirtual

Virtual destructor.

Cleans up resources used by the human ladder climbing controller component.

◆ DtHumanLadderClimbingController() [2/3]

makVre::DtHumanLadderClimbingController::DtHumanLadderClimbingController ( )
private

Default constructor (not implemented)

Default constructor is private and not implemented to prevent creation of instances without proper initialization.

◆ DtHumanLadderClimbingController() [3/3]

makVre::DtHumanLadderClimbingController::DtHumanLadderClimbingController ( const DtHumanLadderClimbingController & orig)
private

Copy constructor (not implemented)

Copy constructor is private and not implemented to prevent copy construction.

References DtHumanLadderClimbingController().

Member Function Documentation

◆ type()

virtual const char * makVre::DtHumanLadderClimbingController::type ( ) const
overridevirtual

Gets the type identifier for this component.

Returns
String identifying the component type (DtHumanLadderClimbingControllerType)

Implements the DtSimComponent::type() method to return the type identifier for this component.

◆ createPorts()

virtual bool makVre::DtHumanLadderClimbingController::createPorts ( )
overridevirtual

Creates input and output ports for this component.

Returns
True if ports were created successfully, false otherwise

Creates and initializes all input and output ports used by this controller for ladder climbing-related functions.

◆ init()

virtual bool makVre::DtHumanLadderClimbingController::init ( )
overridevirtual

Initializes the component.

Returns
True if initialization is successful, false otherwise

Performs component initialization, setting up internal state and configuring initial ladder climbing parameters.

◆ tick()

virtual void makVre::DtHumanLadderClimbingController::tick ( )
overridevirtual

Updates the controller state each simulation frame.

Processes ladder climbing-related controls and updates the human entity's movement on ladders based on current joystick inputs. Also handles detection of ladders and transitions between ground and ladder states.

◆ creator()

static DtSimComponent * makVre::DtHumanLadderClimbingController::creator ( const DtString & name,
DtLocalObject * owner,
DtSimulationServices * simManager,
DtComponentDescriptor * desc = 0,
DtReaderWriterRegistry * parentRegistry = 0 )
static

Factory method to create a new instance of this component.

Parameters
nameThe name for the new component
ownerThe local object that will own this component
simManagerThe simulation services manager
descOptional component descriptor
parentRegistryOptional parent registry for reader/writer functionality
Returns
Pointer to the newly created component

Static factory method used by the component creation system to instantiate new instances of this component type.

◆ operator=()

DtHumanLadderClimbingController & makVre::DtHumanLadderClimbingController::operator= ( const DtHumanLadderClimbingController & orig)
private

Assignment operator (not implemented)

Returns
Reference to this object

Assignment operator is private and not implemented to prevent assignment.

References DtHumanLadderClimbingController().

◆ calcAndSetPortValues()

virtual void makVre::DtHumanLadderClimbingController::calcAndSetPortValues ( const DtString & functionGroup,
const DtString & function,
double value,
bool repeat )
overrideprotectedvirtual

Processes joystick input and updates output ports.

Parameters
functionGroupThe function group identifier for the input
functionThe specific function identifier within the group
valueThe input value from the joystick
repeatFlag indicating if this is a repeated input

Implements the DtJoystickControllerInterface method to process joystick input and update the controller's output ports for ladder climbing functions.

◆ joystickConnected()

virtual void makVre::DtHumanLadderClimbingController::joystickConnected ( )
overrideprotectedvirtual

Handles joystick connection event.

Called when a joystick is connected to the system. Activates joystick control mode for ladder climbing functions.

◆ joystickDisconnected()

virtual void makVre::DtHumanLadderClimbingController::joystickDisconnected ( )
overrideprotectedvirtual

Handles joystick disconnection event.

Called when a joystick is disconnected from the system. Deactivates joystick control mode for ladder climbing functions.

◆ lookupAndCacheProcessSR()

virtual void makVre::DtHumanLadderClimbingController::lookupAndCacheProcessSR ( )
protectedvirtual

Retrieves and caches the ladder climbing process state repository.

Gets a pointer to the DtVreLadderClimbingPSR which is created by another component. This process state repository contains the ladder climbing state information that is shared between multiple components.

◆ postAddComponentsInit()

virtual bool makVre::DtHumanLadderClimbingController::postAddComponentsInit ( )
overrideprotectedvirtual

Performs initialization after all entity components are created.

Returns
True if post-initialization is successful, false otherwise

Called after all entity components have been created and initialized. Calls lookupAndCacheProcessSR() to retrieve a pointer to the ladder climbing process state repository.

◆ initLadderMovementControl()

virtual bool makVre::DtHumanLadderClimbingController::initLadderMovementControl ( )
protectedvirtual

Initializes ladder movement control.

Returns
True if initialization is successful, false otherwise

Sets up the initial state for ladder movement control, including configuration parameters and movement limits.

◆ tickLadderMovementControl()

virtual void makVre::DtHumanLadderClimbingController::tickLadderMovementControl ( )
protectedvirtual

Updates ladder movement control each simulation frame.

Performs the per-frame update of ladder climbing movement based on current inputs and entity state. Handles movement up and down ladders.

◆ atLadder()

virtual bool makVre::DtHumanLadderClimbingController::atLadder ( DtLadder & ladder,
DtVector & accessPoint )
protectedvirtual

Checks if the entity is at a ladder position.

Parameters
ladderReference to the ladder to check
accessPointOutput parameter to store the ladder access point
Returns
True if entity is at the ladder, false otherwise

Determines if the entity is at a position where it can access the ladder. Updates the accessPoint parameter with the closest ladder access point.

◆ atLadderAccessPoint()

virtual bool makVre::DtHumanLadderClimbingController::atLadderAccessPoint ( const DtVector & localPosition,
const DtVector & ladderAccessPoint,
double radiusSquared )
protectedvirtual

Checks if the entity is at a specific ladder access point.

Parameters
localPositionThe entity's current local position
ladderAccessPointThe ladder access point to check against
radiusSquaredThe squared radius to consider as "at" the access point
Returns
True if entity is at the ladder access point, false otherwise

Determines if the entity is close enough to a ladder access point to be considered "at" that point based on the specified distance threshold.

◆ atLadderExitPoint()

virtual bool makVre::DtHumanLadderClimbingController::atLadderExitPoint ( const DtLadder & ladder,
DtVector & ladderAccessPoint,
DtVector & ladderTerrainAccessPoint )
protectedvirtual

Checks if the entity is at a ladder exit point.

Parameters
ladderThe ladder to check
ladderAccessPointOutput parameter to store the ladder access point
ladderTerrainAccessPointOutput parameter to store the terrain access point
Returns
True if entity is at a ladder exit point, false otherwise

Determines if the entity is at a position where it can exit the ladder. Updates the output parameters with the access and terrain points.

◆ setNearestLadderAndGetOnLadderPoint()

virtual void makVre::DtHumanLadderClimbingController::setNearestLadderAndGetOnLadderPoint ( const DtLadder & ladder,
const DtVector & ladderAccessPoint )
protectedvirtual

Sets the nearest ladder information and updates access point.

Parameters
ladderThe ladder to set as nearest
ladderAccessPointThe access point for the ladder

Updates the process state with information about the nearest ladder and the access point that the entity should use to get on that ladder.

◆ setEntityLocation()

virtual void makVre::DtHumanLadderClimbingController::setEntityLocation ( const DtVector & localPosition)
protectedvirtual

Sets the entity's position.

Parameters
localPositionThe new local position for the entity

Updates the entity's position, typically used when snapping the entity to a specific position on a ladder.

◆ setEntityHeading()

virtual void makVre::DtHumanLadderClimbingController::setEntityHeading ( double heading)
protectedvirtual

Sets the entity's heading/orientation.

Parameters
headingThe new heading angle in radians

Updates the entity's heading, typically used to orient the entity to face the ladder properly during climbing.

◆ sendDataRequest()

virtual void makVre::DtHumanLadderClimbingController::sendDataRequest ( DtSetDataRequest * setRequest)
protectedvirtual

Sends a data request to update entity state.

Parameters
setRequestPointer to the data request to send

Sends a data request to modify entity state, typically used to update position, orientation, or other properties during ladder interaction.

◆ stowWeapon()

virtual void makVre::DtHumanLadderClimbingController::stowWeapon ( )
protectedvirtual

Instructs the entity to stow its weapon.

Requests that the entity stow its weapon during ladder climbing, since weapons cannot be used while climbing a ladder.

◆ enableLadderClimbingAnimation()

virtual void makVre::DtHumanLadderClimbingController::enableLadderClimbingAnimation ( )
protectedvirtual

Enables ladder climbing animation.

Sets the appropriate animation state to show the entity climbing a ladder.

◆ disableLadderClimbingAnimation()

virtual void makVre::DtHumanLadderClimbingController::disableLadderClimbingAnimation ( )
protectedvirtual

Disables ladder climbing animation.

Reverts to normal movement animations when the entity is no longer climbing a ladder.

◆ facingLadder()

virtual bool makVre::DtHumanLadderClimbingController::facingLadder ( const DtLadder & ladder,
const DtVector & ladderAccessPoint )
protectedvirtual

Checks if the entity is facing a ladder.

Parameters
ladderThe ladder to check
ladderAccessPointThe access point for the ladder
Returns
True if the entity is facing the ladder, false otherwise

Determines if the entity's current heading/orientation has it facing toward the ladder, which is required to begin climbing.

◆ snapToLadder()

virtual void makVre::DtHumanLadderClimbingController::snapToLadder ( const DtVector & ladderAccessPoint,
const DtVector & offset,
double heading )
protectedvirtual

Snaps the entity to a ladder position.

Parameters
ladderAccessPointThe access point on the ladder
offsetThe offset from the access point to position the entity
headingThe heading to set for the entity

Positions the entity precisely on a ladder with the correct orientation for climbing. Applies the specified offset to prevent clipping with the ladder.

◆ localStandoffFromLadder()

virtual DtVector makVre::DtHumanLadderClimbingController::localStandoffFromLadder ( const DtLadder & ladder) const
protectedvirtual

Calculates the local standoff vector from a ladder.

Parameters
ladderThe ladder to calculate standoff from
Returns
The local standoff vector

Calculates the appropriate standoff vector to position the entity at the correct distance from the ladder during climbing. This prevents the entity from clipping through the ladder geometry.

Member Data Documentation

◆ myLadderClimbingMovementDirectionPort

DtAnalogOutputPort* makVre::DtHumanLadderClimbingController::myLadderClimbingMovementDirectionPort
protected

Output port for ladder climbing movement direction.

Indicates the direction of climbing movement on a ladder. Negative values indicate climbing down, positive values indicate climbing up, with the range from -1.0 to 1.0. Used to control the animation and movement speed.

◆ myForward

double makVre::DtHumanLadderClimbingController::myForward
protected

Current forward/backward movement input value.

Stores the value for joystick input, with values ranging from -1.0 (climbing down) to 1.0 (climbing up).

◆ myProcessState

DtVreLadderClimbingPSR* makVre::DtHumanLadderClimbingController::myProcessState
protected

Pointer to the ladder climbing process state repository.

Stores state data associated with ladder climbing. This process state repository is shared with other components and is created and destroyed by another component. The state is saved and restored as part of a scenario or checkpoint.

◆ myMaxLadderClimbingSpeed

double makVre::DtHumanLadderClimbingController::myMaxLadderClimbingSpeed
protected

Maximum speed when climbing ladders.

The maximum speed at which the entity can climb up or down ladders, cached from the component descriptor.

◆ myLadderLocator

DtLadderLocator* makVre::DtHumanLadderClimbingController::myLadderLocator
protected

Helper class for locating ladders.

Utility object used to find the nearest ladder and access points around the entity's current position.

◆ theLadderSearchRadius

double makVre::DtHumanLadderClimbingController::theLadderSearchRadius
staticprotected

Search radius for finding nearby ladders.

The radius (in meters) within which to search for ladders around the entity's current position. Default is 5 meters.

◆ theOnLadderAtLadderPointDistanceSqr

double makVre::DtHumanLadderClimbingController::theOnLadderAtLadderPointDistanceSqr
staticprotected

Squared distance threshold for being on a ladder.

The squared distance (in meters squared) threshold for determining if an entity is at a ladder access point when already on the ladder. Default is 0.25 m² (equivalent to a 0.5 m distance).

◆ theApproachingAtLadderPointDistanceSqr

double makVre::DtHumanLadderClimbingController::theApproachingAtLadderPointDistanceSqr
staticprotected

Squared distance threshold when approaching ladders.

The squared distance (in meters squared) threshold for determining if an entity is at a ladder access point when approaching the ladder. Default is 1.0 m². Must be less than theLeavingAtLadderPointDistanceSqr to allow the entity to escape a ladder without automatically re-engaging.

◆ theLeavingAtLadderPointDistanceSqr

double makVre::DtHumanLadderClimbingController::theLeavingAtLadderPointDistanceSqr
staticprotected

Squared distance threshold when leaving ladders.

The squared distance (in meters squared) threshold for determining if an entity is at a ladder access point when leaving the ladder. Default is 1.25 m². Must be greater than theApproachingAtLadderPointDistanceSqr to allow the entity to escape a ladder without automatically re-engaging.

◆ theFacingHalfAzimuthAngle

double makVre::DtHumanLadderClimbingController::theFacingHalfAzimuthAngle
staticprotected

Half-angle for determining if entity is facing a location.

If a given location falls within this angle of the entity's current heading, the entity is considered to be facing that location. Measured in radians. Default is 22.5 degrees (approximately 0.393 radians).

◆ theTimeItTakesToGetOnOffLadderAtTop

double makVre::DtHumanLadderClimbingController::theTimeItTakesToGetOnOffLadderAtTop
staticprotected

Time required to get on/off a ladder at the top.

The time (in seconds) it takes for an entity to complete the transition animation and state change when getting on or off a ladder at the top.

◆ theStandoffDistanceFromLadder

double makVre::DtHumanLadderClimbingController::theStandoffDistanceFromLadder
staticprotected

Distance to maintain between entity and ladder.

The offset distance (in meters) from the ladder needed to prevent the entity's body from appearing embedded in the ladder geometry when climbing up or down.

◆ theHalfLadderLengthSquared

double makVre::DtHumanLadderClimbingController::theHalfLadderLengthSquared
staticprotected

Squared half-length of a typical ladder.

The squared value of half the maximum ladder length (in meters squared). Assuming a maximum ladder length of 16ft (≈5m), half-length is 8ft (≈2.5m), so this value is 6.25 m². Used in distance calculations during climbing.


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