-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path__game-scripts.js
1 lines (1 loc) · 42.2 KB
/
__game-scripts.js
1
var Mouse=pc.createScript("mouse");Mouse.attributes.add("Selected",{type:"number",default:0}),Mouse.attributes.add("initialX",{type:"number",default:0}),Mouse.attributes.add("initialY",{type:"number",default:0}),Mouse.attributes.add("offsetX",{type:"number",default:0}),Mouse.attributes.add("offsetY",{type:"number",default:0}),Mouse.attributes.add("cam",{type:"entity"}),Mouse.prototype.initialize=function(){this.pos=new pc.Vec3,this.app.mouse.disableContextMenu(),this.app.mouse.on(pc.EVENT_MOUSEMOVE,this.onMouseMove,this),this.app.mouse.on(pc.EVENT_MOUSEDOWN,this.onMouseDown,this),this.app.mouse.on(pc.EVENT_MOUSEUP,this.onMouseUp,this);var t=this.app.mouse;t&&(t.on(pc.EVENT_TOUCHSTART,this.onTouchStart,this),t.on(pc.EVENT_TOUCHMOVE,this.onTouchMove,this),t.on(pc.EVENT_TOUCHEND,this.onTouchEnd,this),t.on(pc.EVENT_TOUCHCANCEL,this.onTouchCancel,this)),this.on("destroy",(function(){t.off(pc.EVENT_TOUCHSTART,this.onTouchStart,this),t.off(pc.EVENT_TOUCHMOVE,this.onTouchMove,this),t.off(pc.EVENT_TOUCHEND,this.onTouchEnd,this),t.off(pc.EVENT_TOUCHCANCEL,this.onTouchCancel,this)}),this)},Mouse.prototype.onMouseMove=function(t){if(1==this.Selected){var e=this.app.graphicsDevice.canvas.clientWidth,o=this.app.graphicsDevice.canvas.clientHeight,i=(o-t.y)/o*16,s=this.entity.getPosition(),n=this.app.root.findByName("Camera");n.camera.screenToWorld(t.x+this.offsetX,t.y+this.offsetY,i,this.pos),this.entity.translate(t.dx/e*-15*(this.entity.getPosition().distance(n.getPosition())/12),0,t.dy/e*-15),this.entity.getPosition().z>1.58&&this.entity.setPosition(this.pos.x,s.y,1.58)}},Mouse.prototype.updateFromScreen=function(t){if(1==this.Selected){var e=this.app.graphicsDevice.canvas.clientWidth,o=this.app.graphicsDevice.canvas.clientHeight,i=(o-t.y)/o*16,s=this.entity.getPosition(),n=this.app.root.findByName("Camera");n.camera.screenToWorld(t.x+this.offsetX,t.y+this.offsetY,i,this.pos),this.entity.translate(t.dx/e*-15*(this.entity.getPosition().distance(n.getPosition())/12),0,t.dy/e*-15),this.entity.getPosition().z>1.58&&this.entity.setPosition(this.pos.x,s.y,1.58)}},Mouse.prototype.onMouseDown=function(t){t.button,pc.MOUSEBUTTON_LEFT},Mouse.prototype.onMouseUp=function(t){t.button===pc.MOUSEBUTTON_LEFT&&(this.Selected=0)},Mouse.prototype.onTouchStart=function(t){1===t.touches.length&&this.updateFromScreen(t.touches[0]),t.event.preventDefault()},Mouse.prototype.onTouchMove=function(t){this.updateFromScreen(t.touches[0]),t.event.preventDefault()},Mouse.prototype.onTouchEnd=function(t){this.Selected=0,t.event.preventDefault()},Mouse.prototype.onTouchCancel=function(t){this.Selected=0,t.event.preventDefault()};var Touch=pc.createScript("touch");Touch.attributes.add("Selected",{type:"number",default:0}),Touch.prototype.initialize=function(){this.LastX=0,this.LastY=0,this.dx=0,this.dy=0,this.pos=new pc.Vec3,this.cameraEntity=this.app.root.findByName("Camera");var t=this.app.touch;t&&(t.on(pc.EVENT_TOUCHSTART,this.onTouchStart,this),t.on(pc.EVENT_TOUCHMOVE,this.onTouchMove,this),t.on(pc.EVENT_TOUCHEND,this.onTouchEnd,this),t.on(pc.EVENT_TOUCHCANCEL,this.onTouchCancel,this)),this.on("destroy",(function(){t.off(pc.EVENT_TOUCHSTART,this.onTouchStart,this),t.off(pc.EVENT_TOUCHMOVE,this.onTouchMove,this),t.off(pc.EVENT_TOUCHEND,this.onTouchEnd,this),t.off(pc.EVENT_TOUCHCANCEL,this.onTouchCancel,this)}),this)},Touch.prototype.updateFromScreen=function(t){if(1==this.Selected){var e=this.app.graphicsDevice.canvas.clientWidth,o=this.app.graphicsDevice.canvas.clientHeight,i=(o-t.y)/o*16,s=this.entity.getPosition(),h=this.app.root.findByName("Camera");h.camera.screenToWorld(t.x+this.offsetX,t.y+this.offsetY,i,this.pos),this.entity.translate(this.dx/e*-15*(this.entity.getPosition().distance(h.getPosition())/12),0,this.dy/e*-15),this.entity.getPosition().z>1.58&&this.entity.setPosition(this.pos.x,s.y,1.58)}},Touch.prototype.onTouchStart=function(t){1===t.touches.length&&(this.LastX=t.touches[0].x,this.LastY=t.touches[0].y,this.updateFromScreen(t.touches[0])),t.event.preventDefault()},Touch.prototype.onTouchMove=function(t){this.dx=t.touches[0].x-this.LastX,this.dy=t.touches[0].y-this.LastY,this.LastX=t.touches[0].x,this.LastY=t.touches[0].y,this.updateFromScreen(t.touches[0]),t.event.preventDefault()},Touch.prototype.onTouchEnd=function(t){this.Selected=0,t.event.preventDefault()},Touch.prototype.onTouchCancel=function(t){this.Selected=0,t.event.preventDefault()};var PickerRaycast=pc.createScript("pickerRaycast");PickerRaycast.prototype.initialize=function(){this.app.mouse.on(pc.EVENT_MOUSEDOWN,this.onSelect,this);var t=this.app.touch;t&&t.on(pc.EVENT_TOUCHSTART,this.onTouch,this),this.on("destroy",(function(){this.app.mouse.off(pc.EVENT_MOUSEDOWN,this.onSelect,this),t&&this.app.touch.off(pc.EVENT_TOUCHSTART,this.onTouch,this)}),this)},PickerRaycast.prototype.onSelect=function(t){var i=this.entity.camera.screenToWorld(t.x,t.y,this.entity.camera.nearClip),e=this.entity.camera.screenToWorld(t.x,t.y,this.entity.camera.farClip);this.app.systems.rigidbody.raycastFirst(i,e,(function(t){var i=t.entity;i.script.mouse&&(i.script.mouse.Selected=1),i.script.sliderHorizontal&&(i.script.sliderHorizontal.Selected=1),i.script.scaleSlider&&(i.script.scaleSlider.Selected=1),i.script.sliderVisible&&i.script.sliderVisible.showSlider(),i.script.sliderVertical&&(i.script.sliderVertical.Selected=1,console.log("Vert Slider Selected")),i.script.showHeightAndWidth&&i.script.showHeightAndWidth.showArrows(),console.log("raycastHit")}))},PickerRaycast.prototype.onTouch=function(t){var i=this.entity.camera.screenToWorld(t.touches[0].x,t.touches[0].y,this.entity.camera.nearClip),e=this.entity.camera.screenToWorld(t.touches[0].x,t.touches[0].y,this.entity.camera.farClip);console.log("raycastHit"),console.log("screenx: "+t.x+" screenY: "+t.y),console.log("from: "+i+" to: "+e),this.app.systems.rigidbody.raycastFirst(i,e,(function(t){var i=t.entity;i.script.touch&&(i.script.touch.Selected=1),i.script.sliderHorizontal&&(i.script.sliderHorizontal.Selected=1),i.script.scaleSlider&&(i.script.scaleSlider.Selected=1),i.script.sliderVisible&&i.script.sliderVisible.showSlider(),i.script.sliderVertical&&(i.script.sliderVertical.Selected=1),i.script.showHeightAndWidth&&i.script.showHeightAndWidth.showArrows(),console.log("raycastHitInside")}))};var LoadImage=pc.createScript("loadImage");LoadImage.attributes.add("url",{type:"string"}),LoadImage.prototype.initialize=function(){const e=window.location.search;console.log(e);const t=new URLSearchParams(e).get("filename");console.log(t),this.url=t,setInterval((function(){this.changeToNextTexture()}),1e3)},LoadImage.prototype.changeToNextTexture=function(){var e=new Image;e.crossOrigin="anonymous",e.onload=function(){var t=new pc.Texture(self.app.graphicsDevice);t.setSource(e);for(var a=this.entity.findComponents("render"),n=0;n<a.length;++n)for(var o=a[n].meshInstances,r=0;r<o.length;r++){var i=o[r].material;i.diffuseMap=t,i.update()}},e.src=this.url};var SwitchingTextures=pc.createScript("switchingTextures");SwitchingTextures.attributes.add("textures",{type:"asset",assetType:"texture",array:!0,title:"Textures"}),SwitchingTextures.attributes.add("url",{type:"string"}),SwitchingTextures.attributes.add("WebTexture",{type:"asset",assetType:"texture",array:!1,title:"WebTexture"}),SwitchingTextures.prototype.initialize=function(){var e=this;this.textureIndex=0;const t=window.location.search;console.log(t);const r=new URLSearchParams(t).get("filename");console.log(r),this.url=r,setInterval((function(){e.changeToNextTexture(),console.log("switchCalled")}),5e3)},SwitchingTextures.prototype.getTextureFromWeb=function(){var e=new Image;e.crossOrigin="anonymous",e.src=this.url,texture.setSource(e)},SwitchingTextures.prototype.changeToNextTexture=function(e){this.textureIndex=(this.textureIndex+1)%this.textures.length;var t=this.textures[this.textureIndex].resource,r=new Image;r.crossOrigin="anonymous",r.src=this.url,t.setSource(r);for(var s=this.entity.findComponents("render"),i=0;i<s.length;++i)for(var n=s[i].meshInstances,a=0;a<n.length;a++){var u=n[a].material;u.diffuseMap=t,u.emissiveMap=t,u.opacityMap=t,u.blendType="alpha",u.alphaTest=.686,u.update()}};var GetWidthFromUrlparams=pc.createScript("getWidthFromUrlparams");GetWidthFromUrlparams.attributes.add("width",{type:"string"}),GetWidthFromUrlparams.prototype.initialize=function(){const t=window.location.search;console.log(t);const r=new URLSearchParams(t).get("width");console.log(r),this.width=r,this.entity.element.text=this.width},GetWidthFromUrlparams.prototype.update=function(t){};var GetHeightFromUrlparams=pc.createScript("getHeightFromUrlparams");GetWidthFromUrlparams.attributes.add("height",{type:"string"}),GetHeightFromUrlparams.prototype.initialize=function(){const t=window.location.search;console.log(t);const e=new URLSearchParams(t).get("height");console.log(e),this.height=e,this.entity.element.text=this.height},GetHeightFromUrlparams.prototype.update=function(t){};var ShowHeightAndWidth=pc.createScript("showHeightAndWidth");ShowHeightAndWidth.attributes.add("width",{type:"entity"}),ShowHeightAndWidth.attributes.add("height",{type:"entity"}),ShowHeightAndWidth.attributes.add("hideInterval",{type:"number"}),ShowHeightAndWidth.attributes.add("baseScaleWidth",{type:"number"}),ShowHeightAndWidth.attributes.add("baseScaleHeight",{type:"number"}),ShowHeightAndWidth.attributes.add("physicalHeight",{type:"number"}),ShowHeightAndWidth.attributes.add("physicalWidth",{type:"number"}),ShowHeightAndWidth.attributes.add("ImageEntity",{type:"entity"}),ShowHeightAndWidth.prototype.initialize=function(){this.timer=0;const t=window.location.search;console.log(t);const i=new URLSearchParams(t),e=i.get("height");this.physicalHeight=parseFloat(e);const h=i.get("width");this.physicalWidth=parseFloat(h),console.log(h),this.ImageEntity.setLocalScale(this.physicalWidth/this.baseScaleWidth,this.entity.getLocalScale().y,this.physicalHeight/this.baseScaleHeight)},ShowHeightAndWidth.prototype.update=function(t){this.timer+=t,this.timer>this.hideInterval&&(this.timer=0,this.width.enabled=!1,this.height.enabled=!1)},ShowHeightAndWidth.prototype.showArrows=function(){this.timer=0,this.width.enabled=!0,this.height.enabled=!0};var ButtonLogic=pc.createScript("buttonLogic");ButtonLogic.attributes.add("textEntity",{type:"entity",description:"The entity that we want to update when the button is clicked"}),ButtonLogic.attributes.add("description",{type:"string"}),ButtonLogic.attributes.add("model",{type:"entity"}),ButtonLogic.prototype.initialize=function(){this.entity.button.on("click",(function(t){var e=this.textEntity.element.text,i=e.charAt(e.length-1),n=e[0],o=0,a=0;"6"==i?(o=0,i="0",a=parseInt(n),n=(++a).toString()):"0"==i&&(o=5,i="6",a=parseInt(n));var c=a.toString()+"."+o.toString(),r=parseFloat(c);this.model.setLocalScale(r/5.5*.105,r/5.5*.105,r/5.5*.105),this.textEntity.element.text=n+"'"+i}),this)};var ButtonLogic2=pc.createScript("buttonLogic2");ButtonLogic2.attributes.add("textEntity",{type:"entity",description:"The entity that we want to update when the button is clicked"}),ButtonLogic2.attributes.add("description",{type:"string"}),ButtonLogic2.attributes.add("model",{type:"entity"}),ButtonLogic2.prototype.initialize=function(){this.entity.button.on("click",(function(t){var e=this.textEntity.element.text,i=e.charAt(e.length-1),n=e[0],o=parseInt(i),a=parseInt(n);"6"==i?(o=0,i="0",a=parseInt(n)):"0"==i&&(o=5,i="6",a=parseInt(n),n=(--a).toString());var r=a.toString()+"."+o.toString(),c=parseFloat(r);this.model.setLocalScale(c/5.5*.105,c/5.5*.105,c/5.5*.105),this.textEntity.element.text=n+"'"+i}),this)};var SliderHorizontal=pc.createScript("sliderHorizontal");SliderHorizontal.attributes.add("Selected",{type:"number",default:0}),SliderHorizontal.attributes.add("SliderValue",{type:"number",default:0}),SliderHorizontal.attributes.add("MinLimit",{type:"entity"}),SliderHorizontal.attributes.add("MaxLimit",{type:"entity"}),SliderHorizontal.attributes.add("RoomWidth",{type:"entity"}),SliderHorizontal.attributes.add("RoomWidthText",{type:"entity"}),SliderHorizontal.attributes.add("MinLimitOffset",{type:"number",default:0}),SliderHorizontal.attributes.add("MaxLimitOffset",{type:"number",default:0}),SliderHorizontal.prototype.initialize=function(){this.pos=new pc.Vec3,this.roomWidthInitialScale=this.RoomWidth.getLocalScale().z,this.app.mouse.on(pc.EVENT_MOUSEMOVE,this.onMouseMove,this),this.app.mouse.on(pc.EVENT_MOUSEDOWN,this.onMouseDown,this),this.app.mouse.on(pc.EVENT_MOUSEUP,this.onMouseUp,this);var t=this.app.touch;t&&(t.on(pc.EVENT_TOUCHSTART,this.onTouchStart,this),t.on(pc.EVENT_TOUCHMOVE,this.onTouchMove,this),t.on(pc.EVENT_TOUCHEND,this.onTouchEnd,this),t.on(pc.EVENT_TOUCHCANCEL,this.onTouchCancel,this)),this.on("destroy",(function(){t.off(pc.EVENT_TOUCHSTART,this.onTouchStart,this),t.off(pc.EVENT_TOUCHMOVE,this.onTouchMove,this),t.off(pc.EVENT_TOUCHEND,this.onTouchEnd,this),t.off(pc.EVENT_TOUCHCANCEL,this.onTouchCancel,this)}),this)},SliderHorizontal.prototype.update=function(t){},SliderHorizontal.prototype.onMouseDown=function(t){},SliderHorizontal.prototype.onMouseMove=function(t){if(1==this.Selected){this.app.graphicsDevice.canvas.clientWidth,this.app.graphicsDevice.canvas.clientHeight;var i=this.entity.getPosition();this.app.root.findByName("Camera").camera.screenToWorld(t.x,t.y,.808,this.pos),this.entity.setPosition(this.pos.x,i.y,-5.18),console.log("This.x: "+this.entity.getPosition().x+"Max Limit: "+this.entity.getPosition().x),this.entity.getPosition().x<this.MaxLimit.getPosition().x+this.MaxLimitOffset&&this.entity.setPosition(this.MaxLimit.getPosition().x+this.MaxLimitOffset,this.entity.getPosition().y,this.entity.getPosition().z),this.entity.getPosition().x>this.MinLimit.getPosition().x-this.MinLimitOffset&&this.entity.setPosition(this.MinLimit.getPosition().x-this.MinLimitOffset,this.entity.getPosition().y,this.entity.getPosition().z);var e=this.MinLimit.getPosition().distance(this.MaxLimit.getPosition()),o=this.MinLimit.getPosition().distance(this.entity.getPosition());this.SliderValue=o/e,this.RoomWidth.setLocalScale(this.RoomWidth.getLocalScale().x,this.RoomWidth.getLocalScale().y,this.roomWidthInitialScale*(1+this.SliderValue));var s=2*(1+this.SliderValue);this.RoomWidthText.element.text=s.toFixed(1).toString()}},SliderHorizontal.prototype.onMouseUp=function(t){t.button===pc.MOUSEBUTTON_LEFT&&(this.Selected=0)},SliderHorizontal.prototype.updateFromScreen=function(t){if(1==this.Selected){this.app.graphicsDevice.canvas.clientWidth,this.app.graphicsDevice.canvas.clientHeight;var i=this.entity.getPosition();this.app.root.findByName("Camera").camera.screenToWorld(t.x,t.y,.808,this.pos),this.entity.setPosition(this.pos.x,i.y,-5.18),console.log("This.x: "+this.entity.getPosition().x+"Max Limit: "+this.entity.getPosition().x),this.entity.getPosition().x<this.MaxLimit.getPosition().x+this.MaxLimitOffset&&this.entity.setPosition(this.MaxLimit.getPosition().x+this.MaxLimitOffset,this.entity.getPosition().y,this.entity.getPosition().z),this.entity.getPosition().x>this.MinLimit.getPosition().x-this.MinLimitOffset&&this.entity.setPosition(this.MinLimit.getPosition().x-this.MinLimitOffset,this.entity.getPosition().y,this.entity.getPosition().z);var e=this.MinLimit.getPosition().distance(this.MaxLimit.getPosition()),o=this.MinLimit.getPosition().distance(this.entity.getPosition());this.SliderValue=o/e,this.RoomWidth.setLocalScale(this.RoomWidth.getLocalScale().x,this.RoomWidth.getLocalScale().y,this.roomWidthInitialScale*(1+this.SliderValue));var s=2*(1+this.SliderValue);this.RoomWidthText.element.text=s.toFixed(1).toString(),console.log(this.RoomWidth.getLocalScale()),console.log(this.SliderValue)}},SliderHorizontal.prototype.onTouchStart=function(t){1===t.touches.length&&this.updateFromScreen(t.touches[0]),t.event.preventDefault()},SliderHorizontal.prototype.onTouchMove=function(t){this.updateFromScreen(t.touches[0]),t.event.preventDefault()},SliderHorizontal.prototype.onTouchEnd=function(t){this.Selected=0,t.event.preventDefault()},SliderHorizontal.prototype.onTouchCancel=function(t){this.Selected=0,t.event.preventDefault()};var SliderVertical=pc.createScript("sliderVertical");SliderVertical.attributes.add("Selected",{type:"number",default:0}),SliderVertical.attributes.add("SliderValue",{type:"number",default:0}),SliderVertical.attributes.add("MinLimit",{type:"entity"}),SliderVertical.attributes.add("MaxLimit",{type:"entity"}),SliderVertical.attributes.add("Ceiling",{type:"entity"}),SliderVertical.attributes.add("CeilingHeightText",{type:"entity"}),SliderVertical.attributes.add("MinLimitOffset",{type:"number",default:0}),SliderVertical.attributes.add("MaxLimitOffset",{type:"number",default:0}),SliderVertical.attributes.add("RaiseFactor",{type:"number",default:1}),SliderVertical.prototype.initialize=function(){this.pos=new pc.Vec3,this.initialCielingHeight=this.Ceiling.getPosition().y,this.app.mouse.on(pc.EVENT_MOUSEMOVE,this.onMouseMove,this),this.app.mouse.on(pc.EVENT_MOUSEDOWN,this.onMouseDown,this),this.app.mouse.on(pc.EVENT_MOUSEUP,this.onMouseUp,this);var i=this.MinLimit.getPosition().distance(this.MaxLimit.getPosition()),t=this.MinLimit.getPosition().distance(this.entity.getPosition());this.SliderValue=t/i,this.Ceiling.setLocalPosition(this.Ceiling.getPosition().x,this.initialCielingHeight+this.SliderValue*this.RaiseFactor,this.Ceiling.getPosition().z),this.CeilingHeightText.element.text=(this.initialCielingHeight+this.SliderValue*this.RaiseFactor).toFixed(1).toString();var e=this.app.touch;e&&(e.on(pc.EVENT_TOUCHSTART,this.onTouchStart,this),e.on(pc.EVENT_TOUCHMOVE,this.onTouchMove,this),e.on(pc.EVENT_TOUCHEND,this.onTouchEnd,this),e.on(pc.EVENT_TOUCHCANCEL,this.onTouchCancel,this)),this.on("destroy",(function(){e.off(pc.EVENT_TOUCHSTART,this.onTouchStart,this),e.off(pc.EVENT_TOUCHMOVE,this.onTouchMove,this),e.off(pc.EVENT_TOUCHEND,this.onTouchEnd,this),e.off(pc.EVENT_TOUCHCANCEL,this.onTouchCancel,this)}),this)},SliderVertical.prototype.update=function(i){},SliderVertical.prototype.onMouseDown=function(i){},SliderVertical.prototype.onMouseMove=function(i){if(1==this.Selected){this.app.graphicsDevice.canvas.clientWidth,this.app.graphicsDevice.canvas.clientHeight;var t=this.entity.getPosition();this.app.root.findByName("Camera").camera.screenToWorld(i.x,i.y,.808,this.pos),this.entity.setPosition(t.x,this.pos.y,-5.18),this.entity.getPosition().y>this.MaxLimit.getPosition().y-this.MaxLimitOffset&&this.entity.setPosition(this.entity.getPosition().x,this.MaxLimit.getPosition().y-this.MaxLimitOffset,this.entity.getPosition().z),this.entity.getPosition().y<this.MinLimit.getPosition().y-this.MinLimitOffset&&this.entity.setPosition(this.entity.getPosition().x,this.MinLimit.getPosition().y-this.MinLimitOffset,this.entity.getPosition().z);var e=this.MinLimit.getPosition().distance(this.MaxLimit.getPosition()),s=this.MinLimit.getPosition().distance(this.entity.getPosition());this.SliderValue=s/e,this.Ceiling.setLocalPosition(this.Ceiling.getPosition().x,this.initialCielingHeight+this.SliderValue*this.RaiseFactor,this.Ceiling.getPosition().z),this.CeilingHeightText.element.text=(this.initialCielingHeight+this.SliderValue*this.RaiseFactor).toFixed(1).toString()}},SliderVertical.prototype.onMouseUp=function(i){i.button===pc.MOUSEBUTTON_LEFT&&(this.Selected=0)},SliderVertical.prototype.updateFromScreen=function(i){if(1==this.Selected){this.app.graphicsDevice.canvas.clientWidth,this.app.graphicsDevice.canvas.clientHeight;var t=this.entity.getPosition();this.app.root.findByName("Camera").camera.screenToWorld(i.x,i.y,.808,this.pos),this.entity.setPosition(t.x,this.pos.y,-5.18),this.entity.getPosition().y>this.MaxLimit.getPosition().y-this.MaxLimitOffset&&this.entity.setPosition(this.entity.getPosition().x,this.MaxLimit.getPosition().y-this.MaxLimitOffset,this.entity.getPosition().z),this.entity.getPosition().y<this.MinLimit.getPosition().y-this.MinLimitOffset&&this.entity.setPosition(this.entity.getPosition().x,this.MinLimit.getPosition().y-this.MinLimitOffset,this.entity.getPosition().z);var e=this.MinLimit.getPosition().distance(this.MaxLimit.getPosition()),s=this.MinLimit.getPosition().distance(this.entity.getPosition());this.SliderValue=s/e,this.Ceiling.setLocalPosition(this.Ceiling.getPosition().x,this.initialCielingHeight+this.SliderValue*this.RaiseFactor,this.Ceiling.getPosition().z),this.CeilingHeightText.element.text=(this.initialCielingHeight+this.SliderValue*this.RaiseFactor).toFixed(1).toString()}},SliderVertical.prototype.onTouchStart=function(i){1===i.touches.length&&this.updateFromScreen(i.touches[0]),i.event.preventDefault()},SliderVertical.prototype.onTouchMove=function(i){this.updateFromScreen(i.touches[0]),i.event.preventDefault()},SliderVertical.prototype.onTouchEnd=function(i){this.Selected=0,i.event.preventDefault()},SliderVertical.prototype.onTouchCancel=function(i){this.Selected=0,i.event.preventDefault()};var ScaleSlider=pc.createScript("scaleSlider");ScaleSlider.attributes.add("Selected",{type:"number",default:0}),ScaleSlider.attributes.add("SliderValue",{type:"number",default:0}),ScaleSlider.attributes.add("MinLimit",{type:"entity"}),ScaleSlider.attributes.add("MaxLimit",{type:"entity"}),ScaleSlider.attributes.add("Model",{type:"entity"}),ScaleSlider.attributes.add("ModelHeightText",{type:"entity"}),ScaleSlider.attributes.add("ParentPlane",{type:"entity"}),ScaleSlider.attributes.add("MinLimitOffset",{type:"number",default:0}),ScaleSlider.attributes.add("MaxLimitOffset",{type:"number",default:0}),ScaleSlider.attributes.add("RaiseFactor",{type:"number",default:1}),ScaleSlider.prototype.initialize=function(){this.pos=new pc.Vec3,this.initialScale=new pc.Vec3(this.Model.getLocalScale().x,this.Model.getLocalScale().y,this.Model.getLocalScale().z),this.app.mouse.on(pc.EVENT_MOUSEMOVE,this.onMouseMove,this),this.app.mouse.on(pc.EVENT_MOUSEDOWN,this.onMouseDown,this),this.app.mouse.on(pc.EVENT_MOUSEUP,this.onMouseUp,this);var t=this.app.touch;t&&(t.on(pc.EVENT_TOUCHSTART,this.onTouchStart,this),t.on(pc.EVENT_TOUCHMOVE,this.onTouchMove,this),t.on(pc.EVENT_TOUCHEND,this.onTouchEnd,this),t.on(pc.EVENT_TOUCHCANCEL,this.onTouchCancel,this)),this.on("destroy",(function(){t.off(pc.EVENT_TOUCHSTART,this.onTouchStart,this),t.off(pc.EVENT_TOUCHMOVE,this.onTouchMove,this),t.off(pc.EVENT_TOUCHEND,this.onTouchEnd,this),t.off(pc.EVENT_TOUCHCANCEL,this.onTouchCancel,this)}),this);var i=this.MinLimit.getPosition().distance(this.MaxLimit.getPosition()),e=this.MinLimit.getPosition().distance(this.entity.getPosition());this.SliderValue=e/i,this.Model.setLocalScale(this.initialScale.x*(1+.2858*this.SliderValue),this.initialScale.y*(1+.2858*this.SliderValue),this.initialScale.z*(1+.2858*this.SliderValue)),this.ModelHeightText.element.text=(140+40*this.SliderValue).toFixed(0).toString()},ScaleSlider.prototype.update=function(t){},ScaleSlider.prototype.onMouseDown=function(t){},ScaleSlider.prototype.onMouseMove=function(t){if(1==this.Selected){this.app.graphicsDevice.canvas.clientWidth;var i=this.app.graphicsDevice.canvas.clientHeight,e=(this.entity.getPosition(),this.app.root.findByName("Camera"));this.entity.translate(0,t.dy/i*560*-.01*(this.entity.getPosition().distance(e.getPosition())/6.5),0),this.entity.getPosition().y>this.MaxLimit.getPosition().y&&this.entity.setPosition(this.entity.getPosition().x,this.MaxLimit.getPosition().y,this.entity.getPosition().z),this.entity.getPosition().y<this.MinLimit.getPosition().y&&this.entity.setPosition(this.entity.getPosition().x,this.MinLimit.getPosition().y,this.entity.getPosition().z);var s=this.MinLimit.getPosition().distance(this.MaxLimit.getPosition()),o=this.MinLimit.getPosition().distance(this.entity.getPosition());this.SliderValue=o/s,this.Model.setLocalScale(this.initialScale.x*(1+.2858*this.SliderValue),this.initialScale.y*(1+.2858*this.SliderValue),this.initialScale.z*(1+.2858*this.SliderValue)),this.ModelHeightText.element.text=(140+40*this.SliderValue).toFixed(0).toString(),console.log(this.Model.getLocalScale())}},ScaleSlider.prototype.onMouseUp=function(t){t.button===pc.MOUSEBUTTON_LEFT&&(this.Selected=0)},ScaleSlider.prototype.updateFromScreen=function(t){if(1==this.Selected){this.app.graphicsDevice.canvas.clientWidth;var i=this.app.graphicsDevice.canvas.clientHeight;this.entity.getPosition(),this.app.root.findByName("Camera");this.entity.translate(0,this.dy/i*560*-5e-4,0),this.entity.getPosition().y>this.MaxLimit.getPosition().y&&this.entity.setPosition(this.entity.getPosition().x,this.MaxLimit.getPosition().y,this.entity.getPosition().z),this.entity.getPosition().y<this.MinLimit.getPosition().y&&this.entity.setPosition(this.entity.getPosition().x,this.MinLimit.getPosition().y,this.entity.getPosition().z);var e=this.MinLimit.getPosition().distance(this.MaxLimit.getPosition()),s=this.MinLimit.getPosition().distance(this.entity.getPosition());this.SliderValue=s/e,this.Model.setLocalScale(this.initialScale.x*(1+.2858*this.SliderValue),this.initialScale.y*(1+.2858*this.SliderValue),this.initialScale.z*(1+.2858*this.SliderValue)),this.ModelHeightText.element.text=(140+40*this.SliderValue).toFixed(0).toString(),console.log(this.Model.getLocalScale())}},ScaleSlider.prototype.onTouchStart=function(t){this.LastX=t.touches[0].x,this.LastY=t.touches[0].y,1===t.touches.length&&this.updateFromScreen(t.touches[0]),t.event.preventDefault()},ScaleSlider.prototype.onTouchMove=function(t){this.dx=t.touches[0].x-this.LastX,this.dy=t.touches[0].y-this.LastY,LastX=t.touches[0].x,LastY=t.touches[0].y,this.updateFromScreen(t.touches[0]),t.event.preventDefault()},ScaleSlider.prototype.onTouchEnd=function(t){this.Selected=0,t.event.preventDefault()},ScaleSlider.prototype.onTouchCancel=function(t){this.Selected=0,t.event.preventDefault()};var SliderVisible=pc.createScript("sliderVisible");SliderVisible.attributes.add("SliderEntity",{type:"entity"}),SliderVisible.attributes.add("Interval",{type:"number",default:5}),SliderVisible.prototype.initialize=function(){this.timer=0},SliderVisible.prototype.update=function(i){this.timer+=i,this.timer>this.Interval&&(this.timer=0,this.SliderEntity.enabled=!1)},SliderVisible.prototype.showSlider=function(){this.timer=0,this.SliderEntity.enabled=!0};pc.script.createLoadingScreen((function(e){var t,a;t=["body {"," background-color: #283538;","}","","#application-splash-wrapper {"," position: absolute;"," top: 0;"," left: 0;"," height: 100%;"," width: 100%;"," background-color: #ffffff;","}","","#application-splash {"," position: absolute;"," top: calc(50% - 28px);"," width: 264px;"," left: calc(50% - 132px);","}","","#application-splash img {"," width: 100%;","}","","#progress-bar-container {"," margin: 20px auto 0 auto;"," height: 2px;"," width: 100%;"," background-color: #1d292c;","}","","#progress-bar {"," width: 0%;"," height: 100%;"," background-color: #eeeeee;","}","","@media (max-width: 480px) {"," #application-splash {"," width: 170px;"," left: calc(50% - 85px);"," }","}"].join("\n"),(a=document.createElement("style")).type="text/css",a.styleSheet?a.styleSheet.cssText=t:a.appendChild(document.createTextNode(t)),document.head.appendChild(a),function(){var e=document.createElement("div");e.id="application-splash-wrapper",document.body.appendChild(e);var t=document.createElement("div");t.id="application-splash",e.appendChild(t),t.style.display="none";var a=document.createElement("img");a.src="https://farsh-mobile.s3.me-south-1.amazonaws.com/farsh_logo_high_res_1.png",t.appendChild(a),a.onload=function(){t.style.display="block"};var o=document.createElement("div");o.id="progress-bar-container",t.appendChild(o);var n=document.createElement("div");n.id="progress-bar",o.appendChild(n)}(),e.on("preload:end",(function(){e.off("preload:progress")})),e.on("preload:progress",(function(e){var t=document.getElementById("progress-bar");t&&(e=Math.min(1,Math.max(0,e)),t.style.width=100*e+"%")})),e.on("start",(function(){var e=document.getElementById("application-splash-wrapper");e.parentElement.removeChild(e)}))}));var UISlider=pc.createScript("uiSlider");UISlider.attributes.add("handle",{type:"entity",default:null,title:"Handle"}),UISlider.attributes.add("axis",{type:"string",default:"y",title:"Axis",description:"lock drag to axis: x, y or xy"}),UISlider.attributes.add("upperLimit",{type:"entity",default:null,title:"upperLimit"}),UISlider.attributes.add("lowerLimit",{type:"entity",default:null,title:"lowerLimit"}),UISlider.attributes.add("val",{type:"number",default:0}),UISlider.prototype.postInitialize=function(){if(this.handle||(this.handle=this.entity.parent.findByName("UISliderHandle")),!this.handle)throw new Error("UISlider has no handle");this.addHandleListeners(),this.isDragging=!1,this.touchId=-1,this.mousePos=new pc.Vec3,this.anchorPos=this.handle.getLocalPosition().clone(),this.screen=this.getUIScreenComponent()},UISlider.prototype.getUIScreenComponent=function(){return this.handle.element.screen.screen},UISlider.prototype.addHandleListeners=function(){this.handle.element.useInput=!0,this.handle.element.on(pc.EVENT_MOUSEDOWN,this.onPressDown,this),this.app.mouse.on(pc.EVENT_MOUSEUP,this.onPressUp,this),this.app.mouse.on(pc.EVENT_MOUSEMOVE,this.onPressMove,this),this.app.touch&&(console.log("initing touches"),this.handle.element.on(pc.EVENT_TOUCHSTART,this.onTouchStart,this),this.app.touch.on(pc.EVENT_TOUCHEND,this.onTouchEnd,this),this.app.touch.on(pc.EVENT_TOUCHCANCEL,this.onTouchEnd,this),this.app.touch.on(pc.EVENT_TOUCHMOVE,this.onTouchMove,this)),this.on("destroy",(function(){this.handle.element.off(pc.EVENT_MOUSEDOWN,this.onPressDown,this),this.app.mouse.off(pc.EVENT_MOUSEUP,this.onPressUp,this),this.app.mouse.off(pc.EVENT_MOUSEMOVE,this.onPressMove,this),this.app.touch&&(this.handle.element.off(pc.EVENT_TOUCHSTART,this.onTouchStart,this),this.app.touch.off(pc.EVENT_TOUCHEND,this.onTouchEnd,this),this.app.touch.off(pc.EVENT_TOUCHCANCEL,this.onTouchEnd,this),this.app.touch.off(pc.EVENT_TOUCHMOVE,this.onTouchMove,this))}))},UISlider.prototype.onTouchStart=function(t){var i=t.changedTouches[0];this.touchId=i.identifier,this.startDrag(t.x,t.y),t.event.stopPropagation()},UISlider.prototype.onTouchMove=function(t){for(var i=0;i<t.changedTouches.length;i++){var e=t.changedTouches[i];if(e.id==this.touchId)return t.event.stopPropagation(),void this.updateMove(e.x,e.y)}},UISlider.prototype.onTouchEnd=function(t){for(var i=0;i<t.changedTouches.length;i++){var e=t.changedTouches[i];if(e.id==this.touchId)return t.event.stopImmediatePropagation(),this.touchId=-1,void this.endDrag(e.x,e.y)}},UISlider.prototype.onPressDown=function(t){t.event.stopImmediatePropagation(),this.startDrag(t.x,t.y)},UISlider.prototype.onPressUp=function(t){t.event.stopImmediatePropagation(),this.endDrag(t.x,t.y)},UISlider.prototype.onPressMove=function(t){this.updateMove(t.x,t.y),t.event.stopImmediatePropagation()},UISlider.prototype.startDrag=function(t,i){this.isDragging=!0,this.setMouseXY(t,i)},UISlider.prototype.updateMove=function(t,i){this.isDragging&&this.setMouseXY(t,i)},UISlider.prototype.endDrag=function(t,i){this.isDragging=!1,this.setMouseXY(t,i)},UISlider.prototype.setMouseXY=function(t,i){this.mousePos.x=t,this.mousePos.y=i},UISlider.prototype.update=function(t){this.updateDrag(),"y"==this.axis&&(this.handle.getLocalPosition().y>this.upperLimit.getLocalPosition().y&&this.handle.setLocalPosition(this.handle.getLocalPosition().x,this.upperLimit.getLocalPosition().y,0),this.handle.getLocalPosition().y<this.lowerLimit.getLocalPosition().y&&this.handle.setLocalPosition(this.handle.getLocalPosition().x,this.lowerLimit.getLocalPosition().y,0)),"x"==this.axis&&(this.handle.getLocalPosition().x>this.upperLimit.getLocalPosition().x&&this.handle.setLocalPosition(this.upperLimit.getLocalPosition().x,this.handle.getLocalPosition().y,0),this.handle.getLocalPosition().x<this.lowerLimit.getLocalPosition().x&&this.handle.setLocalPosition(this.lowerLimit.getLocalPosition().x,this.handle.getLocalPosition().y,0));var i=this.lowerLimit.getPosition().distance(this.upperLimit.getPosition()),e=this.lowerLimit.getPosition().distance(this.entity.getPosition());this.val=e/i},UISlider.prototype.updateDrag=function(){if(this.isDragging){var t=this.app.graphicsDevice,i=this.handle.element.anchor.x*t.width/(1.01*t.maxPixelRatio),e=this.handle.element.anchor.y*t.height/(1.01*t.maxPixelRatio),o=1/this.screen.scale,s="x"==this.axis||"xy"==this.axis?(this.mousePos.x-i)*o:this.anchorPos.x,n="y"==this.axis||"xy"==this.axis?(-this.mousePos.y+e)*o:this.anchorPos.y;this.handle.setLocalPosition(s,n,0)}};function FxaaEffect(e){pc.PostEffect.call(this,e);var o={aPosition:pc.SEMANTIC_POSITION},t=["attribute vec2 aPosition;","","void main(void)","{"," gl_Position = vec4(aPosition, 0.0, 1.0);","}"].join("\n"),a=["precision "+e.precision+" float;","","uniform sampler2D uColorBuffer;","uniform vec2 uResolution;","","#define FXAA_REDUCE_MIN (1.0/128.0)","#define FXAA_REDUCE_MUL (1.0/8.0)","#define FXAA_SPAN_MAX 8.0","","void main()","{"," vec3 rgbNW = texture2D( uColorBuffer, ( gl_FragCoord.xy + vec2( -1.0, -1.0 ) ) * uResolution ).xyz;"," vec3 rgbNE = texture2D( uColorBuffer, ( gl_FragCoord.xy + vec2( 1.0, -1.0 ) ) * uResolution ).xyz;"," vec3 rgbSW = texture2D( uColorBuffer, ( gl_FragCoord.xy + vec2( -1.0, 1.0 ) ) * uResolution ).xyz;"," vec3 rgbSE = texture2D( uColorBuffer, ( gl_FragCoord.xy + vec2( 1.0, 1.0 ) ) * uResolution ).xyz;"," vec4 rgbaM = texture2D( uColorBuffer, gl_FragCoord.xy * uResolution );"," vec3 rgbM = rgbaM.xyz;"," float opacity = rgbaM.w;",""," vec3 luma = vec3( 0.299, 0.587, 0.114 );",""," float lumaNW = dot( rgbNW, luma );"," float lumaNE = dot( rgbNE, luma );"," float lumaSW = dot( rgbSW, luma );"," float lumaSE = dot( rgbSE, luma );"," float lumaM = dot( rgbM, luma );"," float lumaMin = min( lumaM, min( min( lumaNW, lumaNE ), min( lumaSW, lumaSE ) ) );"," float lumaMax = max( lumaM, max( max( lumaNW, lumaNE) , max( lumaSW, lumaSE ) ) );",""," vec2 dir;"," dir.x = -((lumaNW + lumaNE) - (lumaSW + lumaSE));"," dir.y = ((lumaNW + lumaSW) - (lumaNE + lumaSE));",""," float dirReduce = max( ( lumaNW + lumaNE + lumaSW + lumaSE ) * ( 0.25 * FXAA_REDUCE_MUL ), FXAA_REDUCE_MIN );",""," float rcpDirMin = 1.0 / ( min( abs( dir.x ), abs( dir.y ) ) + dirReduce );"," dir = min( vec2( FXAA_SPAN_MAX, FXAA_SPAN_MAX), max( vec2(-FXAA_SPAN_MAX, -FXAA_SPAN_MAX), dir * rcpDirMin)) * uResolution;",""," vec3 rgbA = 0.5 * ("," texture2D( uColorBuffer, gl_FragCoord.xy * uResolution + dir * ( 1.0 / 3.0 - 0.5 ) ).xyz +"," texture2D( uColorBuffer, gl_FragCoord.xy * uResolution + dir * ( 2.0 / 3.0 - 0.5 ) ).xyz );",""," vec3 rgbB = rgbA * 0.5 + 0.25 * ("," texture2D( uColorBuffer, gl_FragCoord.xy * uResolution + dir * -0.5 ).xyz +"," texture2D( uColorBuffer, gl_FragCoord.xy * uResolution + dir * 0.5 ).xyz );",""," float lumaB = dot( rgbB, luma );",""," if ( ( lumaB < lumaMin ) || ( lumaB > lumaMax ) )"," {"," gl_FragColor = vec4( rgbA, opacity );"," }"," else"," {"," gl_FragColor = vec4( rgbB, opacity );"," }","}"].join("\n");this.fxaaShader=new pc.Shader(e,{attributes:o,vshader:t,fshader:a}),this.resolution=new Float32Array(2)}FxaaEffect.prototype=Object.create(pc.PostEffect.prototype),FxaaEffect.prototype.constructor=FxaaEffect,Object.assign(FxaaEffect.prototype,{render:function(e,o,t){var a=this.device,r=a.scope;this.resolution[0]=1/e.width,this.resolution[1]=1/e.height,r.resolve("uResolution").setValue(this.resolution),r.resolve("uColorBuffer").setValue(e.colorBuffer),pc.drawFullscreenQuad(a,o,this.vertexBuffer,this.fxaaShader,t)}});var Fxaa=pc.createScript("fxaa");Fxaa.prototype.initialize=function(){this.effect=new FxaaEffect(this.app.graphicsDevice);var e=this.entity.camera.postEffects;e.addEffect(this.effect),this.on("state",(function(o){o?e.addEffect(this.effect):e.removeEffect(this.effect)})),this.on("destroy",(function(){e.removeEffect(this.effect)}))};var CeilingHeightController=pc.createScript("ceilingHeightController");CeilingHeightController.attributes.add("ceiling",{type:"entity",default:null,title:"ceiling"}),CeilingHeightController.attributes.add("sliderKnot",{type:"entity",default:null,title:"sliderKnot"}),CeilingHeightController.attributes.add("ceilText",{type:"entity",default:null,title:"ceilText"}),CeilingHeightController.prototype.initialize=function(){this.initialHeight=this.ceiling.getLocalPosition().y},CeilingHeightController.prototype.update=function(i){this.ceiling.setLocalPosition(this.ceiling.getLocalPosition().x,this.initialHeight+this.sliderKnot.script.uiSlider.val,this.ceiling.getLocalPosition().z),this.ceilText.element.text="H: "+this.ceiling.getLocalPosition().y.toFixed(1).toString()+"m"};var Debug=pc.createScript("debug");Debug.attributes.add("DebugElement",{type:"entity",default:null,title:"sliderKnot"}),Debug.attributes.add("sliderKnot",{type:"entity",default:null,title:"sliderKnot"}),Debug.prototype.initialize=function(){},Debug.prototype.update=function(t){this.entity.element.text=this.sliderKnot.script.uiSlider.val.toString()};var RoomWidthController=pc.createScript("roomWidthController");RoomWidthController.attributes.add("room",{type:"entity",default:null,title:"room"}),RoomWidthController.attributes.add("sliderKnot",{type:"entity",default:null,title:"sliderKnot"}),RoomWidthController.attributes.add("initialWidthScale",{type:"number",default:.5}),RoomWidthController.attributes.add("minWidth",{type:"number",default:3.6}),RoomWidthController.attributes.add("maxWidth",{type:"number",default:6}),RoomWidthController.attributes.add("UiWidthText",{type:"entity",default:null,title:"UiWidthText"}),RoomWidthController.prototype.initialize=function(){},RoomWidthController.prototype.update=function(t){var i=this.sliderKnot.script.uiSlider.val,o=this.maxWidth-this.minWidth;this.room.setLocalScale(this.room.getLocalScale().x,this.room.getLocalScale().y,(this.minWidth+o*i)/(this.minWidth/this.initialWidthScale)),this.UiWidthText.element.text="W: "+(this.minWidth+o*i).toFixed(1).toString()+"m"};var FollowWorldTarget=pc.createScript("followWorldTarget");FollowWorldTarget.attributes.add("target",{type:"entity"}),FollowWorldTarget.attributes.add("camera",{type:"entity"}),FollowWorldTarget.prototype.initialize=function(){},FollowWorldTarget.prototype.postUpdate=function(t){var e=this.target.getPosition(),i=new pc.Vec3;if(this.camera.camera.worldToScreen(e,i),i.z>0){this.entity.element.enabled=!0;var a=this.app.graphicsDevice.maxPixelRatio;i.x*=a,i.y*=a;var o=this.app.graphicsDevice;this.entity.setPosition(i.x/o.width*2-1,2*(1-i.y/o.height)-1,0)}else this.entity.element.enabled=!1};var ShowResizeOptions=pc.createScript("showResizeOptions");ShowResizeOptions.attributes.add("VertSlider",{type:"entity",description:"The entity that we want to update when the button is clicked"}),ShowResizeOptions.attributes.add("HorSlider",{type:"entity",description:"The entity that we want to update when the button is clicked"}),ShowResizeOptions.attributes.add("HeightShow",{type:"entity",description:"The entity that we want to update when the button is clicked"}),ShowResizeOptions.attributes.add("WidthShow",{type:"entity",description:"The entity that we want to update when the button is clicked"}),ShowResizeOptions.attributes.add("Toggle",{type:"number",description:"The entity that we want to update when the button is clicked"}),ShowResizeOptions.prototype.initialize=function(){this.entity.button.on("click",(function(t){0==this.Toggle?(this.Toggle=1,this.VertSlider.enabled=!0,this.HorSlider.enabled=!0,this.HeightShow.enabled=!0,this.WidthShow.enabled=!0):(this.Toggle=0,this.VertSlider.enabled=!1,this.HorSlider.enabled=!1,this.HeightShow.enabled=!1,this.WidthShow.enabled=!1),console.log("CHAL GYA")}),this)},ShowResizeOptions.prototype.update=function(t){};var UnscaleFromParents=pc.createScript("unscaleFromParents");UnscaleFromParents.attributes.add("parent",{type:"entity",default:null,title:"parent"}),UnscaleFromParents.attributes.add("invertZandY",{type:"boolean"}),UnscaleFromParents.attributes.add("targetValueX",{type:"number"}),UnscaleFromParents.attributes.add("targetValueY",{type:"number"}),UnscaleFromParents.attributes.add("targetValueZ",{type:"number"}),UnscaleFromParents.prototype.initialize=function(){},UnscaleFromParents.prototype.update=function(t){1==this.invertZandY?this.entity.setLocalScale(this.targetValueX*(1/this.parent.getLocalScale().x),1*this.targetValueY/this.parent.getLocalScale().z,1*this.targetValueZ/this.parent.getLocalScale().y):this.entity.setLocalScale(this.targetValueX*(1/this.parent.getLocalScale().x),1*this.targetValueY/this.parent.getLocalScale().y,1*this.targetValueZ/this.parent.getLocalScale().z)};var MatchTargetScale=pc.createScript("matchTargetScale");MatchTargetScale.attributes.add("target",{type:"entity"}),MatchTargetScale.attributes.add("matchX",{type:"boolean"}),MatchTargetScale.attributes.add("matchY",{type:"boolean"}),MatchTargetScale.attributes.add("matchZ",{type:"boolean"}),MatchTargetScale.prototype.initialize=function(){this.initialX=this.entity.getLocalScale().x,this.initialY=this.entity.getLocalScale().y,this.initialZ=this.entity.getLocalScale().z},MatchTargetScale.prototype.update=function(t){1==this.matchX&&(this.entity.setLocalScale(this.initialX*this.target.getLocalScale().x,this.entity.getLocalScale().y,this.entity.getLocalScale().z),console.log(this.target.getLocalScale().x/this.initialTargetX)),1==this.matchY&&this.entity.setLocalScale(this.entity.getLocalScale().x,this.target.getLocalScale().y,this.entity.getLocalScale().z),1==this.matchZ&&this.entity.setLocalScale(this.entity.getLocalScale().x,this.entity.getLocalScale().y,this.target.getLocalScale().z)};var MantainDistanceWithTargetScale=pc.createScript("mantainDistanceWithTargetScale");MantainDistanceWithTargetScale.attributes.add("target",{type:"entity"}),MantainDistanceWithTargetScale.attributes.add("defaultDistZ",{type:"number"}),MantainDistanceWithTargetScale.attributes.add("defaultDistX",{type:"number"}),MantainDistanceWithTargetScale.attributes.add("adjustZ",{type:"boolean"}),MantainDistanceWithTargetScale.attributes.add("adjustX",{type:"boolean"}),MantainDistanceWithTargetScale.prototype.initialize=function(){},MantainDistanceWithTargetScale.prototype.update=function(t){1==this.adjustZ&&this.entity.setLocalPosition(this.entity.getLocalPosition().x,this.entity.getLocalPosition().y,this.target.getLocalPosition().z+this.defaultDistZ*this.target.getLocalScale().z),1==this.adjustX&&this.entity.setLocalPosition(this.target.getLocalPosition().x+this.defaultDistX*this.target.getLocalScale().x,this.entity.getLocalPosition().y,this.entity.getLocalPosition().z)};var MoveUpwithScale=pc.createScript("moveUpwithScale");MoveUpwithScale.attributes.add("target",{type:"entity"}),MoveUpwithScale.prototype.initialize=function(){this.initialYPosition=this.entity.getLocalPosition().y},MoveUpwithScale.prototype.update=function(t){this.entity.setLocalPosition(this.entity.getLocalPosition().x,-(1-this.target.getLocalScale().z)/2.2,this.entity.getLocalPosition().z)};