From 17eb3b184568d91e5a71cb51390e89f0ecc2605a Mon Sep 17 00:00:00 2001 From: shinichi Date: Fri, 18 Sep 2020 15:39:30 +0200 Subject: [PATCH 1/3] added positions for models --- RH-Engine/CreateGraphics.cs | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/RH-Engine/CreateGraphics.cs b/RH-Engine/CreateGraphics.cs index 062908c..154e993 100644 --- a/RH-Engine/CreateGraphics.cs +++ b/RH-Engine/CreateGraphics.cs @@ -59,9 +59,9 @@ namespace RH_Engine dynamic payload = new { id = "scene/terrain/update", - data = new + data = new { - + } }; return JsonConvert.SerializeObject(Payload(payload)); @@ -87,7 +87,7 @@ namespace RH_Engine return JsonConvert.SerializeObject(Payload(payload)); } - public string DeleteGroundPaneCommand(string uuid) + public string DeleteNode(string uuid) { dynamic payload = new @@ -106,15 +106,20 @@ namespace RH_Engine public string AddBikeModel() { - return AddModel("bike", "data\\NetworkEngine\\models\\bike\\bike.fbx", null); + return AddModel("bike", "data\\NetworkEngine\\models\\bike\\bike.fbx"); } public string AddModel(string nodeName, string fileLocation) { - return AddModel(nodeName, fileLocation, null); + return AddModel(nodeName, fileLocation, null, new float[]{ 0,0,0} ,1, new float[] { 0, 0, 0 }); } - public string AddModel(string nodeName, string fileLocation, string animationLocation) + public string AddModel(string nodeName, string fileLocation, float[] positionVector, float scalar, float[] rotationVector) + { + return AddModel(nodeName, fileLocation, null, positionVector, scalar, rotationVector); + } + + public string AddModel(string nodeName, string fileLocation, string animationLocation, float[] positionVector, float scalar, float[] rotationVector) { string namename = nodeName; bool animatedBool = false; @@ -131,6 +136,13 @@ namespace RH_Engine name = namename, components = new { + transform = new + { + position = positionVector, + scale = scalar, + rotation = rotationVector + + }, model = new { file = fileLocation, @@ -202,6 +214,7 @@ namespace RH_Engine } + private object Payload(dynamic message) { return new From c69c3193d4a7bbb6fa85336c2047cc29d8016b7b Mon Sep 17 00:00:00 2001 From: shinichi Date: Fri, 18 Sep 2020 15:56:34 +0200 Subject: [PATCH 2/3] added moveTo not working --- RH-Engine/CreateGraphics.cs | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/RH-Engine/CreateGraphics.cs b/RH-Engine/CreateGraphics.cs index 154e993..2ce7a06 100644 --- a/RH-Engine/CreateGraphics.cs +++ b/RH-Engine/CreateGraphics.cs @@ -111,7 +111,7 @@ namespace RH_Engine public string AddModel(string nodeName, string fileLocation) { - return AddModel(nodeName, fileLocation, null, new float[]{ 0,0,0} ,1, new float[] { 0, 0, 0 }); + return AddModel(nodeName, fileLocation, null, new float[] { 0, 0, 0 }, 1, new float[] { 0, 0, 0 }); } public string AddModel(string nodeName, string fileLocation, float[] positionVector, float scalar, float[] rotationVector) @@ -157,6 +157,31 @@ namespace RH_Engine return JsonConvert.SerializeObject(Payload(payload)); } + public string MoveTo(string uuid, float[] positionVector, float rotateValue, float speedValue, float timeValue) + { + return MoveTo(uuid, "idk", positionVector, rotateValue, "linear", false, speedValue, timeValue); + } + + private string MoveTo(string uuid, string stopValue, float[] positionVector, float rotateValue, string interpolateValue, bool followHeightValue, float speedValue, float timeValue) + { + dynamic payload = new + { + id = "scene/node/moveto", + data = new + { + id = uuid, + stop = stopValue, + position = positionVector, + rotate = rotateValue, + interpolate = interpolateValue, + followheight = followHeightValue, + speed = speedValue, + time = timeValue + } + }; + return JsonConvert.SerializeObject(Payload(payload)); + } + public string RouteCommand() { From 4a745ace75511cd6ec859ef69ceca5f15e5712c8 Mon Sep 17 00:00:00 2001 From: shinichi Date: Fri, 18 Sep 2020 15:59:46 +0200 Subject: [PATCH 3/3] added getUUIDFromResponse --- RH-Engine/Program.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/RH-Engine/Program.cs b/RH-Engine/Program.cs index a3f054a..d2770b5 100644 --- a/RH-Engine/Program.cs +++ b/RH-Engine/Program.cs @@ -139,6 +139,10 @@ namespace RH_Engine //Console.WriteLine(ReadPrefMessage(stream)); + //add monkey head + //WriteTextMessage(stream, createGraphics.AddModel("Face", "data\\vrlib\\rendermodels\\face\\face.obj", new float[] { 0, 3, 0 }, 10, new float[] { 0, 0, 0 })); + //string headUuid = getUUIDFormResponse(ReadPrefMessage(stream)); + } @@ -201,6 +205,12 @@ namespace RH_Engine } + public static string getUUIDFromResponse(string response) + { + dynamic JSON = JsonConvert.DeserializeObject(response); + return JSON.data.data.data.uuid; + } + } ///