From 8844d229f77d9da731b0708b87b6532bcbeb641c Mon Sep 17 00:00:00 2001 From: Joffrey LE CUDENEC <joffrey.le-cudenec@etu.unistra.fr> Date: Wed, 15 Dec 2021 17:50:56 +0100 Subject: [PATCH] =?UTF-8?q?Syst=C3=A8me=20de=20tracage=20racadrer=20par=20?= =?UTF-8?q?la=20cam=C3=A9ra?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- T3-Unity/Assets/Scripts/RouteTracer.cs | 10 +- T3-Unity/Assets/test.json | 698 +++++++++++++------------ 2 files changed, 367 insertions(+), 341 deletions(-) diff --git a/T3-Unity/Assets/Scripts/RouteTracer.cs b/T3-Unity/Assets/Scripts/RouteTracer.cs index 6740ceb..09f240a 100644 --- a/T3-Unity/Assets/Scripts/RouteTracer.cs +++ b/T3-Unity/Assets/Scripts/RouteTracer.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System; using UnityEngine; +using Mapbox.Utils; public class RouteTracer : MonoBehaviour { @@ -51,8 +52,13 @@ public class RouteTracer : MonoBehaviour DrawLine(objA.transform.position, objB.transform.position, Color.cyan, 1f); } - //Recalculer les position relative entre les 2 objets - + + GameObject.Find("Player").transform.position = + new Vector3( + (float)((GameObject.FindGameObjectWithTag("start_wp").transform.position.x + GameObject.FindGameObjectWithTag("end_wp").transform.position.x) / 2d), + GameObject.Find("Player").transform.position.y, + (float)((GameObject.FindGameObjectWithTag("start_wp").transform.position.z + GameObject.FindGameObjectWithTag("end_wp").transform.position.z) / 2d) + ); } void DrawLine(Vector3 start, Vector3 end, Color color, float width) diff --git a/T3-Unity/Assets/test.json b/T3-Unity/Assets/test.json index da79cda..f6459cd 100644 --- a/T3-Unity/Assets/test.json +++ b/T3-Unity/Assets/test.json @@ -12,29 +12,45 @@ true ], "bearings": [ - 354 + 264 ], "location": [ - 7.748423, - 48.576225 + 7.762146, + 48.567099 ] + }, + { + "out": 1, + "entry": [ + false, + true + ], + "bearings": [ + 119, + 300 + ], + "location": [ + 7.761292, + 48.567183 + ], + "in": 0 } ], - "geometry": "mpngHsjhn@g@DGBGB", + "geometry": "kwlgHm`kn@FhBW`AEL", "maneuver": { - "bearing_after": 354, + "bearing_after": 264, "type": "depart", "modifier": null, "bearing_before": 0, "Location": [ - 7.748423, - 48.576225 + 7.762146, + 48.567099 ], - "instruction": "Drive north." + "instruction": "Drive west on Rue du Dreistein." }, - "duration": 6.764, - "distance": 31.942, - "name": "", + "duration": 12.089, + "distance": 72.887, + "name": "Rue du Dreistein", "mode": "driving" }, { @@ -46,12 +62,12 @@ false ], "bearings": [ - 67, - 167 + 30, + 120 ], "location": [ - 7.748353, - 48.576511 + 7.761218, + 48.567211 ], "in": 1 }, @@ -62,12 +78,12 @@ false ], "bearings": [ - 72, - 247 + 30, + 210 ], "location": [ - 7.748586, - 48.576577 + 7.761691, + 48.567752 ], "in": 1 }, @@ -78,12 +94,12 @@ false ], "bearings": [ - 72, - 252 + 30, + 210 ], "location": [ - 7.749261, - 48.57672 + 7.762022, + 48.568129 ], "in": 1 }, @@ -94,12 +110,12 @@ false ], "bearings": [ - 68, - 252 + 30, + 210 ], "location": [ - 7.749311, - 48.576731 + 7.762266, + 48.568412 ], "in": 1 }, @@ -110,12 +126,12 @@ false ], "bearings": [ - 71, - 248 + 41, + 210 ], "location": [ - 7.749356, - 48.576743 + 7.762627, + 48.568826 ], "in": 1 }, @@ -126,35 +142,15 @@ false ], "bearings": [ - 105, - 263 + 25, + 222 ], "location": [ - 7.749654, - 48.576785 + 7.763022, + 48.569123 ], "in": 1 - } - ], - "geometry": "erngHejhn@EWGW[eCAIAIG]AU?EBU", - "maneuver": { - "bearing_after": 67, - "type": "turn", - "modifier": "right", - "bearing_before": 347, - "Location": [ - 7.748353, - 48.576511 - ], - "instruction": "Turn right." - }, - "duration": 29.688, - "distance": 110.0, - "name": "", - "mode": "driving" - }, - { - "intersections": [ + }, { "out": 0, "entry": [ @@ -162,12 +158,12 @@ false ], "bearings": [ - 122, - 285 + 23, + 205 ], "location": [ - 7.749757, - 48.576767 + 7.763069, + 48.56919 ], "in": 1 }, @@ -178,50 +174,50 @@ false ], "bearings": [ - 141, - 307 + 22, + 203 ], "location": [ - 7.750007, - 48.576659 + 7.763218, + 48.569421 ], "in": 1 } ], - "geometry": "ysngH_shn@DOFOFQb@i@z@c@RIRAR@RF", + "geometry": "axlgHszjn@kB}AgA}@CCw@q@gA}@KICMUSACKKQ[MICAa@UCACCCAGE", "maneuver": { - "bearing_after": 122, - "type": "turn", - "modifier": "slight right", - "bearing_before": 105, + "bearing_after": 30, + "type": "end of road", + "modifier": "right", + "bearing_before": 300, "Location": [ - 7.749757, - 48.576767 + 7.761218, + 48.567211 ], - "instruction": "Bear right onto Rue de la Porte de l'Hôpital." + "instruction": "Turn right onto Rue de Rathsamhausen." }, - "duration": 19.901, - "distance": 128.0, - "name": "Rue de la Porte de l'Hôpital", + "duration": 61.387, + "distance": 296.0, + "name": "Rue de Rathsamhausen", "mode": "driving" }, { "intersections": [ { - "out": 1, + "out": 0, "entry": [ - false, - true + true, + false ], "bearings": [ - 10, - 97 + 113, + 202 ], "location": [ - 7.750413, - 48.575784 + 7.763256, + 48.569482 ], - "in": 0 + "in": 1 }, { "out": 0, @@ -230,12 +226,12 @@ false ], "bearings": [ - 102, - 277 + 113, + 293 ], "location": [ - 7.750496, - 48.575777 + 7.763366, + 48.569451 ], "in": 1 }, @@ -246,12 +242,12 @@ false ], "bearings": [ - 92, - 278 + 113, + 293 ], "location": [ - 7.751039, - 48.575711 + 7.763398, + 48.569442 ], "in": 1 }, @@ -262,12 +258,12 @@ false ], "bearings": [ - 87, - 266 + 113, + 293 ], "location": [ - 7.751682, - 48.575716 + 7.764487, + 48.569137 ], "in": 1 }, @@ -278,12 +274,12 @@ false ], "bearings": [ - 81, - 267 + 113, + 293 ], "location": [ - 7.751771, - 48.575719 + 7.764578, + 48.569112 ], "in": 1 }, @@ -294,31 +290,31 @@ false ], "bearings": [ - 70, - 247 + 113, + 293 ], "location": [ - 7.752791, - 48.575937 + 7.76515, + 48.56895 ], "in": 1 } ], - "geometry": "smngHawhn@?Q@A?GFq@Bo@?k@@[Cw@?QCc@Gm@Gg@UiAAG?CAEAGCQ", + "geometry": "gfmgHkgkn@DU@Ez@yE??DQZgBBI??Hc@", "maneuver": { - "bearing_after": 97, + "bearing_after": 113, "type": "turn", - "modifier": "left", - "bearing_before": 190, + "modifier": "right", + "bearing_before": 22, "Location": [ - 7.750413, - 48.575784 + 7.763256, + 48.569482 ], - "instruction": "Turn left onto Rue Spielmann." + "instruction": "Turn right onto Avenue Jean Jaurès." }, - "duration": 51.457, - "distance": 194.0, - "name": "Rue Spielmann", + "duration": 36.255, + "distance": 166.0, + "name": "Avenue Jean Jaurès", "mode": "driving" }, { @@ -330,174 +326,174 @@ false ], "bearings": [ - 147, - 250 + 23, + 293 ], "location": [ - 7.752969, - 48.575981 + 7.765332, + 48.568899 ], "in": 1 }, { - "out": 0, + "out": 1, "entry": [ - true, - false + false, + true ], "bearings": [ - 161, - 337 + 203, + 293 ], "location": [ - 7.75339, - 48.575441 + 7.76543, + 48.569051 ], - "in": 1 + "in": 0 }, { - "out": 0, + "out": 1, "entry": [ - true, - false + false, + true ], "bearings": [ - 167, - 341 + 113, + 293 ], "location": [ - 7.753419, - 48.575386 + 7.765247, + 48.569102 ], - "in": 1 + "in": 0 }, { - "out": 0, + "out": 1, "entry": [ - true, - false + false, + true ], "bearings": [ - 173, - 347 + 113, + 293 ], "location": [ - 7.753486, - 48.575193 + 7.764944, + 48.569187 ], - "in": 1 + "in": 0 }, { - "out": 0, + "out": 1, "entry": [ - true, - false + false, + true ], "bearings": [ - 168, - 353 + 113, + 293 ], "location": [ - 7.753511, - 48.575056 + 7.764583, + 48.569288 ], - "in": 1 + "in": 0 }, { - "out": 0, + "out": 1, "entry": [ - true, - false + false, + true ], "bearings": [ - 172, - 348 + 113, + 293 ], "location": [ - 7.753525, - 48.575012 + 7.763606, + 48.569562 ], - "in": 1 + "in": 0 }, { - "out": 0, + "out": 1, "entry": [ - true, - false + false, + true ], "bearings": [ - 167, - 352 + 113, + 292 ], "location": [ - 7.753595, - 48.574665 + 7.76352, + 48.569586 ], - "in": 1 + "in": 0 }, { - "out": 0, + "out": 1, "entry": [ - true, - false + false, + true ], "bearings": [ - 172, - 352 + 112, + 293 ], "location": [ - 7.753795, - 48.57381 + 7.763494, + 48.569593 ], - "in": 1 + "in": 0 }, { - "out": 0, + "out": 1, "entry": [ - true, - false + false, + true ], "bearings": [ - 170, - 352 + 113, + 293 ], "location": [ - 7.753842, - 48.573595 + 7.763265, + 48.569657 ], - "in": 1 + "in": 0 }, { - "out": 0, + "out": 1, "entry": [ - true, - false + false, + true ], "bearings": [ - 176, - 350 + 113, + 293 ], "location": [ - 7.754048, - 48.572854 + 7.762813, + 48.569784 ], - "in": 1 + "in": 0 }, { - "out": 0, + "out": 1, "entry": [ - true, - false + false, + true ], "bearings": [ - 181, - 356 + 113, + 293 ], "location": [ - 7.754052, - 48.572818 + 7.761969, + 48.570021 ], - "in": 1 + "in": 0 }, { "out": 1, @@ -506,51 +502,35 @@ true ], "bearings": [ - 3, - 182 + 113, + 293 ], "location": [ - 7.754012, - 48.572021 + 7.761171, + 48.570245 ], "in": 0 } ], - "geometry": "{nngHagin@NOLMTQNKXOLGHEf@MXCHCbAMd@Kp@IrAOh@ItCi@D?b@?`BDF?P@P?", + "geometry": "sbmgHitkn@KGECKGIb@Q|@SfAu@`ECNA@?DKf@ABAFGZAJKj@o@fDm@~CAJ", "maneuver": { - "bearing_after": 147, - "type": "turn", - "modifier": "right", - "bearing_before": 70, + "bearing_after": 293, + "type": "continue", + "modifier": "uturn", + "bearing_before": 113, "Location": [ - 7.752969, - 48.575981 + 7.765332, + 48.568899 ], - "instruction": "Turn right onto Rue de la Première Armée." + "instruction": "Make a left U-turn at Rue de Kembs to stay on Avenue Jean Jaurès." }, - "duration": 103.552, - "distance": 462.0, - "name": "Rue de la Première Armée", + "duration": 91.172, + "distance": 364.0, + "name": "Avenue Jean Jaurès", "mode": "driving" }, { "intersections": [ - { - "out": 1, - "entry": [ - false, - true - ], - "bearings": [ - 2, - 151 - ], - "location": [ - 7.754008, - 48.571934 - ], - "in": 0 - }, { "out": 0, "entry": [ @@ -558,12 +538,12 @@ false ], "bearings": [ - 96, - 331 + 26, + 113 ], "location": [ - 7.754079, - 48.571849 + 7.761106, + 48.570263 ], "in": 1 }, @@ -574,12 +554,12 @@ false ], "bearings": [ - 99, - 276 + 32, + 206 ], "location": [ - 7.754283, - 48.571834 + 7.761142, + 48.570311 ], "in": 1 }, @@ -590,12 +570,12 @@ false ], "bearings": [ - 103, - 281 + 31, + 212 ], "location": [ - 7.75485, - 48.57177 + 7.761312, + 48.570489 ], "in": 1 }, @@ -606,12 +586,12 @@ false ], "bearings": [ - 101, - 283 + 31, + 211 ], "location": [ - 7.75498, - 48.57175 + 7.761768, + 48.570988 ], "in": 1 }, @@ -622,15 +602,35 @@ false ], "bearings": [ - 99, - 281 + 32, + 211 ], "location": [ - 7.755094, - 48.571735 + 7.76206, + 48.571314 ], "in": 1 - }, + } + ], + "geometry": "ckmgH}yjn@EACCc@a@}AuAEEECy@u@kBcBGEE?", + "maneuver": { + "bearing_after": 26, + "type": "turn", + "modifier": "right", + "bearing_before": 293, + "Location": [ + 7.761106, + 48.570263 + ], + "instruction": "Turn right onto Rue Mariano." + }, + "duration": 44.098, + "distance": 215.0, + "name": "Rue Mariano", + "mode": "driving" + }, + { + "intersections": [ { "out": 0, "entry": [ @@ -638,12 +638,12 @@ false ], "bearings": [ - 102, - 279 + 70, + 203 ], "location": [ - 7.755264, - 48.571717 + 7.762593, + 48.571922 ], "in": 1 }, @@ -654,30 +654,50 @@ false ], "bearings": [ - 107, - 282 + 70, + 250 ], "location": [ - 7.755777, - 48.571644 + 7.762677, + 48.571942 ], "in": 1 - }, + } + ], + "geometry": "oumgHeckn@CQES", + "maneuver": { + "bearing_after": 70, + "type": "end of road", + "modifier": "right", + "bearing_before": 23, + "Location": [ + 7.762593, + 48.571922 + ], + "instruction": "Turn right onto Rue du Ballon." + }, + "duration": 4.036, + "distance": 15.0, + "name": "Rue du Ballon", + "mode": "driving" + }, + { + "intersections": [ { - "out": 0, + "out": 1, "entry": [ - true, - false + false, + true ], "bearings": [ - 125, - 292 + 250, + 357 ], "location": [ - 7.756105, - 48.571563 + 7.762781, + 48.571967 ], - "in": 1 + "in": 0 }, { "out": 0, @@ -686,12 +706,12 @@ false ], "bearings": [ - 114, - 305 + 6, + 179 ], "location": [ - 7.756314, - 48.571467 + 7.762769, + 48.57215 ], "in": 1 }, @@ -702,12 +722,12 @@ false ], "bearings": [ - 116, - 294 + 29, + 199 ], "location": [ - 7.756605, - 48.57138 + 7.762843, + 48.572373 ], "in": 1 }, @@ -718,31 +738,31 @@ false ], "bearings": [ - 113, - 293 + 37, + 209 ], "location": [ - 7.758577, - 48.570792 + 7.762918, + 48.572461 ], "in": 1 } ], - "geometry": "qumgHqmin@NMBg@Bs@Dk@@QBY@UBa@HeA@OBQDm@HSPg@P{@`@kB`@kBp@qDHc@", + "geometry": "yumgHkdkn@E@]?O?KCGCGEKIEECIECCAEE", "maneuver": { - "bearing_after": 96, + "bearing_after": 357, "type": "turn", "modifier": "left", - "bearing_before": 182, + "bearing_before": 70, "Location": [ - 7.754008, - 48.571934 + 7.762781, + 48.571967 ], - "instruction": "Turn left onto Rue de la Thumenau." + "instruction": "Turn left onto Rue Pierre Fresnay." }, - "duration": 77.532, - "distance": 381.0, - "name": "Rue de la Thumenau", + "duration": 20.366, + "distance": 71.0, + "name": "Rue Pierre Fresnay", "mode": "driving" }, { @@ -754,63 +774,63 @@ false ], "bearings": [ - 14, - 293 + 93, + 217 ], "location": [ - 7.758756, - 48.570741 + 7.763027, + 48.572557 ], "in": 1 }, { - "out": 1, + "out": 0, "entry": [ - false, - true + true, + false ], "bearings": [ - 194, - 293 + 92, + 273 ], "location": [ - 7.758819, - 48.570903 + 7.763239, + 48.572549 ], - "in": 0 + "in": 1 }, { - "out": 1, + "out": 0, "entry": [ - false, - true + true, + false ], "bearings": [ - 113, - 293 + 93, + 272 ], "location": [ - 7.758676, - 48.570944 + 7.76444, + 48.572527 ], - "in": 0 + "in": 1 } ], - "geometry": "cnmgHgkjn@MCCAMEGZu@xDQz@", + "geometry": "oymgH}ekn@@i@BoFBeBBw@@U", "maneuver": { - "bearing_after": 293, - "type": "continue", - "modifier": "uturn", - "bearing_before": 113, + "bearing_after": 93, + "type": "turn", + "modifier": "right", + "bearing_before": 37, "Location": [ - 7.758756, - 48.570741 + 7.763027, + 48.572557 ], - "instruction": "Make a left U-turn at Avenue Jean Jaurès onto Avenue Jean Jaurès." + "instruction": "Turn right onto Avenue du Rhin/M 1004." }, - "duration": 34.168, - "distance": 128.623, - "name": "Avenue Jean Jaurès", + "duration": 32.61, + "distance": 170.494, + "name": "Avenue du Rhin", "mode": "driving" }, { @@ -821,59 +841,59 @@ true ], "bearings": [ - 115 + 277 ], "location": [ - 7.757448, - 48.571297 + 7.765339, + 48.572481 ], "in": 0 } ], - "geometry": "sqmgHacjn@??", + "geometry": "_ymgHktkn@??", "maneuver": { "bearing_after": 0, "type": "arrive", "modifier": "right", - "bearing_before": 295, + "bearing_before": 97, "Location": [ - 7.757448, - 48.571297 + 7.765339, + 48.572481 ], "instruction": "Your destination is on the right." }, "duration": 0.0, "distance": 0.0, - "name": "Avenue Jean Jaurès", + "name": "Avenue du Rhin", "mode": "driving" } ], - "summary": "Rue de la Première Armée, Rue de la Thumenau", - "duration": 323.062, - "distance": 1435.566, + "summary": "Rue de Rathsamhausen, Avenue Jean Jaurès", + "duration": 302.013, + "distance": 1370.381, "annotation": null } ], - "geometry": "mpngHsjhn@w@Lu@gF@q@x@{AnAm@z@FJoGs@oF|CgBrMoBvDFNMn@aKlDeP_@KoApG", - "duration": 323.062, - "distance": 1435.566, - "weight": 460.241, + "geometry": "kwlgHm`kn@FhB]nAcIyGy@mAgAo@rB}K]SqF~YkIgHIe@_AAu@o@NmM", + "duration": 302.013, + "distance": 1370.381, + "weight": 443.946, "weight_name": "auto" } ], "waypoints": [ { - "name": "", + "name": "Rue du Dreistein", "location": [ - 7.748423, - 48.576225 + 7.762146, + 48.567099 ] }, { - "name": "Avenue Jean Jaurès", + "name": "Avenue du Rhin", "location": [ - 7.757448, - 48.571297 + 7.765339, + 48.572481 ] } ], -- GitLab