TapEvent
Lens Studio v1.0.0+
Scripting Name: TapEvent
Inherits from SceneObjectEvent
Description
This event is triggered when the user taps on the screen.
Methods
getTapPosition()
: vec2
Returns the normalized 2D screen position of the user’s tap. The normalized coordinates range from ([0-1], [0-1]), (0,0) being top-left and (1,1) being bottom-right.
Inherited Methods
getSceneObject()
: SceneObject
Returns the SceneObject this Event is associated with.
bind(function evCallback)
: void
Binds a callback function to this event.
getTypeName()
: String
Returns the typename of the SceneEvent.
getTypeName()
: String
Returns the name of this object’s type.
isOfType(String type)
: Boolean
Returns true if the object matches or derives from the passed in type.
Inherited Properties
enabled
: Boolean
If true, the event is able to trigger. If false, the event will not trigger.
Examples
function onTapped(eventData)
{
print("Tap Position: (" + eventData.getTapPosition().x + ", " + eventData.getTapPosition().y + ")");
}
var event = script.createEvent("TapEvent");
event.bind(onTapped);
Still Looking for help?
Visit Support