Attention: Here be dragons

This is the latest (unstable) version of this documentation, which may document features not available in or compatible with released stable versions of GDWiiInput.

GDWiimoteΒΆ

Inherits: RefCounted

A container for the Wiimote controller, providing access to its features such as motion sensing, LED control, and Nunchuk accessory management.

MethodsΒΆ

Vector3

get_accel() const

float

get_battery_level() const

Array

get_board_interpolated_weights() const

Array

get_board_raw_data() const

Quaternion

get_fusion_orientation()

Vector2

get_ir_cursor_absolute_coordinate()

Vector2

get_ir_cursor_calculated_position()

float

get_ir_cursor_distance()

Vector2

get_ir_dot_interpolated_position(index: int)

Vector2

get_ir_dot_raw_position(index: int)

float

get_ir_dot_size(index: int)

int

get_ir_num_dots()

bool

get_led(led_index: int) const

Vector3

get_nunchuk_accel() const

Vector3

get_nunchuk_raw_accel() const

Vector3

get_nunchuk_raw_orientation() const

Vector3

get_nunchuk_smoothed_orientation() const

Vector2

get_player_space_gyro(yaw_relax_factor: float)

Vector3

get_processed_accel()

Vector3

get_raw_accel() const

Vector3

get_raw_gyro() const

Vector3

get_raw_orientation() const

Vector3

get_smoothed_orientation() const

Vector2

get_world_space_gyro(side_reduction_threshold: float)

void

initialize_nunchuk()

bool

is_ir_active()

bool

is_ir_dot_visible(index: int)

bool

is_nunchuk_connected() const

void

pulse_rumble(duration_msec: float)

void

reset_gyro_calibration()

void

set_accel_threshold(threshold: int)

void

set_gyro_calibration_mode(mode: int)

void

set_ir(enable: bool)

void

set_leds(led_indices: Array)

void

set_motion_plus(enable: bool)

void

set_motion_processing(enable: bool)

void

set_motion_sensing(enable: bool)

void

set_nunchuk_accel_threshold(threshold: int)

void

set_nunchuk_joystick_deadzone(dz: float)

void

set_nunchuk_joystick_threshold(dt: float)

void

set_nunchuk_orient_threshold(threshold: float)

void

set_orient_threshold(threshold: float)

void

set_rumble(enabled: bool)

void

start_gyro_calibration()

void

start_nunchuk_joystick_calibration()

void

stop_gyro_calibration()

void

stop_nunchuk_joystick_calibration()

void

toggle_rumble()


SignalsΒΆ

board_inserted(device_id: int) πŸ”—

Emitted when a Wii Balance board accessory is connected to the Wiimote. The device_id parameter indicates which Wiimote the board is connected to. This is not reliable in the middle of an ongoing session.


board_removed(device_id: int) πŸ”—

Emitted when a Wii Balance board accessory is disconnected from the Wiimote. The device_id parameter indicates which Wiimote the board is connected to. This is not reliable in the middle of an ongoing session.


nunchuk_inserted(device_id: int) πŸ”—

Emitted when a Nunchuk accessory is connected to the Wiimote. The device_id parameter indicates which Wiimote the Nunchuk is connected to. This is not reliable in the middle of an ongoing session.


nunchuk_removed(device_id: int) πŸ”—

Emitted when a Nunchuk accessory is disconnected from the Wiimote. The device_id parameter indicates which Wiimote the Nunchuk was connected to. This is not reliable in the middle of an ongoing session.


wiimote_disconnected(device_id: int) πŸ”—

Emitted when a Wiimote is disconnected. The device_id parameter indicates which Wiimote was disconnected. This is not reliable in the middle of an ongoing session.


Method DescriptionsΒΆ

Vector3 get_accel() const πŸ”—

Get the current acceleration data along the X, Y, and Z axes in G-force units (1G = 9.81 m/s^2).


float get_battery_level() const πŸ”—

Get the battery level of the Wiimote, as a percentage (0-100).


Array get_board_interpolated_weights() const πŸ”—

Get the interpolated weight per sensor in kgs. The order is (top left, top right, bottom left, bottom right).


