脚本同步逻辑修改

This commit is contained in:
2025-09-10 23:52:34 +08:00
parent d189e68656
commit 20a9815359
2 changed files with 14 additions and 4 deletions

2
.gitignore vendored
View File

@@ -17,3 +17,5 @@
/Assets/ResRaw/Effect/Z_Test
/Assets/ResRaw/Effect/Z_Test.meta
/Bundles/
Assets/Scripts/sync.ffs_db
Assets/Scripts/sync.ffs_db.meta

View File

@@ -146,8 +146,16 @@ namespace NBF.Fishing2
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()
{
@@ -293,7 +301,7 @@ namespace NBF.Fishing2
targetPosition,
positionLerpSpeed * Time.deltaTime);
// 插值旋转
// 插值旋转 - 使用更平滑的插值方法
characterController.transform.rotation = Quaternion.Slerp(
characterController.transform.rotation,
targetRotation,
@@ -356,4 +364,4 @@ namespace NBF.Fishing2
#endregion
}
}
}