content/hifi-content/caitlyn/production/lazybonesToybox/cameras/cameraFlasher6.js
2022-02-13 22:19:19 +01:00

46 lines
1.7 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

//
// Copyright 2016 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(){
var _this;
MyEntity = function() {
_this = this;
};
MyEntity.prototype = {
var IMPORT_URL = "http://hifi-content.s3.amazonaws.com/caitlyn/production/lazybonesToybox/cameras/cameraFlash2.svo.json";
var soundURL ='http://hifi-content.s3.amazonaws.com/caitlyn/production/lazybonesToybox/cameras/353044__montclairguy__camera-sound.wav';
var ringSound;
var entProperties = Entities.getEntityProperties(this.entityID);//, ["position", "rotation"]);//, "position").position;//Entities.getEntityProperties(this);
var jointNames = Entities.getJointNames(entProperties);
var jointIndex = Entities.getJointIndex(entProperties, "Flash");
var jointLocInObjectFrame = Entities.getAbsoluteJointTranslationInObjectFrame(entProperties, jointIndex);
var jointLocInWorld = Vec3.sum(entProperties.position, Vec3.multiplyQbyV(entProperties.rotation, jointLocInObjectFrame));
this.preload = function(entityID) {
print("preload("+entityID+")");
this.entityID = entityID;
ringSound = SoundCache.getSound(soundURL);
},
this.startNearGrab = function(entityID, mouseEvent) {
print("LOCATION IS "+jointLocInWorld.position);
Audio.playSound(ringSound, {
position: jointLocInWorld,
volume: 0.5
});
Script.setTimeout(function(){},2555);
var jointLocSphere = Entities.addEntity({type:"Sphere", position: jointLocInWorld.position});
Clipboard.importEntities(IMPORT_URL);
Clipboard.pasteEntities(jointLocInWorld.position);
},
};
return new MyEntity();
});