视角切换&小地图模糊问题解决
This commit is contained in:
1 parent
9bc3864790
commit
e4d4333357
30 files changed
+3746
-2965
No files matched your search
@@ -26,7 +26,7 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
//AbstractMap map;
|
||||
|
||||
#region 动画控制参数
|
||||
Vector3 nextPos;
|
||||
public Vector3 nextPos;
|
||||
Vector3 prePos = Vector3.zero;
|
||||
float timer = 1.0f;//计时器
|
||||
#endregion
|
||||
@@ -124,6 +124,7 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
characterAnimator.SetBool("ReachEnd", true);//到达终点
|
||||
}
|
||||
}
|
||||
|
||||
//开始骑行
|
||||
if (mainController.isStart)
|
||||
{
|
||||
@@ -154,7 +155,7 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
//数据处理
|
||||
|
||||
nextPos = map.GeoToWorldPosition(currentlatlong);//下一个点
|
||||
nextPos.y += 1f;//提高y轴让人物站在地图上面
|
||||
nextPos.y += 1.15f;//提高y轴让人物站在地图上面
|
||||
prePos = transform.localPosition;//当前点
|
||||
thisRotation = transform.localRotation;
|
||||
//移动动画控制
|
||||
@@ -224,7 +225,8 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
nextSlopeDistance = sumDistance - totalDistance * 1000;
|
||||
NextSlopeTotalDistance = pointList[nextIndex].Distance;
|
||||
currentSlopeDistance = CurrentDistance-( totalDistance * 1000 - (sumDistance - pointList[index].Distance));
|
||||
|
||||
//人物初始化角度控制
|
||||
|
||||
}
|
||||
public double PreElevation;
|
||||
public double PreSlope;
|
||||
@@ -232,8 +234,9 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
#endregion
|
||||
|
||||
#region 人物移动与转向控制
|
||||
|
||||
|
||||
Quaternion thisRotation;
|
||||
public Quaternion currentRotation;
|
||||
IEnumerator LookAtNextPos()
|
||||
{
|
||||
Quaternion neededRotation = Quaternion.LookRotation(prePos - nextPos);
|
||||
@@ -243,8 +246,8 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
while (t < 1.0f)
|
||||
{
|
||||
t += Time.deltaTime / 0.5f;
|
||||
var rotationValue = Quaternion.Slerp(thisRotation, neededRotation, t);
|
||||
character.transform.rotation = Quaternion.Euler(0, rotationValue.eulerAngles.y, 0);
|
||||
currentRotation = Quaternion.Slerp(thisRotation, neededRotation, t);
|
||||
character.transform.rotation = Quaternion.Euler(0, currentRotation.eulerAngles.y, 0);
|
||||
yield return null;
|
||||
}
|
||||
}
|
||||
@@ -257,6 +260,7 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
Camera.main.transform.position = Vector3.Lerp(Camera.main.transform.position, Camera.main.transform.position + deltaPos, Time.time);
|
||||
previousPos = transform.position;
|
||||
}
|
||||
public Vector3 currentPos = new Vector3(0,0,0);
|
||||
//人物移动控制
|
||||
IEnumerator MoveTo()
|
||||
{
|
||||
@@ -271,6 +275,7 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
Vector3 nextPosition = new Vector3((float)Math.Round(v.x, 2), (float)Math.Round(v.y, 2), (float)Math.Round(v.z, 2));
|
||||
if (!nextPosition.Equals(transform.localPosition))
|
||||
{
|
||||
currentPos = nextPosition;
|
||||
transform.localPosition = nextPosition;
|
||||
//Camera.main.transform.localPosition = nextPosition;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user