diff --git a/panda/src/tform/driveInterface.I b/panda/src/tform/driveInterface.I index 4fd3336582..2ab0a03d3b 100644 --- a/panda/src/tform/driveInterface.I +++ b/panda/src/tform/driveInterface.I @@ -476,6 +476,29 @@ get_ignore_mouse() const { return _ignore_mouse; } +//////////////////////////////////////////////////////////////////// +// Function: DriveInterface::set_force_mouse +// Access: Published +// Description: Changes the state of the force_mouse flag. If this +// flag is true, the mouse button need not be held down +// in order to drive the avatar around. +//////////////////////////////////////////////////////////////////// +INLINE void DriveInterface:: +set_force_mouse(bool force_mouse) { + _force_mouse = force_mouse; +} + +//////////////////////////////////////////////////////////////////// +// Function: DriveInterface::get_force_mouse +// Access: Published +// Description: Returns the current setting of the force_mouse flag. +// See set_force_mouse(). +//////////////////////////////////////////////////////////////////// +INLINE bool DriveInterface:: +get_force_mouse() const { + return _force_mouse; +} + //////////////////////////////////////////////////////////////////// // Function: DriveInterface::set_mat diff --git a/panda/src/tform/driveInterface.cxx b/panda/src/tform/driveInterface.cxx index a5934f5e47..69f42254c5 100644 --- a/panda/src/tform/driveInterface.cxx +++ b/panda/src/tform/driveInterface.cxx @@ -137,6 +137,7 @@ DriveInterface(const string &name) : DataNode(name) { _cs = default_coordinate_system; _ignore_mouse = false; + _force_mouse = false; _mods.add_button(MouseButton::one()); _mods.add_button(MouseButton::two()); @@ -235,7 +236,7 @@ apply(double x, double y, bool any_button) { _speed = 0.0f; _rot_speed = 0.0f; - if (any_button) { + if (any_button || _force_mouse) { // If we're holding down any of the mouse buttons, do this // computation based on the mouse position. diff --git a/panda/src/tform/driveInterface.h b/panda/src/tform/driveInterface.h index f7a5603c55..61348e161f 100644 --- a/panda/src/tform/driveInterface.h +++ b/panda/src/tform/driveInterface.h @@ -103,6 +103,9 @@ PUBLISHED: INLINE void set_ignore_mouse(bool ignore_mouse); INLINE bool get_ignore_mouse() const; + INLINE void set_force_mouse(bool force_mouse); + INLINE bool get_force_mouse() const; + void set_mat(const LMatrix4f &mat); const LMatrix4f &get_mat() const; @@ -139,6 +142,7 @@ private: bool _is_force_roll; CoordinateSystem _cs; bool _ignore_mouse; + bool _force_mouse; // Remember which mouse buttons are being held down. ModifierButtons _mods;