public override void OnGestureTapped() { robotNode.Enabled = false; Text text = new Text(Context); text.Value = "Anda Telah Meng-Disable Robot"; text.HorizontalAlignment = HorizontalAlignment.Center; text.VerticalAlignment = VerticalAlignment.Top; text.Position = new IntVector2(0, 100); text.SetColor(Color.White); text.SetFont(CoreAssets.Fonts.AnonymousPro, 30); UI.Root.AddChild(text); Ray cameraRay = RightCamera.GetScreenRay(0.5f, 0.5f); var result = Scene.GetComponent <Octree>().RaycastSingle(cameraRay, RayQueryLevel.Triangle, 100, DrawableFlags.Geometry, 0x70000000); robotNode = Scene.CreateChild(); robotNode.Name = "Destroyer"; if (result != null && result.Value.Node.Name == "Destroyer") { text.Value = "Anda Telah Meng-Klik Di Robot"; } }
protected override void OnUpdate(float timeStep) { if (positionIsSelected) { return; } textNode.LookAt(LeftCamera.Node.WorldPosition, new Vector3(0, 1, 0), TransformSpace.World); textNode.Rotate(new Quaternion(0, 180, 0), TransformSpace.World); Ray cameraRay = RightCamera.GetScreenRay(0.5f, 0.5f); var result = Scene.GetComponent <Octree>().RaycastSingle(cameraRay, RayQueryLevel.Triangle, 100, DrawableFlags.Geometry, 0x70000000); if (result != null) { var angle = Vector3.CalculateAngle(new Vector3(0, 1, 0), result.Value.Normal); surfaceIsValid = angle < 0.3f; //allow only horizontal surfaces bucketMaterial.SetShaderParameter("MatDiffColor", surfaceIsValid ? validPositionColor : invalidPositionColor); bucketNode.Position = result.Value.Position; } else { // no spatial surfaces found surfaceIsValid = false; bucketMaterial.SetShaderParameter("MatDiffColor", validPositionColor); } }
protected override void OnUpdate(float timeStep) { Ray cameraRay = RightCamera.GetScreenRay(0.5f, 0.5f); var result = Scene.GetComponent <Octree>().RaycastSingle(cameraRay, RayQueryLevel.Triangle, 100, DrawableFlags.Geometry, 0x70000000); //Debug.WriteLine("Result: " + result); if (result != null) { } }
protected override void OnUpdate(float timeStep) { Ray cameraRay = RightCamera.GetScreenRay(0.5f, 0.5f); var result = Scene.GetComponent <Octree>().RaycastSingle(cameraRay, RayQueryLevel.Triangle, 100, DrawableFlags.Geometry, 0x70000000); if (result != null) { if (!playStarted) { startNode.LookAt(LeftCamera.Node.WorldPosition, new Vector3(0, 1, 0), TransformSpace.World); //startNode.Rotate(new Quaternion(0, 180, 0), TransformSpace.World); //var angle = Vector3.CalculateAngle(new Vector3(0, 1, 0), result.Value.Normal); //surfaceIsValid = angle < 0.3f; //allow only horizontal surfaces //startNode.Position = new Vector3(result.Value.Position.X, result.Value.Position.Y, 3f) /*result.Value.Position*/; //startNode.SetWorldPosition(new Vector3(0.5f, 0.5f, 3f)); //LayoutMode.Horizontal Vector3 pos = RightCamera.ScreenToWorldPoint(new Vector3(0.5f, 0.5f, 3f)); startNode.Position = pos; //startNode.Position = new Vector3(LeftCamera.Node.WorldPosition.X, LeftCamera.Node.WorldPosition.Y, LeftCamera.Node.WorldPosition.Z + 3f); startNode.Rotation = new Quaternion(0, -LeftCamera.Node.Rotation.ToEulerAngles().Y, 0); } else if (!positionIsSelected) { textNode.LookAt(LeftCamera.Node.WorldPosition, new Vector3(0, 1, 0), TransformSpace.World); textNode.Rotate(new Quaternion(0, 180, 0), TransformSpace.World); var angle = Vector3.CalculateAngle(new Vector3(0, 1, 0), result.Value.Normal); surfaceIsValid = angle < 0.3f; //allow only horizontal surfaces bucketMaterial.SetShaderParameter("MatDiffColor", surfaceIsValid ? validPositionColor : invalidPositionColor); bucketNode.Position = result.Value.Position; bucketNode.Rotation = new Quaternion(0, -LeftCamera.Node.Rotation.ToEulerAngles().Y, 0); } else if (endNode != null) { endNode.LookAt(LeftCamera.Node.WorldPosition, new Vector3(0, 1, 0), TransformSpace.World); Vector3 pos = RightCamera.ScreenToWorldPoint(new Vector3(0.5f, 0.5f, 3f)); endNode.Position = pos; endNode.Rotation = new Quaternion(0, -LeftCamera.Node.Rotation.ToEulerAngles().Y, 0); } } else { // no spatial surfaces found surfaceIsValid = false; } }
public override void OnGestureTapped() { Ray cameraRay = RightCamera.GetScreenRay(0.5f, 0.5f); var result = Scene.GetComponent <Octree>().RaycastSingle(cameraRay, RayQueryLevel.Triangle, 100, DrawableFlags.Geometry, 0x70000000); if (result != null) { Debug.WriteLine("berhasil: " + result.Value.Node.GetComponent <Box>().ID); if (!flag) { //rmq.SendMessage("led1", "0"); flag = true; } else { //rmq.SendMessage("led1", "1"); flag = false; } } }
protected override void OnUpdate(float timeStep) { if (positionIsSelected) { return; } Ray cameraRay = RightCamera.GetScreenRay(0.5f, 0.5f); var result = Scene.GetComponent <Octree>().RaycastSingle(cameraRay, RayQueryLevel.Triangle, 100, DrawableFlags.Geometry, 0x70000000); if (result != null) { var angle = Vector3.CalculateAngle(new Vector3(0, 1, 0), result.Value.Normal); surfaceIsValid = angle < 0.3f; //allow only horizontal surfaces positionSelectorNode.Position = result.Value.Position; positionSelectorModel.Color = surfaceIsValid ? validPositionColor : invalidPositionColor; } else { // no spatial surfaces found surfaceIsValid = false; positionSelectorModel.Color = invalidPositionColor; } }
public override void OnGestureTapped() { base.OnGestureTapped(); Ray cameraRay = RightCamera.GetScreenRay(0.5f, 0.5f); var result = Scene.GetComponent <Octree>().RaycastSingle(cameraRay, RayQueryLevel.Triangle, 100, DrawableFlags.Geometry, 0x70000000); if (result != null && result.Value.Node.Name == "violin") //ANOTASI BIOLA { TextToSpeech("THIS is VIOLIN"); AnotasiBiolaNode.Enabled = true; AnotasiCloseBiolaNode.Enabled = true; } if (result != null && result.Value.Node.Name == "anotasiclose_biola_depan") { TextToSpeech("Violin Closed"); AnotasiBiolaNode.Enabled = false; AnotasiCloseBiolaNode.Enabled = false; } //ANOTASI ANGKLUNG if (result != null && result.Value.Node.Name == "Angklung") { TextToSpeech("THIS is ANGKLUNG"); AnotasiAngklungNode.Enabled = true; AnotasiCloseAngklungNode.Enabled = true; } if (result != null && result.Value.Node.Name == "anotasiclose_Angklung_depan") { TextToSpeech("Angklung Closed"); AnotasiAngklungNode.Enabled = false; AnotasiCloseAngklungNode.Enabled = false; } //ANOTASI ARUMBA if (result != null && result.Value.Node.Name == "Arumba") { TextToSpeech("THIS is ARUMBA"); AnotasiArumbaNode.Enabled = true; AnotasiCloseArumbaNode.Enabled = true; } if (result != null && result.Value.Node.Name == "anotasiclose_Arumba_depan") { TextToSpeech("Arumba Closed"); AnotasiArumbaNode.Enabled = false; AnotasiCloseArumbaNode.Enabled = false; } //ANOTASI CELLO if (result != null && result.Value.Node.Name == "Cello") { TextToSpeech("THIS is CELLO"); AnotasiCelloNode.Enabled = true; AnotasiCloseCelloNode.Enabled = true; } if (result != null && result.Value.Node.Name == "anotasiclose_Cello_depan") { TextToSpeech("Cello Closed"); AnotasiCelloNode.Enabled = false; AnotasiCloseCelloNode.Enabled = false; } //ANOTASI FLUTE if (result != null && result.Value.Node.Name == "Flute") { TextToSpeech("THIS is FLUTE"); AnotasiFluteNode.Enabled = true; AnotasiCloseFluteNode.Enabled = true; } if (result != null && result.Value.Node.Name == "anotasiclose_Flute_depan") { TextToSpeech("FLUTE Closed"); AnotasiFluteNode.Enabled = false; AnotasiCloseFluteNode.Enabled = false; } //ANOTASI GITAR if (result != null && result.Value.Node.Name == "Guitar") { TextToSpeech("THIS IS Guitar"); AnotasiGitarNode.Enabled = true; AnotasiCloseGitarNode.Enabled = true; } if (result != null && result.Value.Node.Name == "anotasiclose_Guitar_depan") { TextToSpeech("Guitar Closed"); AnotasiGitarNode.Enabled = false; AnotasiCloseGitarNode.Enabled = false; } //ANOTASI PIANO if (result != null && result.Value.Node.Name == "Piano") { TextToSpeech("THIS is Piano"); AnotasiPianoNode.Enabled = true; AnotasiClosePianoNode.Enabled = true; } if (result != null && result.Value.Node.Name == "anotasiclose_Piano_depan") { TextToSpeech("Closed Piano"); AnotasiPianoNode.Enabled = false; AnotasiClosePianoNode.Enabled = false; } //ANOTASI SERULING if (result != null && result.Value.Node.Name == "Seruling") { TextToSpeech("THIS is SERULING"); AnotasiSerulingNode.Enabled = true; AnotasiCloseSerulingNode.Enabled = true; } if (result != null && result.Value.Node.Name == "anotasiclose_Seruling_depan") { TextToSpeech("Closed Seruling"); AnotasiSerulingNode.Enabled = false; AnotasiCloseSerulingNode.Enabled = false; } //ANOTASI TRUMPET if (result != null && result.Value.Node.Name == "Trumpet") { TextToSpeech("THIS IS TRUMPET"); AnotasiTrumpetNode.Enabled = true; AnotasiCloseTrumpetNode.Enabled = true; } if (result != null && result.Value.Node.Name == "anotasiclose_Trumpet_depan") { TextToSpeech("Closed Trumpet"); AnotasiTrumpetNode.Enabled = false; AnotasiCloseTrumpetNode.Enabled = false; } }
public override void OnGestureTapped() { Ray cameraRay = RightCamera.GetScreenRay(0.5f, 0.5f); var result = Scene.GetComponent <Octree>().RaycastSingle(cameraRay, RayQueryLevel.Triangle, 100, DrawableFlags.Geometry, 0x70000000); Debug.WriteLine("Result: " + result); if (result != null) { Debug.WriteLine(result.Value.Position.X); // Debug.WriteLine(result.Value.Position.Y); try { if (result.Value.Position.X >= 0.5f) { //Debug.WriteLine(result.Value.Position.Z); if (lampAIsYellow && (perintah == "sentence1: <s> REDUPKAN LAMPU </s>\n")) { lampANode.GetComponent <Sphere>().SetMaterial(Material.FromColor(Color.FromHex("FFA500"))); lampAIsYellow = false; lampAIsGray = false; lampAIsOrange = true; //Debug.WriteLine(textLampOff.GetComponent.textLampOff); text3DA.Text = "Lamp is On"; status3DA.Text = "Luminosity : Dimmed"; } else if (lampAIsOrange && (perintah == "sentence1: <s> TERANGKAN LAMPU </s>\n")) { lampANode.GetComponent <Sphere>().SetMaterial(Material.FromColor(Color.Yellow)); lampAIsYellow = true; lampAIsGray = false; lampAIsOrange = false; text3DA.Text = "Lamp is On"; status3DA.Text = "Luminosity : Bright"; } else if ((lampAIsOrange || lampAIsYellow) && (perintah == "sentence1: <s> MATIKAN LAMPU </s>\n")) { lampANode.GetComponent <Sphere>().SetMaterial(Material.FromColor(Color.Gray)); lampAIsGray = true; text3DA.Text = "Lamp is Off"; status3DA.Text = "Luminosity : Off"; } } if (result.Value.Position.X <= 0.1f) { // Debug.WriteLine(result.Value.Position.X); if (lampBIsYellow) { lampBNode.GetComponent <Sphere>().SetMaterial(Material.FromColor(Color.Gray)); lampBIsYellow = false; text3DB.Text = "Lamp is Off"; status3DB.Text = "Luminosity : Off"; } else { lampBNode.GetComponent <Sphere>().SetMaterial(Material.FromColor(Color.Yellow)); lampBIsYellow = true; text3DB.Text = "Lamp is On"; status3DB.Text = "Luminosity : Bright"; } } } catch (NullReferenceException e) { Debug.WriteLine("Error: " + e.Message.ToString()); } catch (Exception ex) { Debug.WriteLine("Error: " + ex.Message.ToString()); } } base.OnGestureTapped(); }