Skip to content

Latest commit

 

History

History
29 lines (25 loc) · 736 Bytes

H3D-Events-and-Interactivity.md

File metadata and controls

29 lines (25 loc) · 736 Bytes

Events and interaction

Making objects interactive is done creating a h3d.scene.Interactive instance. You give it a target object and attach it to a parent.

Interaction in H3D

var interaction = new h3d.scene.Interactive(collider, s3d);
interaction.onOver = function(event) {
	trace("over");
}
interaction.onOut = function(event) {
	trace("out");
}
interaction.onClick = function(event) {
	trace("click!");
}
interaction.onPush = function(event) {
	trace("down!");
}
interaction.onRelease = function(event) {
	trace("up!");
}
interaction.onClick = function(event) {
	trace("click!");
}

All events callbacks receive a hxd.Event instance, which contains info about the event.