Skip to content

H3D Events and Interactivity

Yuxiao Mao edited this page Oct 29, 2024 · 2 revisions

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.

Clone this wiki locally