Skip to content

Instantly share code, notes, and snippets.

@hyperlogic
Last active October 31, 2019 21:21
Show Gist options
  • Save hyperlogic/b66bd4c741eabd7be1ae5892fe7b7055 to your computer and use it in GitHub Desktop.
Save hyperlogic/b66bd4c741eabd7be1ae5892fe7b7055 to your computer and use it in GitHub Desktop.
// click to sit, click again to stand
(function () {
var seated = false;
var entity;
this.preload = function(entityID) {
entity = entityID;
};
this.clickDownOnEntity = function(entityID, mouseEvent) {
// If entity is clicked, sit
var props = Entities.getEntityProperties(entity, [ "position", "rotation" ]);
if (seated) {
MyAvatar.endSit(props.position, props.rotation);
} else {
MyAvatar.beginSit(props.position, props.rotation);
}
seated = !seated;
};
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment