use JS method to enable/disable avatar collisions

This commit is contained in:
Faye Li 2017-04-07 10:02:30 -07:00
parent 97d75e654e
commit 3caea88641

View file

@ -13,7 +13,6 @@
// //
// Usage instruction: Spacebar toggles camera control - WASD first person free movement or no movement but allowing others to grab the selfie stick // Usage instruction: Spacebar toggles camera control - WASD first person free movement or no movement but allowing others to grab the selfie stick
// and control your camera. // and control your camera.
// For best result, turn off avatar collisions(Developer > Avatar > Uncheck Enable Avatar Collisions)
// //
(function() { // BEGIN LOCAL_SCOPE (function() { // BEGIN LOCAL_SCOPE
@ -25,12 +24,21 @@
var lensEntityID = null; var lensEntityID = null;
var freeMovementMode = true; var freeMovementMode = true;
turnOffAvatarCollisions();
changeAvatar(); changeAvatar();
importModel(); importModel();
processImportedEntities(); processImportedEntities();
setupSpaceBarControl(); setupSpaceBarControl();
Script.update.connect(update); Script.update.connect(update);
function turnOffAvatarCollisions() {
Menu.setIsOptionChecked("Enable avatar collisions", 0);
}
function turnOnAvatarCollisions() {
Menu.setIsOptionChecked("Enable avatar collisions", 1);
}
function changeAvatar() { function changeAvatar() {
originalAvatar = MyAvatar.skeletonModelURL; originalAvatar = MyAvatar.skeletonModelURL;
MyAvatar.skeletonModelURL = AVATAR_URL; MyAvatar.skeletonModelURL = AVATAR_URL;
@ -107,6 +115,7 @@
Camera.mode = "first person"; Camera.mode = "first person";
Controller.disableMapping("Handheld-Cam-Space-Bar"); Controller.disableMapping("Handheld-Cam-Space-Bar");
MyAvatar.skeletonModelURL = originalAvatar; MyAvatar.skeletonModelURL = originalAvatar;
turnOnAvatarCollisions();
} }
Script.scriptEnding.connect(cleanup); Script.scriptEnding.connect(cleanup);
}()); // END LOCAL_SCOPE }()); // END LOCAL_SCOPE