AR演示版本调优

This commit is contained in:
lishuo committed 2023-01-17 18:07:49 +08:00
1 parent 27d18d7d01
commit df936c4e04
27 files changed
+3143 -2980

No files matched your search

+1
View File
@@ -432,6 +432,7 @@ namespace Assets.AR
this.SlamSegments = data.SlamSegments;
this.CameraHeight = data.CameraHeight;
this.RiderScale = (double)data.RiderScale != 0.0 ? data.RiderScale : 1f;
this.RiderScale *= 0.9f;
this.CameraPositions = ((IEnumerable<VectorData>)data.CameraPositions).Select<VectorData, Vector3>((Func<VectorData, Vector3>)(x => x.ToUnityVector())).ToArray<Vector3>();
this.ProjectionParameters = data.CameraProjectionParameters;
this.CameraRotations = ((IEnumerable<VectorData>)data.CameraRotations).Select<VectorData, Quaternion>((Func<VectorData, Quaternion>)(x => Quaternion.Euler(x.ToUnityVector()))).ToArray<Quaternion>();
+11
View File
@@ -94,6 +94,16 @@ namespace Assets.AR
item.PreSpeed = item.Speed;
item.Speed = (float)dic.Key.OnlineSpeed;
item.DeltaDistance = (float)(dic.Key.EndDistance - dic.Key.PreDistance);
//如果速度为0就停止播放视频
if (item.DeltaDistance == 0 || item.Speed == 0)
{
item.DeltaDistance = 0;
videoPlayer.Pause();
}
else
{
videoPlayer.Resume();
}
item.Route = Route;
item.VideoSync = videoPointsSync;
item.IsAtFinish = dic.Key.EndDistance >= manager.GetMapRoute().Distance*1000f;
@@ -111,6 +121,7 @@ namespace Assets.AR
foreach (var obj in this.riderObjects.Values)
{
var offset = obj.DeltaDistance * delta;
//Debug.Log($"offset:{offset}:{DateTime.Now}");
obj.Distance += offset;
obj.RouteDistance += offset;
}
-24
View File
@@ -1,24 +0,0 @@
using UnityEngine;
namespace Assets.AR
{
public class ExampleClass : MonoBehaviour
{
public Matrix4x4 originalProjection;
Camera cam;
void Start()
{
cam = GetComponent<Camera>();
originalProjection = cam.projectionMatrix;
}
void Update()
{
Matrix4x4 p = originalProjection;
p.m01 += Mathf.Sin(Time.time * 1.2F) * 0.1F;
p.m10 += Mathf.Sin(Time.time * 1.5F) * 0.1F;
cam.projectionMatrix = p;
}
}
}
-11
View File
@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 202761b738f529a438db2134c721aae4
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+12 -4
View File
@@ -1,4 +1,4 @@
using Assets.Core;
using System;
using UnityEngine;
@@ -83,11 +83,19 @@ namespace Assets.AR
{
if ((UnityEngine.Object)this.animator != (UnityEngine.Object)null)
{
//根据人物当前的属性计算动画状态
animator.SetFloat("speed", (float)Speed);
animator.SetFloat("power", (float)Power);
if (lastSpeed > 0)
{
animator.Play("rideLoop");
}
else
{
animator.Play("idle");
}
animator.SetFloat("speed", lastSpeed);
}
}
private string LastAnimatorState { get; set; }
protected override void Start()
{