# DriveInterface¶

class DriveInterface

This is a TFormer, similar to Trackball, that moves around a transform matrix in response to mouse input. The basic motion is on a horizontal plane, as if driving a vehicle.

Inheritance diagram

explicit DriveInterface(std::string const &name = "")
DriveInterface(DriveInterface const&) = default
void force_dgraph(void)

This is a special kludge for DriveInterface to allow us to avoid the one- frame latency after a collision. It forces an immediate partial data flow for all data graph nodes below this node, causing all data nodes that depend on this matrix to be updated immediately.

static TypeHandle get_class_type(void)
bool get_force_mouse(void) const

Returns the current setting of the force_mouse flag. See set_force_mouse().

PN_stdfloat get_forward_speed(void) const

Returns the speed of full forward motion, when the mouse is at the very top of the window. This is in units (e.g. feet) per second.

PN_stdfloat get_h(void) const
PN_stdfloat get_horizontal_dead_zone(void) const

Returns the size of the vertical bar in the center of the screen that represents the “dead zone” of horizontal motion: the region in which the mouse does not report horizontal motion. This is in a fraction of the window width, so 0.5 will set a dead zone as large as half the screen.

PN_stdfloat get_horizontal_ramp_down_time(void) const

Returns the amount of time, in seconds, it takes between the time a left or right arrow key is released and the time it registers no motion.

PN_stdfloat get_horizontal_ramp_up_time(void) const

Returns the amount of time, in seconds, it takes between the time a left or right arrow key is pressed and the time it registers full rotation.

LVecBase3 const &get_hpr(void) const

Returns the driver’s orientation.

bool get_ignore_mouse(void) const

Returns the current setting of the ignore_mouse flag. See set_ignore_mouse().

LMatrix4 const &get_mat(void)

Returns the current transform.

PN_stdfloat get_p(void) const
LPoint3 const &get_pos(void) const

Returns the driver’s position.

PN_stdfloat get_r(void) const
PN_stdfloat get_reverse_speed(void) const

Returns the speed of full reverse motion, when the mouse is at the very bottom of the window. This is in units (e.g. feet) per second.

PN_stdfloat get_rot_speed(void) const

Returns the rot_speed of the previous update in units/sec

PN_stdfloat get_rotate_speed(void) const

Returns the maximum rate at which the user can rotate left or right, when the mouse is at the very edge of the window. This is in degrees per second.

PN_stdfloat get_speed(void) const

Returns the speed of the previous update in units/sec

bool get_stop_this_frame(void) const

Returns the current setting of the stop_this_frame flag. See set_stop_this_frame().

PN_stdfloat get_vertical_dead_zone(void) const

Returns the size of the horizontal bar in the center of the screen that represents the “dead zone” of vertical motion: the region in which the mouse does not report vertical motion. This is in a fraction of the window height, so 0.5 will set a dead zone as large as half the screen.

PN_stdfloat get_vertical_ramp_down_time(void) const

Returns the amount of time, in seconds, it takes between the time an up or down arrow key is released and the time it registers no motion.

PN_stdfloat get_vertical_ramp_up_time(void) const

Returns the amount of time, in seconds, it takes between the time an up or down arrow key is pressed and the time it registers full forward or backward motion.

PN_stdfloat get_x(void) const
PN_stdfloat get_y(void) const
PN_stdfloat get_z(void) const
void reset(void)

Reinitializes the driver to the origin and resets any knowledge about buttons being held down.

void set_force_mouse(bool force_mouse)

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.

void set_force_roll(PN_stdfloat force_roll)

This function is no longer used and does nothing. It will be removed soon.

void set_forward_speed(PN_stdfloat speed)

Sets the speed of full forward motion, when the mouse is at the very top of the window. This is in units (e.g. feet) per second.

void set_h(PN_stdfloat h)
void set_horizontal_dead_zone(PN_stdfloat zone)

Sets the size of the vertical bar in the center of the screen that represents the “dead zone” of horizontal motion: the region in which the mouse does not report horizontal motion. This is in a fraction of the window width, so 0.5 will set a dead zone as large as half the screen.

void set_horizontal_ramp_down_time(PN_stdfloat ramp_down_time)

Sets the amount of time, in seconds, it takes between the time a left or right arrow key is released and the time it registers no motion.

void set_horizontal_ramp_up_time(PN_stdfloat ramp_up_time)

Sets the amount of time, in seconds, it takes between the time a left or right arrow key is pressed and the time it registers full rotation.

void set_hpr(LVecBase3 const &hpr)
void set_hpr(PN_stdfloat h, PN_stdfloat p, PN_stdfloat r)

Directly sets the driver’s orientation.

void set_ignore_mouse(bool ignore_mouse)

Changes the state of the ignore_mouse flag. If this flag is true, the DriveInterface will ignore mouse down button events (but still recognize mouse up button events); the user will not be able to start the DriveInterface going again if it is stopped, but if the user is currently holding down a mouse button it will not stop immediately until the user eventually releases the button.

void set_mat(LMatrix4 const &mat)

Stores the indicated transform in the DriveInterface.

void set_p(PN_stdfloat p)
void set_pos(LVecBase3 const &vec)
void set_pos(PN_stdfloat x, PN_stdfloat y, PN_stdfloat z)

Directly sets the driver’s position.

void set_r(PN_stdfloat r)
void set_reverse_speed(PN_stdfloat speed)

Sets the speed of full reverse motion, when the mouse is at the very bottom of the window. This is in units (e.g. feet) per second.

void set_rotate_speed(PN_stdfloat speed)

Sets the maximum rate at which the user can rotate left or right, when the mouse is at the very edge of the window. This is in degrees per second.

void set_stop_this_frame(bool stop_this_frame)

If stop_this_frame is true, the next time the frame is computed no motion will be allowed, and then the flag is reset to false. This can be used to prevent too much movement when we know a long time has artificially elapsed, for instance when we take a screenshot, without munging the clock for everything else.

void set_vertical_dead_zone(PN_stdfloat zone)

Sets the size of the horizontal bar in the center of the screen that represents the “dead zone” of vertical motion: the region in which the mouse does not report vertical motion. This is in a fraction of the window height, so 0.5 will set a dead zone as large as half the screen.

void set_vertical_ramp_down_time(PN_stdfloat ramp_down_time)

Sets the amount of time, in seconds, it takes between the time an up or down arrow key is released and the time it registers no motion.

void set_vertical_ramp_up_time(PN_stdfloat ramp_up_time)

Sets the amount of time, in seconds, it takes between the time an up or down arrow key is pressed and the time it registers full forward or backward motion.

void set_x(PN_stdfloat x)
void set_y(PN_stdfloat y)
void set_z(PN_stdfloat z)