// @input Component.ObjectTracking3D leftHand // @input Component.ObjectTracking3D rightHand // @input SceneObject heat // @input SceneObject instructionsBack // @input SceneObject instructionsFront // @input SceneObject leftHandPalm // @input SceneObject rightHandPalm // @input SceneObject cameraProjection // @input SceneObject cameraTracking // @input SceneObject fireball // @input SceneObject fireballBack0 // @input SceneObject fireballBack1 // @input SceneObject explosionBack0 // @input SceneObject explosionBack1 // @input SceneObject fireballCollision // @input SceneObject fireballTarget // @input SceneObject handInstructions // @input SceneObject pointInstructions // @input Asset.Texture fireball0Texture // @input Asset.Texture fireball1Texture // @input Asset.Texture explosion0Texture // @input Asset.Texture explosion1Texture // @input Component.AudioComponent fireballStart // @input Component.AudioComponent fireballShot // @input Component.AudioComponent fireballHit ///////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////// //camera var cameraDirection = 'selfie'; function onSwitchToFrontCamera() { cameraDirection = 'selfie'; script.instructionsFront.enabled = true; script.instructionsBack.enabled = false; script.fireballBack0.enabled = false; // script.fireballBack1.enabled = false; script.explosionBack0.enabled = false; script.explosionBack1.enabled = false; fireballHeatStay = false; global.tweenManager.stopTween(script.heat, 'world fireball stay'); global.tweenManager.stopTween(script.heat, 'world fireball shot'); global.tweenManager.stopTween(script.heat, 'world fireball hit'); global.tweenManager.startTween(script.heat, 'off'); } function onSwitchToBackCamera() { cameraDirection = 'world'; script.instructionsFront.enabled = false; script.instructionsBack.enabled = true; script.fireballBack0.enabled = true; // script.fireballBack1.enabled = true; script.explosionBack0.enabled = true; script.explosionBack1.enabled = true; fireballMode = 'waiting'; script.handInstructions.enabled = false; script.pointInstructions.enabled = false; handInstructionsCancel(); pointerInstructionsCancel(); handInstructionsStarted = false; handInstructionsShowDelayedEvent = null; pointerInstructionsStarted = false; pointerInstructionsShowDelayedEvent = null; script.fireball0Texture.control.stop(); script.fireball1Texture.control.stop(); } script.createEvent('CameraFrontEvent').bind(onSwitchToFrontCamera); script.createEvent('CameraBackEvent').bind(onSwitchToBackCamera); ///////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////// //hand tracking var isLeftTracking = false; var isRightTracking = false; var leftJoints = {}; var rightJoints = {}; const JOINT_NAMES = ["wrist","thumb-0","thumb-1","thumb-2","thumb-3","index-0","index-1","index-2","index-3","mid-0","mid-1","mid-2","mid-3","ring-0","ring-1","ring-2","ring-3","pinky-0","pinky-1","pinky-2","pinky-3","wrist_to_thumb","wrist_to_index","wrist_to_mid","wrist_to_ring","wrist_to_pinky"]; function onInitialize() { for (var i=0; i