脚本同步逻辑修改
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -17,3 +17,5 @@
|
|||||||
/Assets/ResRaw/Effect/Z_Test
|
/Assets/ResRaw/Effect/Z_Test
|
||||||
/Assets/ResRaw/Effect/Z_Test.meta
|
/Assets/ResRaw/Effect/Z_Test.meta
|
||||||
/Bundles/
|
/Bundles/
|
||||||
|
Assets/Scripts/sync.ffs_db
|
||||||
|
Assets/Scripts/sync.ffs_db.meta
|
||||||
|
|||||||
@@ -146,8 +146,16 @@ namespace NBF.Fishing2
|
|||||||
|
|
||||||
Vector3 movementDirection = Vector3.zero;
|
Vector3 movementDirection = Vector3.zero;
|
||||||
|
|
||||||
movementDirection += Vector3.forward * movementInput.y;
|
// 修改:根据角色当前朝向计算移动方向
|
||||||
movementDirection += Vector3.right * movementInput.x;
|
if (!isStop)
|
||||||
|
{
|
||||||
|
// 获取角色当前的右向和前向(在水平面上)
|
||||||
|
Vector3 characterRight = Vector3.ProjectOnPlane(characterController.transform.right, Vector3.up).normalized;
|
||||||
|
Vector3 characterForward = Vector3.ProjectOnPlane(characterController.transform.forward, Vector3.up).normalized;
|
||||||
|
|
||||||
|
// 根据角色朝向计算实际移动方向
|
||||||
|
movementDirection = characterForward * movementInput.y + characterRight * movementInput.x;
|
||||||
|
}
|
||||||
|
|
||||||
Net.Send(new C2Map_Move()
|
Net.Send(new C2Map_Move()
|
||||||
{
|
{
|
||||||
@@ -293,7 +301,7 @@ namespace NBF.Fishing2
|
|||||||
targetPosition,
|
targetPosition,
|
||||||
positionLerpSpeed * Time.deltaTime);
|
positionLerpSpeed * Time.deltaTime);
|
||||||
|
|
||||||
// 插值旋转
|
// 插值旋转 - 使用更平滑的插值方法
|
||||||
characterController.transform.rotation = Quaternion.Slerp(
|
characterController.transform.rotation = Quaternion.Slerp(
|
||||||
characterController.transform.rotation,
|
characterController.transform.rotation,
|
||||||
targetRotation,
|
targetRotation,
|
||||||
@@ -356,4 +364,4 @@ namespace NBF.Fishing2
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user