Skip to content

Instantly share code, notes, and snippets.

@humbletim
Created July 9, 2016 16:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save humbletim/1fe05ac2be288fa005a580912970d76d to your computer and use it in GitHub Desktop.
Save humbletim/1fe05ac2be288fa005a580912970d76d to your computer and use it in GitHub Desktop.
Entity/Controller mouseMoveEvents test
var id = Entities.addEntity({
lifetime: 600,
type: 'Shape',
shape: 'Icosahedron',
position: MyAvatar.position,
dimensions: Vec3.ONE,
color: { red: 255, green: 0, blue: 255 },
collisionless: true,
script: Script.resolvePath('testDifferentMouseMoveEvents.js')
});
Script.scriptEnding.connect(function() { Entities.deleteEntity(id); });
(function() {
return {
mouseMoveEvent: function(arg1, arg2) {
if (typeof arg1 === 'string')
print('"mysterious" invocation as Entities.mouseMoveEvent(entityID, event)', [ arg2.x, arg2.y ]);
else
print('"intended" invocation as Controller.mouseMoveEvent(event)', [ arg1.x, arg1.y ]);
},
preload: function(entityID) {
Controller.mouseMoveEvent.connect(this, 'mouseMoveEvent');
},
unload: function(entityID) {
Controller.mouseMoveEvent.disconnect(this, 'mouseMoveEvent');
}
};
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment