UpdateEvent
Lens Studio v1.0.0+
Scripting Name: UpdateEvent
Inherits from SceneEvent
Description
Triggered every frame.
Methods
getDeltaTime()
: Number
Returns the time elapsed (in seconds) between the current frame and previous frame.
Inherited Methods
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
// Move this SceneObject up every frame with a speed of 5 units per second
var transform = script.getTransform();
var event = script.createEvent("UpdateEvent");
event.bind(function (eventData)
{
var pos = transform.getLocalPosition();
pos.y += eventData.getDeltaTime() * 5.0;
transform.setLocalPosition(pos);
});
Still Looking for help?
Visit Support