Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

AVEVA™ XR Studio

JoystickSensor

  • Last UpdatedFeb 19, 2025
  • 5 minute read

The JoystickSensor node is used to map gamepads or joysticks. It supports devices based on Direct Input and on XInput.

Platform support

This node is fully supported on XR-Windows platform.

It is partially supported on XR-Portable Windows, XR-Portable iOS, XR-Portable Android, and XR-P WASM platforms.

Notes

  • The JoyStick node can be created for portable platforms; however, no items can be linked to it.

  • The JoyStick node is supported for module compatibility reasons, since mobile devices do not support gamepads.

    XR-WIN

    XR-P-WIN

    XR-P-IOS

    XR-P-AND

    XR-P-WASM

    Full support

    Partial support

    Partial support

    Partial support

    Partial support

    Full support

    Limited support

    Limited support

    Limited support

    Limited support

The JoystickSensor Interaction model

The JoystickSensor node offers access to multiple input elements in three categories. Each instance of an input category corresponds a group of fields in the node.

  • Button: A button triggers events when pressed or released. There are 12 mapped buttons (B1,B2,B3,B4,B5,B6,B7,B8,B9,B10,B11, and B12).

  • Axis: An axis provides a direction and an intensity. There are two mapped axes (R and L).

  • POV: A POV is a group of cross displaced buttons. Each direction button triggers separate events when pressed or released. There is one unique mapped POV (P).

Vibration

JoystickSensor offer two ways to drive device vibration.

  • Direct vibration control. Vibration is activated and deactivated using the vibrationActive field. Intensity is controlled with vibrationGain, vibrationLeft, and vibrationRight.

  • Time based control. Uses vibrate field to define vibration length, left intensity, and right intensity.

Code example

This is a code example for JoystickSensor.

<--declaration -->

<Joysticksensor name="joy0"/>

<!--routing few buttons to a command -->

<route from="joy0.B1Down" to="logButton.execute" value="Button 1"/>

<route from="joy0.B2Down" to="logButton.execute" value="Button 2"/>

<route from="joy0.B3Down" to="logButton.execute" value="Button 3"/>

<!--command to log the pressed button -->

<Command name="logButton" args="buttonName=sstring">

<log text="Pressed [@%buttonName%]" />

</Command>

Joystick Sensor fields

These are the fields for JoystickSensor node. Only the node-specific fields are indicated, not fields obtained by inheritance.

Field inheritance: NodeBase > JoystickSensor

Node general fields

Fields

Type

Use

Default value

Description

active

sbool

true

Use to activate/deactivate node interaction.

device

sint

Optional

0

ID of the device.

deviceConnected

sbool

Read only

Internally calculated

Is set to true when a device is connected.

type

sstring

Read only

Internally calculated

NONE if no device is connected. DINPUT or XINPUT depending on device.

vibrate

mfloat

Optional

No default

Used to trigger vibration. It requires three values: vibration duration in seconds, left side vibration intensity (0-1) and right side vibration intensity (0-1). This mode must be used when vibrationActive is set to false.

vibrationActive

sbool

Optional

false

When set to true, device vibrates according to vibrationGain, vibrationLeft, and vibrationRight values.

vibrationGain

sfloat

Optional

1

Calibrates overall vibration.

vibrationLeft

sfloat

Optional

1

Calibrates left side vibration.

vibrationRight

sfloat

Optional

1

Calibrates right side vibration.

Each one of the 12 mapped buttons exposes a set of fields that can be accessed with this syntax.

joystickSensorName.buttonNameField

For example: joy0.B4Down

Field

Type

Use

Default value

Description

Down

sevent

Read only

Internally calculated

Generated when releasing the button.

Id

sint

Read only

Internally calculated

Button identifier on the device.

Up

sevent

Read only

Internally calculated

Generated when pressing the button.

The mapped POV exposes a set of fields that can be accessed with this syntax.

joystickSensorName.povNameField

For example: joy0.PDUp

Field

Type

Use

Default value

Description

angle

sfloat

Read only

Internally calculated

POV direction angle.

forceAngle

sfloat

Optional

Not set

Overwrites the angle value coming from the device.

ForceX

sfloat

Optional

Not set

Overwrites the Y value coming from the device.

ForceY

sfloat

Optional

Not set

Overwrites the Y value coming from the device.

Id

sint

Read only

Internally calculated

POV identifier on the device.

DDown

sevent

Read only

Internally calculated

Generated when finishing moving down.

DUp

sevent

Read only

Internally calculated

Raised when moving down.

LDown

sevent

Read only

Internally calculated

Generated when finishing moving left.

LUp

sevent

Read only

Internally calculated

Raised when moving left.

RDown

sevent

Read only

Internally calculated

Generated when finishing right.

RUp

sevent

Read only

Internally calculated

Raised when moving right.

UDown

sevent

Read only

Internally calculated

Generated when finishing moving up.

UUp

sevent

Read only

Internally calculated

Raised when moving up.

X

sfloat

Read only

Internally calculated

POV horizontal value in the range [-1 1].

Y

sfloat

Read only

Internally calculated

POV vertical value in the range [-1 1].

The two mapped Axes expose a set of fields that can be accessed with this syntax.

joystickSensorName.axisNameField

For example: joy0.LRUp

Parameter

Type

Use

Default value

Description

CalibX

svec2

Optional

0.1 0.1

Defines calibration null range for horizontal axis.

CalibY

svec2

Optional

0.1 0.1

Defines calibration null range for vertical axis.

DDown

sevent

Read only

Internally calculated

Generated when finishing moving down.

DUp

sevent

Read only

Internally calculated

Raised when moving down.

ForceX

sfloat

Optional

Not set

Overwrites the X value coming from the device.

ForceY

sfloat

Optional

Not set

Overwrites the Y value coming from the device.

Id_x

sint

Read only

Internally calculated

Axis horizontal coordinate identifier on the device.

Id_y

sint

Read only

Internally calculated

Axis vertical coordinate identifier on the device.

LDown

sevent

Read only

Internally calculated

Generated when finishing moving left.

LUp

sevent

Read only

Internally calculated

Raised when moving left.

MulX

sfloat

Optional

1

Adjusts axis horizontal sensibility or inverts axis.

MulY

sfloat

Optional

1

Adjusts axis vertical sensibility or inverts axis.

RDown

sevent

Read only

Internally calculated

Generated when finishing right.

RUp

sevent

Read only

Internally calculated

Raised when moving right.

UDown

sevent

Read only

Internally calculated

Generated when finishing moving up.

UUp

sevent

Read only

Internally calculated

Raised when moving up.

X

sfloat

Read only

Internally calculated

Axis horizontal value in the range [-1 1].

Y

sfloat

Read only

Internally calculated

Axis vertical value in the range [-1 1].

In This Topic
Related Links
TitleResults for “How to create a CRG?”Also Available in