C++ Java Unity
Unity Reference
VirtualButtonBehaviour Class Reference

This behaviour associates a Virtual Button with a game object. Use the functionality in ImageTargetBehaviour to create and destroy Virtual Buttons at run-time. More...

Inheritance diagram for VirtualButtonBehaviour:
VuforiaMonoBehaviour

Public Member Functions

bool CalculateButtonArea (out Vector2 topLeft, out Vector2 bottomRight)
 Calculates the 2D button area that the Virtual Button currently occupies in the Image Target. Returns true if the area was computed successfully. False otherwise. Passes out the top left and bottom right position of the rectangle area. More...
 
ImageTargetBehaviour GetImageTargetBehaviour ()
 Returns the Image Target that this Virtual Button is associated with. More...
 
void OnTrackerUpdated (bool pressed)
 Called after the VuforiaBehaviour has updated. More...
 
void RegisterEventHandler (IVirtualButtonEventHandler eventHandler)
 Registers an event handler with this Virtual Button which will be called when a state changed is detected. More...
 
bool UnregisterEventHandler (IVirtualButtonEventHandler eventHandler)
 Registers an event handler with this Virtual Button which will be called when a state changed is detected. Returns true on success. False otherwise. More...
 
bool UpdateAreaRectangle ()
 Update the virtual button rect in native More...
 
bool UpdatePose ()
 UpdatePose() is called each frame to ensure the virtual button is clamped to the image target plane and remains axis-aligned with respect to the target. Return true if the defining area of the virtual button has changed, false otherwise. More...
 
bool UpdateSensitivity ()
 Update sensitivity in native More...
 

Public Attributes

const float TARGET_OFFSET = 0.001f
 The vertical offset of the graphic representation of a virtual button in respect to the target More...
 

Properties

bool HasUpdatedPose [get]
 if the pose has been updated once More...
 
bool Pressed [get]
 Returns true if this button is currently pressed. More...
 
bool UnregisterOnDestroy [get, set]
 Unregistering Virtual Buttons should only be done if they have been registered at runtime. This property is automatically set by ImageTargetBehaviour on registration. More...
 
VirtualButton VirtualButton [get]
 The VirtualButton Object created at runtime More...
 
string VirtualButtonName [get]
 The names of this virtual button. More...
 

Detailed Description

This behaviour associates a Virtual Button with a game object. Use the functionality in ImageTargetBehaviour to create and destroy Virtual Buttons at run-time.

Member Function Documentation

bool CalculateButtonArea ( out Vector2  topLeft,
out Vector2  bottomRight 
)

Calculates the 2D button area that the Virtual Button currently occupies in the Image Target. Returns true if the area was computed successfully. False otherwise. Passes out the top left and bottom right position of the rectangle area.

ImageTargetBehaviour GetImageTargetBehaviour ( )

Returns the Image Target that this Virtual Button is associated with.

void OnTrackerUpdated ( bool  pressed)

Called after the VuforiaBehaviour has updated.

void RegisterEventHandler ( IVirtualButtonEventHandler  eventHandler)

Registers an event handler with this Virtual Button which will be called when a state changed is detected.

bool UnregisterEventHandler ( IVirtualButtonEventHandler  eventHandler)

Registers an event handler with this Virtual Button which will be called when a state changed is detected. Returns true on success. False otherwise.

bool UpdateAreaRectangle ( )

Update the virtual button rect in native

bool UpdatePose ( )

UpdatePose() is called each frame to ensure the virtual button is clamped to the image target plane and remains axis-aligned with respect to the target. Return true if the defining area of the virtual button has changed, false otherwise.

bool UpdateSensitivity ( )

Update sensitivity in native

Member Data Documentation

const float TARGET_OFFSET = 0.001f

The vertical offset of the graphic representation of a virtual button in respect to the target

Property Documentation

bool HasUpdatedPose
get

if the pose has been updated once

bool Pressed
get

Returns true if this button is currently pressed.

bool UnregisterOnDestroy
getset

Unregistering Virtual Buttons should only be done if they have been registered at runtime. This property is automatically set by ImageTargetBehaviour on registration.

The VirtualButton Object created at runtime

string VirtualButtonName
get

The names of this virtual button.