Joystick Input

Process input from asynchronous joystick device


Simulink® 3D Animation™


The Joystick Input block provides interaction between a Simulink model and the virtual world associated with a Simulink 3D Animation block.

The Joystick Input block uses axes, buttons, and the point-of-view selector, if present. You can use this block as you would use any other Simulink source block. Its output ports reflect the status of the joystick controls for axes and buttons.

The Joystick Input block also supports force-feedback devices.

When building a model using Simulink Desktop Real-Time™, use the Simulink Desktop Real-Time Joystick Input driver instead of the Joystick Input block.

To open the Block Parameters dialog box, double-click the block.


Joystick ID — The system ID assigned to the given joystick device. You can find the properties of the joystick that is connected to the system in the Game Controllers section of the system Control Panel.

Adjust I/O ports according to joystick capabilities — If you select this check box, the Simulink 3D Animation software dynamically adjusts the ports to correspond to the capabilities of the connected joystick each time that you open the model. If the connected device does not have force-feedback capability, selecting this check box causes the removal of the force-feedback input from the block, even if you select the Enable force-feedback input check box. The block ports do not have the full widths provided by the Windows® Game Controllers interface.

Enable force-feedback input — If you select this check box, the Simulink 3D Animation software can support force-feedback joystick, steering wheel, and haptic (one that enables tactile feedback) devices.

Output Ports — Depending on the Adjust I/O ports according to joystick capabilities check box setting, the output ports change to correspond to the actual capabilities of the connected joystick. On Windows platforms, the output ports have fixed maximum width provided by the system Game Controllers interface.

Output PortValueDescription


Vector of doubles in the range < -1; 1 >

Outputs correspond to the current position of the joystick in the given axis. Values are normalized to range from -1 to 1.

The first joystick axes element is x, the second element is y, and so on up to the total number of axes. What the x axis represents depends on the type and shape of the joystick. The Joystick Input block uses the mapping between the joystick driver and the joystick.


Vector of doubles

0 — Button released
1 — Button pressed

Outputs correspond to the current status of joystick buttons.

Point of view

-1 — Selector inactive
<0; 360> — The angle of the POV selector, in degrees

Output corresponds to the current status of the joystick point-of-view selector.

Input PortValueDescription


Vector of doubles
in the range
< -1; 1 >

Port active only for force-feedback devices. Inputs correspond to the force to be applied in the given axis.

Usually, not all of the device axes have force-feedback. The size of the Force vector is then smaller than the Axes vector size.

Introduced before R2006a