Array get_board_raw_data() const πŸ”—

Get the raw readings per sensor in ???. The order is (top left, top right, bottom left, bottom right).


Quaternion get_fusion_orientation() πŸ”—

Get the current orientation of the Wiimote as a quaternion. This is calculated using the accelerometer and gyroscope data.


Vector2 get_ir_cursor_absolute_coordinate() πŸ”—

Get the absolute coordinate of the IR cursor.


Vector2 get_ir_cursor_calculated_position() πŸ”—

Get the position of the IR cursor calculated using a reference of two fixed IR points below the screen (i.e, the sensor bar).


float get_ir_cursor_distance() πŸ”—

Get the distance of the remote from the sensor bar.


Vector2 get_ir_dot_interpolated_position(index: int) πŸ”—

Get the interpolated position of dots``index`. `index must be in range (0-3).


Vector2 get_ir_dot_raw_position(index: int) πŸ”—

Get the raw position of dots``index`` with range (0-1023) and (0-767) for the x and y coordinates, respectively. index must be in range (0-3).


float get_ir_dot_size(index: int) πŸ”—

Get the approximate size of dots``index`` with range (0-15).


int get_ir_num_dots() πŸ”—

Get the number of dots currently being tracked (maximum 4).


bool get_led(led_index: int) const πŸ”—

Get whether a specific LED is on or off. Indices are 1-4.


Vector3 get_nunchuk_accel() const πŸ”—

Get the current acceleration data from the Nunchuk accessory along the X, Y, and Z axes in G-force units (1G = 9.81 m/s^2).


Vector3 get_nunchuk_raw_accel() const πŸ”—

Get the current raw acceleration data from the Nunchuk accessory along the X, Y, and Z axes.


Vector3 get_nunchuk_raw_orientation() const πŸ”—

Get the current raw tilt data computed from the acceleration data of the Nunchuk accessory. The values represent the yaw, pitch and roll angles in degrees.


Vector3 get_nunchuk_smoothed_orientation() const πŸ”—

Get the current smoothed tilt data computed from the acceleration data of the Nunchuk accessory. The values represent the yaw, pitch and roll angles in degrees, smoothed over time to reduce noise.


Vector2 get_player_space_gyro(yaw_relax_factor: float) πŸ”—

Check GamepadMotionHelpers' documentation for more information on how to use this method.


Vector3 get_processed_accel() πŸ”—

Get the current acceleration data with gravity subtracted, along the X, Y, and Z axes in G-force units (1G = 9.81 m/s^2).


Vector3 get_raw_accel() const πŸ”—

Get the current raw acceleration data along the X, Y, and Z axes. Not sure what units.


Vector3 get_raw_gyro() const πŸ”—

Get the current gyroscope data from the Wiimote, if available. The values represent the angular velocity corresponding to the yaw, pitch and roll angles in degrees per second.

Note: This method only returns data if the Wiimote is using a MotionPlus accessory or has built-in gyroscope support. In such a case, set_motion_plus() should be enabled first.


Vector3 get_raw_orientation() const πŸ”—

Get the current raw tilt data computed from the acceleration data of the Wiimote. The values represent the yaw, pitch and roll angles in degrees.


Vector3 get_smoothed_orientation() const πŸ”—

Get the current smoothed tilt data computed from the acceleration data of the Wiimote. The values represent the yaw, pitch and roll angles in degrees, smoothed over time to reduce noise.


Vector2 get_world_space_gyro(side_reduction_threshold: float) πŸ”—

Check GamepadMotionHelpers' documentation for more information on how to use this method.


void initialize_nunchuk() πŸ”—

Initialize the Nunchuk accessory with default calibration values. This should be called immediately after the Nunchuk is connected.


bool is_ir_active() πŸ”—

Check if IR functionality is enabled.


bool is_ir_dot_visible(index: int) πŸ”—

Check if dots``index`` is currently visible.


bool is_nunchuk_connected() const πŸ”—

Check if the Nunchuk accessory is connected to the Wiimote.


void pulse_rumble(duration_msec: float) πŸ”—

Pulse the rumble motor for a specified duration in milliseconds.


