Wikitude SDK API Reference

API Docs for: 5.3.0
Show:

Drawable Class

Extends ARchitectObject
Module: AR

A Drawable is the base class for any graphical representation of a GeoObject.

Drawable is a superclass for other classes and must not be directly instantiated by the developer.

Rotations can be applied to Drawables. The local coordinate system of a Drawable is defined as a righthanded coordinate system, following the definitions below:

  • The origin of the coordinate system is in the location of the Object the Drawable is attached to.
  • The x axis is pointing right
  • The y axis is pointing up
  • The z axis is pointing out of the screen.
The definition of right and up depend on the type of the ARObject the Drawable is attached to. In case of a GeoObject, the direction are defined relative to the earth's surface, and the Drawable is always oriented towards the user. In case of an Trackable2DObject, the directions are defined relative to the underlying tracked object.

Rotations are defined and applied in roll-tilt-heading definition (in this order), using static axis.

A drawable can be mirrored when using the front cam, by setting the mirrored flag. By default all drawables are mirrored except labels and HTMLDrawables, but the setting can be overridden.

Item Index

Methods

Properties

Events

Methods

destroy

()

Inherited from ARchitectObject

Destroys the object.

Properties

destroyed

Boolean

Inherited from ARchitectObject

Indicates if the object has already been destroyed.

enabled

Boolean

Flag to enable/disable the Drawable. If the Drawable is disabled, it will never appear on the screen and triggers on this Drawable will never be fired. In case it is enabled, it can be rendered on the screen and fire triggers.

Default: true

heading

Number deprecated

Deprecated: Use rotate.heading instead.

mirrored

Boolean

Flag to enable/disable mirroring for this Drawable. When using the front camera, a mirrored drawable will be rotated 180 degree around its y axis.

Default: true for generic drawables, false for labels and HTMLDrawables

roll

Number deprecated

Deprecated: Use rotate.roll instead.

rotate.heading

Number

Defines a rotation of the Drawable around the y-axis, specified in degrees. Values will be applied modulo 360. A value of 361 degrees has the same effect as setting the value to 1 degree.

Default: 0

rotate.roll

Number

Defines a rotation of the Drawable around the z-axis, specified in degrees. Values will be applied modulo 360. A value of 361 degrees has the same effect as setting the value to 1 degree.

Default: 0

rotate.tilt

Number

Defines a rotation of the Drawable around the x-axis, specified in degrees. Values will be applied modulo 360. A value of 361 degrees has the same effect as setting the value to 1 degree.

Default: 0

tilt

Number deprecated

Deprecated: Use rotate.tilt instead.

Events

onClick

When the Drawable is clicked, the system will trigger Drawable.onClick(ARObject). A click on the screen might hit multiple Drawables, thus a click creates a "clicked Drawables-queue", with the uppermost Drawable in the front of the queue. The return value of the function determines if, after the onClick()-Function was executed for this Drawable, the queue shall continue to execute onClick() for the next Drawable in the queue. In case the last Drawable in the queue still requests to continue the click-queue, ARObject.onClick() will be executed. If the queue still continues, context.onScreenClick() will be executed.

The return value of the function determines what happens next. If false, the click-queue should not stop with this Drawable. Thus, the next Drawable's onClick() function will be executed. This is the default value in case no return value is set or the function is not defined for this Drawable. If true, the queue-execution will stop at the current Drawable, underlying Drawables will not receive onClick() calls.

Event Payload:

  • arObject ARObject

    the ARObject the clicked Drawable is attached to.

    The trigger is null by default, and will thus result in no action executed when the trigger fires. A developer can add custom functionality by assigning a custom function to onClick.

triggers.onClick

deprecated

Deprecated: Use onClick instead.