content/hifi-public/scripts/baseball/bat.js
Dale Glass 0d14e5a379 Initial data.
Needs a lot of cleanup. Data has been de-duplicated, and where identical copies existed, one of them
has been replaced with a symlink.

Some files have been excluded, such as binaries, installers and debug dumps. Some of that may still
be present.
2022-02-13 18:59:11 +01:00

43 lines
1.1 KiB
JavaScript

//
// bat.js
// examples/baseball/
//
// Created by Ryan Huffman on Nov 9, 2015
// Copyright 2015 High Fidelity, Inc.
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
(function() {
Script.include("pitching.js");
var pitchingMachine = null;
this.pitchAndHideAvatar = function() {
if (!pitchingMachine) {
pitchingMachine = getOrCreatePitchingMachine();
Script.update.connect(function(dt) { pitchingMachine.update(dt); });
}
pitchingMachine.start();
MyAvatar.shouldRenderLocally = false;
};
this.startNearGrab = function() {
// send the avatar to the baseball location so that they're ready to bat
location = "/baseball"
this.pitchAndHideAvatar()
};
this.continueNearGrab = function() {
this.pitchAndHideAvatar()
};
this.releaseGrab = function() {
if (pitchingMachine) {
pitchingMachine.stop();
}
MyAvatar.shouldRenderLocally = true;
};
});