diff --git a/src/Core/Animation/PathAnimationManager.cs b/src/Core/Animation/PathAnimationManager.cs
index c3c7310..e5decab 100644
--- a/src/Core/Animation/PathAnimationManager.cs
+++ b/src/Core/Animation/PathAnimationManager.cs
@@ -2541,6 +2541,16 @@ namespace NavisworksTransport.Core.Animation
}
}
+ ///
+ /// 直接设置物体角度修正值(不触发物体旋转)
+ ///
+ /// 角度修正值(度)
+ public void SetObjectRotationCorrectionDirect(double rotationCorrection)
+ {
+ _objectRotationCorrection = rotationCorrection;
+ LogManager.Debug($"[角度修正] 直接设置角度修正值: {_objectRotationCorrection:F1}°(不触发旋转)");
+ }
+
#region 动画实现方法
@@ -2800,6 +2810,10 @@ namespace NavisworksTransport.Core.Animation
sb.Append(vehicleSizeString);
sb.Append("|");
+ // 包含角度修正(确保角度修正改变时重新检测)
+ sb.Append($"RotationCorrection:{_objectRotationCorrection:F2}deg");
+ sb.Append("|");
+
// 包含手工检测对象列表(确保手工指定模式的目标变化时重新检测)
if (_manualCollisionOverrideEnabled && _manualCollisionTargets != null && _manualCollisionTargets.Count > 0)
{
diff --git a/src/UI/WPF/ViewModels/AnimationControlViewModel.cs b/src/UI/WPF/ViewModels/AnimationControlViewModel.cs
index e58cde0..cbfcaf1 100644
--- a/src/UI/WPF/ViewModels/AnimationControlViewModel.cs
+++ b/src/UI/WPF/ViewModels/AnimationControlViewModel.cs
@@ -1326,9 +1326,10 @@ namespace NavisworksTransport.UI.WPF.ViewModels
// 1. 保存旧物体引用,在设置新物体之前
var oldObject = _selectedAnimatedObject;
+ bool isSameObject = oldObject != null && ReferenceEquals(oldObject, newObject);
// 2. 如果有旧物体且与新物体不同,先归位
- if (oldObject != null && !ReferenceEquals(oldObject, newObject))
+ if (!isSameObject && oldObject != null)
{
_pathAnimationManager?.RestoreObjectToCADPosition();
LogManager.Info($"[选择物体] 已归位旧物体: {oldObject.DisplayName}");
@@ -1347,8 +1348,16 @@ namespace NavisworksTransport.UI.WPF.ViewModels
SelectedAnimatedObject = newObject;
LogManager.Info($"已选择移动物体: {SelectedAnimatedObject.DisplayName}");
- // 重置PathAnimationManager的角度修正值(每个物体的旋转独立)
- _pathAnimationManager?.SetObjectRotationCorrection(0.0);
+ // 只有选择不同的物体时,才重置角度修正值
+ if (!isSameObject)
+ {
+ _pathAnimationManager?.SetObjectRotationCorrectionDirect(0.0);
+ LogManager.Debug($"[选择物体] 已重置角度修正值为0度(新物体)");
+ }
+ else
+ {
+ LogManager.Debug($"[选择物体] 保持当前角度修正值(同一物体)");
+ }
// 3. 立即移动到起点(如果路径存在)
if (CurrentPathRoute != null && CurrentPathRoute.Points != null && _pathAnimationManager != null)