2014-02-24 19:24:45 -08:00
|
|
|
//
|
|
|
|
// hideAvatarExample.js
|
2014-04-08 17:58:02 -07:00
|
|
|
// examples
|
2014-02-24 19:24:45 -08:00
|
|
|
//
|
|
|
|
// Created by Brad Hefta-Gaub on 1/28/14.
|
2014-04-09 09:21:54 -07:00
|
|
|
// Copyright 2014 High Fidelity, Inc.
|
2014-02-24 19:24:45 -08:00
|
|
|
//
|
|
|
|
// This is an example script that demonstrates how to enable or disable local rendering of your own avatar
|
|
|
|
//
|
2014-04-08 18:00:24 -07:00
|
|
|
// Distributed under the Apache License, Version 2.0.
|
|
|
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
2014-02-24 19:24:45 -08:00
|
|
|
//
|
|
|
|
|
|
|
|
function keyReleaseEvent(event) {
|
2015-01-06 22:32:45 -08:00
|
|
|
if (event.text == "r") {
|
2014-02-24 19:24:45 -08:00
|
|
|
MyAvatar.shouldRenderLocally = !MyAvatar.shouldRenderLocally;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Map keyPress and mouse move events to our callbacks
|
|
|
|
Controller.keyReleaseEvent.connect(keyReleaseEvent);
|
|
|
|
|
|
|
|
|
|
|
|
function scriptEnding() {
|
|
|
|
// re-enabled the standard behavior
|
|
|
|
MyAvatar.shouldRenderLocally = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
Script.scriptEnding.connect(scriptEnding);
|