AR轨迹逻辑

This commit is contained in:
lishuo committed 2022-10-08 13:26:38 +08:00
1 parent 195893a1b0
commit d1c84d0a8a
30 files changed
+159988 -4149

No files matched your search

@@ -8,6 +8,7 @@ using Mapbox.Unity.MeshGeneration.Modifiers;
using Mapbox.Unity.MeshGeneration.Data;
using Mapbox.Unity.Utilities;
using System;
using FluffyUnderware.Curvy;
namespace Assets.Scenes.Ride.Scripts
{
@@ -33,7 +34,7 @@ namespace Assets.Scenes.Ride.Scripts
Material Graph2 { get; set; }
Material linematerial { get; set; }
Vector2d[] ss;
protected virtual void Awake()
{
if (_map == null)
@@ -44,6 +45,14 @@ namespace Assets.Scenes.Ride.Scripts
//_map.OnUpdated += _map_OnUpdated; ;
Graph2 = Resources.Load<Material>("UI/Material/3dGraph2");
linematerial = Resources.Load<Material>("UI/Material/3");
var text = Resources.Load<TextAsset>("UI/bkoolgis");
var arr = text.text.Replace("\r\n", " ").Split(' ');
//ss = new Vector2d[arr.Length];
//for (int i = 0; i < arr.Length; ++i)
//{
// var a = arr[i].Split(',');
// ss[i] = new Vector2d(double.Parse(a[1]), double.Parse(a[0]));
//}
}
private void _map_OnUpdated()
@@ -99,10 +108,14 @@ namespace Assets.Scenes.Ride.Scripts
var mapData = cyclingCotroller.GetMapData();
if (mapData != null && cyclingCotroller.currentPlayer != null)
{
for (int i = 0; i < mapData.List.Count; i++)
//var curvy = CurvySpline.Create();
//curvy.Interpolation = CurvyInterpolation.Bezier;
for (int i = 0; i < mapData.List.Count; i++)
{
var point = mapData.List[i].Point;
Vector3 item = _map.GeoToWorldPosition(new Vector2d(point[0], point[1]));
Vector3 item = _map.GeoToWorldPosition(new Vector2d(point[0],point[1]));
//curvy.Add(item);
item.y += 1f;
//前后取50个点
decimal diff = i - cyclingCotroller.currentPlayer.CurrentIndex;