Created
July 9, 2016 16:57
-
-
Save humbletim/1fe05ac2be288fa005a580912970d76d to your computer and use it in GitHub Desktop.
Entity/Controller mouseMoveEvents test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); }); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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