Controller

public class Controller

Class representing a single Daydream controller. Create a Controller using getController(). Optionally register for events with Controller.EventListener. Update the controller's state using update() and then read the public fields as needed.

Nested Classes

class Controller.BatteryLevels Constants that represent the controller battery level. 
class Controller.BetaTrackingStatusFlags Integer bit map for tracking status of one controller in trackingStatusFlags
class Controller.ConnectionStates Constants that represent the controller's states. 
class Controller.EventListener Listens for various classes of events related to the Controller. 

Fields

public boolean appButtonState True if the user currently holding down the APP button.
public int batteryLevelBucket The current battery level bucket.
public boolean clickButtonState True if the user is currently holding the CLICK button down.
public boolean gripButtonState True if the user is currently holding down the grip button.
public boolean homeButtonState True if the user is currently holding down the HOME button.
public boolean isCharging True if the controller is currently being charged.
public boolean isTouching True if the user is currently touching the touchpad.
public final Orientation orientation The controller's orientation in Start Space as a quaternion.
public final float[] position The controller's position for use with elbow model.
public long timestamp The time in nanosecond at when the last update occurred.
public final PointF touch The normalized coordinates on the touchpad.
public int trackingStatusFlags Int field which contains tracking status information of a controller.
public boolean triggerButtonState True if the user is currently holding down the trigger button.
public boolean volumeDownButtonState True if the user is currently holding the VOLUME DOWN button.
public boolean volumeUpButtonState True if the user is currently holding down the VOLUME UP button.

Public Methods

int
getControllerId()
Gets the ID that identifies this controller.
float[]
getTransform(float[] output)
Combines position and orientation into a matrix.
void
setEventListener(Controller.EventListener listener)
Registers an Controller.EventListener for this Controller.
void
update()
Update this Controller's state with the latest data from the hardware.

Inherited Methods

Fields

public boolean appButtonState

True if the user currently holding down the APP button.

public int batteryLevelBucket

The current battery level bucket. This is a value from Controller.BatteryLevels and not the percent.

public boolean clickButtonState

True if the user is currently holding the CLICK button down.

public boolean gripButtonState

True if the user is currently holding down the grip button.

public boolean homeButtonState

True if the user is currently holding down the HOME button.

public boolean isCharging

True if the controller is currently being charged.

public boolean isTouching

True if the user is currently touching the touchpad.

public final Orientation orientation

The controller's orientation in Start Space as a quaternion.

public final float[] position

The controller's position for use with elbow model.

public long timestamp

The time in nanosecond at when the last update occurred. This value is set via update() calls and represents when the last event was received from the hardware.

public final PointF touch

The normalized coordinates on the touchpad. Each value ranges range from [0, 1]. The x value of the touch point aligns with the controller's x-axis, which points to the right of the controller, and the y value aligns with the controller's z-axis. See Controller Space for more information. This is initially (0, 0) until an event is received. If the user is not touching the touchpad, then this is the position of the last touch.

On circular touchpad hardware, the valid touch area will be a 0.5 radius circle centered around (0.5, 0.5).

public int trackingStatusFlags

Int field which contains tracking status information of a controller.

Each bit is defined in Controller.BetaTrackingStatusFlags.

public boolean triggerButtonState

True if the user is currently holding down the trigger button.

public boolean volumeDownButtonState

True if the user is currently holding the VOLUME DOWN button.

public boolean volumeUpButtonState

True if the user is currently holding down the VOLUME UP button.

Public Methods

public int getControllerId ()

Gets the ID that identifies this controller. This corresponds to the index corresponding to the configuration used for this controller in the current TrackingConfiguration's array of controller configurations.

Returns
  • the controllerId for this controller.

public float[] getTransform (float[] output)

Combines position and orientation into a matrix.

Parameters
output 16-element array to hold the result.
Returns
  • output with elements as a column-major matrix.

public void setEventListener (Controller.EventListener listener)

Registers an Controller.EventListener for this Controller.

Parameters
listener

public void update ()

Update this Controller's state with the latest data from the hardware.