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

  1. var interaction = new h3d.scene.Interactive(collider, s3d);
  2. interaction.onOver = function(event) {
  3. trace("over");
  4. }
  5. interaction.onOut = function(event) {
  6. trace("out");
  7. }
  8. interaction.onClick = function(event) {
  9. trace("click!");
  10. }
  11. interaction.onPush = function(event) {
  12. trace("down!");
  13. }
  14. interaction.onRelease = function(event) {
  15. trace("up!");
  16. }
  17. interaction.onClick = function(event) {
  18. trace("click!");
  19. }

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