#include <fpsmotionmodel.h>

Public Member Functions | |
| FPSMotionModel (Keyboard *keyboard=0, Mouse *mouse=0, float maxWalkSpeed=5.0f, float maxTurnSpeed=100.0f, float maxSidestepSpeed=5.0f, float height=2.0f, float maxStepUpDist=1.0f) | |
| Constructor. | |
| void | SetScene (Scene *scene) |
| Sets the active Scene, which is used for ground following. | |
| Scene * | GetScene () |
| Returns the active Scene. | |
| virtual void | SetEnabled (bool enabled) |
| Enables or disables this motion model. | |
| void | SetDefaultMappings (Keyboard *keyboard, Mouse *mouse) |
| Sets the input axes to a set of default mappings for mouse and keyboard. | |
| void | SetWalkForwardBackwardAxis (Axis *walkForwardBackwardAxis) |
| Sets the axis that moves the target forwards (for positive values) or backwards (for negative values). | |
| Axis * | GetWalkForwardBackwardAxis () |
| Returns the axis that moves the target forwards (for positive values) or backwards (for negative values). | |
| void | SetTurnLeftRightAxis (Axis *turnLeftRightAxis) |
| Sets the axis that turns the target left (for negative values) or right (for positive values). | |
| Axis * | GetTurnLeftRightAxis () |
| Returns the axis that turns the target left (for negative values) or right (for positive values). | |
| void | SetLookUpDownAxis (Axis *lookUpDownAxis) |
| Sets the axis looks down (for negative values) or up (for positive values). | |
| Axis * | GetLookUpDownAxis () |
| Returns the axis that looks down (for negative values) or up (for positive values). | |
| void | SetSidestepLeftRightAxis (Axis *sidestepLeftRightAxis) |
| Sets the axis that sidesteps the target left (for negative values) or right (for positive values). | |
| Axis * | GetSidestepLeftRightAxis () |
| Returns the axis that sidesteps the target left (for negative values) or right (for positive values). | |
| void | SetMaximumWalkSpeed (float maximumWalkSpeed) |
| Sets the maximum walk speed (meters per second). | |
| float | GetMaximumWalkSpeed () |
| Returns the maximum walk speed (meters per second). | |
| void | SetMaximumTurnSpeed (float maximumTurnSpeed) |
| Sets the maximum turn speed (degrees per second). | |
| float | GetMaximumTurnSpeed () |
| Returns the maximum turn speed (degrees per second). | |
| void | SetMaximumSidestepSpeed (float maximumSidestepSpeed) |
| Sets the maximum sidestep speed (meters per second). | |
| float | GetMaximumSidestepSpeed () |
| Returns the maximum sidestep speed (meters per second). | |
| void | SetHeightAboveTerrain (float heightAboveTerrain) |
| Sets the height to maintain above the terrain (meters). | |
| float | GetHeightAboveTerrain () |
| Returns the height to maintain above the terrain (meters). | |
| void | SetMaximumStepUpDistance (float maximumStepUpDistance) |
| Sets the maximum step-up distance. | |
| float | GetMaximumStepUpDistance () |
| Returns the current maximum step-up distance. | |
| void | SetFallingHeight (float fallingHeight) |
| Set the height distance at which point we're falling. | |
| float | GetFallingHeight () const |
| Get the distance above terrain at which point we're falling. | |
| virtual void | OnMessage (MessageData *data) |
| Message handler callback. | |
| void | SetUseMouseButtons (bool use) |
| Sets having to use the mouse buttons to move the camera. | |
| void | InvertMouse (bool b) |
| Inverts the mouse movement in pitch. | |
| bool | GetInvertMouse () |
| |
Protected Member Functions | |
| virtual | ~FPSMotionModel () |
| Destructor. | |
| virtual void | UpdateMouse (const double deltaTime) |
| This method can be overriden in subclasses to produce desired mouse behavior. | |
| virtual void | PerformTranslation (const double deltaTime) |
| This method can be overriden in subclasses to produce desired translation behavior Note: Any collision detection/response and other physical constraints should be applied here. | |
| float | GetSidestepFactor () const |
| Returns the factor [-1.0, 1.0] to side-step by. | |
| float | GetForwardBackFactor () const |
| Returns the factor [-1.0, 1.0] to walk by. | |
| Mouse * | GetMouse () const |
| Returns the mouse. | |
| Keyboard * | GetKeyboard () const |
| Returns the keyboard. | |
Classes | |
| class | FPSAxisListener |
| internal class, used by FPSMotionModel for InputDevice listening More... | |
| dtCore::FPSMotionModel::FPSMotionModel | ( | Keyboard * | keyboard = 0, |
|
| Mouse * | mouse = 0, |
|||
| float | maxWalkSpeed = 5.0f, |
|||
| float | maxTurnSpeed = 100.0f, |
|||
| float | maxSidestepSpeed = 5.0f, |
|||
| float | height = 2.0f, |
|||
| float | maxStepUpDist = 1.0f | |||
| ) |
Constructor.
| keyboard | the keyboard instance, or 0 to avoid creating default input mappings | |
| mouse | the mouse instance, or 0 to avoid creating default input mappings | |
| maxWalkSpeed | the maximum walking speed | |
| maxTurnSpeed | the maximum turning speed | |
| maxSidestepSpeed | the maximum sidestep speed | |
| height | the height above the terrain at which we stand | |
| maxStepUpDist | the maximum distance we can step up to higher terrain | |
| keyboard | the keyboard instance, or 0 to avoid creating default input mappings | |
| mouse | the mouse instance, or 0 to avoid creating default input mappings |
| dtCore::FPSMotionModel::~FPSMotionModel | ( | ) | [protected, virtual] |
Destructor.
| void dtCore::FPSMotionModel::UpdateMouse | ( | const double | deltaTime | ) | [protected, virtual] |
This method can be overriden in subclasses to produce desired mouse behavior.
| deltaTime | The time change |
| void dtCore::FPSMotionModel::PerformTranslation | ( | const double | deltaTime | ) | [protected, virtual] |
This method can be overriden in subclasses to produce desired translation behavior Note: Any collision detection/response and other physical constraints should be applied here.
| deltaTime | The time change |
Reimplemented in dtCore::CollisionMotionModel.
| float dtCore::FPSMotionModel::GetSidestepFactor | ( | ) | const [inline, protected] |
Returns the factor [-1.0, 1.0] to side-step by.
| float dtCore::FPSMotionModel::GetForwardBackFactor | ( | ) | const [inline, protected] |
Returns the factor [-1.0, 1.0] to walk by.
| Mouse* dtCore::FPSMotionModel::GetMouse | ( | ) | const [inline, protected] |
Returns the mouse.
| Keyboard* dtCore::FPSMotionModel::GetKeyboard | ( | ) | const [inline, protected] |
Returns the keyboard.
| void dtCore::FPSMotionModel::SetScene | ( | Scene * | scene | ) |
| void dtCore::FPSMotionModel::SetEnabled | ( | bool | enabled | ) | [virtual] |
Enables or disables this motion model.
| enabled | true to enable this motion model, false to disable it |
Reimplemented from dtCore::MotionModel.
Sets the input axes to a set of default mappings for mouse and keyboard.
| keyboard | the keyboard instance | |
| mouse | the mouse instance |
| void dtCore::FPSMotionModel::SetWalkForwardBackwardAxis | ( | Axis * | walkForwardBackwardAxis | ) |
Sets the axis that moves the target forwards (for positive values) or backwards (for negative values).
| walkForwardBackwardAxis | the new forward/backward axis |
| Axis * dtCore::FPSMotionModel::GetWalkForwardBackwardAxis | ( | ) |
Returns the axis that moves the target forwards (for positive values) or backwards (for negative values).
| void dtCore::FPSMotionModel::SetTurnLeftRightAxis | ( | Axis * | turnLeftRightAxis | ) |
Sets the axis that turns the target left (for negative values) or right (for positive values).
| turnLeftRightAxis | the new turn left/right axis |
| Axis * dtCore::FPSMotionModel::GetTurnLeftRightAxis | ( | ) |
Returns the axis that turns the target left (for negative values) or right (for positive values).
| void dtCore::FPSMotionModel::SetLookUpDownAxis | ( | Axis * | lookUpDownAxis | ) |
Sets the axis looks down (for negative values) or up (for positive values).
Sets the axis that looks down (for negative values) or up (for positive values).
| lookUpDownAxis | the new look up/down axis |
| Axis * dtCore::FPSMotionModel::GetLookUpDownAxis | ( | ) |
Returns the axis that looks down (for negative values) or up (for positive values).
| void dtCore::FPSMotionModel::SetSidestepLeftRightAxis | ( | Axis * | sidestepLeftRightAxis | ) |
Sets the axis that sidesteps the target left (for negative values) or right (for positive values).
| sidestepLeftRightAxis | the new sidestep left/right axis |
| Axis * dtCore::FPSMotionModel::GetSidestepLeftRightAxis | ( | ) |
Returns the axis that sidesteps the target left (for negative values) or right (for positive values).
| void dtCore::FPSMotionModel::SetMaximumWalkSpeed | ( | float | maximumWalkSpeed | ) |
Sets the maximum walk speed (meters per second).
| maximumWalkSpeed | the new maximum walk speed |
| float dtCore::FPSMotionModel::GetMaximumWalkSpeed | ( | ) |
Returns the maximum walk speed (meters per second).
| void dtCore::FPSMotionModel::SetMaximumTurnSpeed | ( | float | maximumTurnSpeed | ) |
Sets the maximum turn speed (degrees per second).
| maximumTurnSpeed | the new maximum turn speed |
| float dtCore::FPSMotionModel::GetMaximumTurnSpeed | ( | ) |
Returns the maximum turn speed (degrees per second).
| void dtCore::FPSMotionModel::SetMaximumSidestepSpeed | ( | float | maximumSidestepSpeed | ) |
Sets the maximum sidestep speed (meters per second).
| maximumSidestepSpeed | the new maximum sidestep speed |
| float dtCore::FPSMotionModel::GetMaximumSidestepSpeed | ( | ) |
Returns the maximum sidestep speed (meters per second).
| void dtCore::FPSMotionModel::SetHeightAboveTerrain | ( | float | heightAboveTerrain | ) |
Sets the height to maintain above the terrain (meters).
| heightAboveTerrain | the height to maintain above the terrain |
| float dtCore::FPSMotionModel::GetHeightAboveTerrain | ( | ) |
Returns the height to maintain above the terrain (meters).
| void dtCore::FPSMotionModel::SetMaximumStepUpDistance | ( | float | maximumStepUpDistance | ) |
Sets the maximum step-up distance.
When clamping to the ground, the maximum step-up distance determines whether to rise to a new level (as when the model climbs a staircase) or to stay at the current level (as when the model passes under a roof). The default is 1.0.
| maximumStepUpDistance | the new maximum step-up distance |
| float dtCore::FPSMotionModel::GetMaximumStepUpDistance | ( | ) |
Returns the current maximum step-up distance.
| void dtCore::FPSMotionModel::SetFallingHeight | ( | float | fallingHeight | ) |
Set the height distance at which point we're falling.
If the MotionModel elevation is higher than fallingHeight plus the height of terrain, than we'll let gravity take over. (defaults to 1.0 meter)
| fallingHeight,: | The distance above terrain at which point we're falling (meters) |
| float dtCore::FPSMotionModel::GetFallingHeight | ( | ) | const |
Get the distance above terrain at which point we're falling.
| void dtCore::FPSMotionModel::OnMessage | ( | MessageData * | data | ) | [virtual] |
| void dtCore::FPSMotionModel::SetUseMouseButtons | ( | bool | use | ) | [inline] |
Sets having to use the mouse buttons to move the camera.
| use | True to use |
| void dtCore::FPSMotionModel::InvertMouse | ( | bool | b | ) | [inline] |
Inverts the mouse movement in pitch.
| bool dtCore::FPSMotionModel::GetInvertMouse | ( | ) | [inline] |