void reset_gyro_calibration() πŸ”—

Reset the previously computed gyroscope calibration data.

Note: This requires enabling motion processing.


void set_accel_threshold(threshold: int) πŸ”—

Set a threshold used to determine when a change in the Wiimote's acceleration is reported. The threshold indicates the decimal place that should be considered a significant change.


void set_gyro_calibration_mode(mode: int) πŸ”—

Set the gyroscope calibration mode. The mode parameter can be one of the following:

  • 0: CalibrationMode::Manual - No auto-calibration. This is the default.

  • 1: CalibrationMode::Stillness - Automatically try to detect when the controller is being held still and update the calibration offset accordingly.

  • 2: CalibrationMode::SensorFusion - Calculate an angular velocity from changes in the gravity direction as detected by the accelerometer. If these are steady enough, use them to make corrections to the calibration offset. This will only apply to relevant axes.

Check GamepadMotionHelpers' documentation for more information


void set_ir(enable: bool) πŸ”—

Enable or disable reporting of IR data. Used to save power when IR sensing is not needed.


void set_leds(led_indices: Array) πŸ”—

Set the state of the LEDs on the Wiimote. The led_indices array should contain integers representing the LED indices (1-4) that should be turned on. If an index is not included, that LED will be turned off.


void set_motion_plus(enable: bool) πŸ”—

Enable or disable reporting of gyroscope data. Used to save power when motion plus sensing is not needed.


void set_motion_processing(enable: bool) πŸ”—

Enable or disable the processing of motion data using GamepadMotionHelper utilities. When enabled, get_fusion_orientation(), get_player_space_gyro() and get_world_space_gyro() will return processed data.


void set_motion_sensing(enable: bool) πŸ”—

Enable or disable reporting of acceleration and orientation data. Used to save power when motion sensing is not needed. See also set_motion_plus().


void set_nunchuk_accel_threshold(threshold: int) πŸ”—

Set a threshold used to determine when a change in the Nunchuk's acceleration is reported. See also set_accel_threshold().


void set_nunchuk_joystick_deadzone(dz: float) πŸ”—

Set the deadzone for the Nunchuk's joystick. This is the width of a cross-shaped area around the center of the joystick where movement is ignored.


void set_nunchuk_joystick_threshold(dt: float) πŸ”—

Set the threshold for the Nunchuk's joystick. This is the minimum distance the joystick must move from its previous position before a change is reported.


void set_nunchuk_orient_threshold(threshold: float) πŸ”—

Set a threshold used to determine when a change in the Nunchuk's orientation is reported. See also set_orient_threshold().


void set_orient_threshold(threshold: float) πŸ”—

Set a threshold used to determine when a change in the Wiimote's orientation is reported. The threshold indicates the decimal place that should be considered a significant change.


void set_rumble(enabled: bool) πŸ”—

Set whether the rumble motor is enabled or disabled.


void start_gyro_calibration() πŸ”—

Start the calibration process for the Wiimote's gyroscope. The Wiimote must be kept still (probably on a flat surface) for a few seconds. The calibration must then be manually completed by calling stop_gyro_calibration().

Note: This requires enabling motion processing.


void start_nunchuk_joystick_calibration() πŸ”—

Start the calibration process for the Nunchuk's joystick. At the moment of calling this method, the Nunchuk's joystick should be centered and not moving. During the calibration process, the Nunchuk's joystick should be moved around to capture its range of motion. The calibration must then be manually completed by calling stop_nunchuk_calibration().

Note: This stops firing InputEventJoypadMotion until the calibration is complete.


void stop_gyro_calibration() πŸ”—

Stop the calibration process for the Wiimote's gyroscope.

Note: This requires enabling motion processing.


void stop_nunchuk_joystick_calibration() πŸ”—

Stop the calibration process for the Nunchuk's joystick. This should be called after start_nunchuk_calibration() to finalize the calibration data.

Note: This resumes firing InputEventJoypadMotion after the calibration is complete.


void toggle_rumble() πŸ”—

Toggle the rumble motor on or off. If the rumble motor is currently enabled, it will be disabled, and vice versa.