Unify real-object override rotation application
This commit is contained in:
parent
7ff510daf0
commit
9e8fea3241
@ -141,5 +141,12 @@ namespace NavisworksTransport.UnitTests.CoordinateSystem
|
||||
Assert.AreEqual(trackedRotation.C, resolved.C, 1e-9);
|
||||
Assert.AreEqual(trackedRotation.D, resolved.D, 1e-9);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void ShouldUseRealObjectOverrideRotation_ShouldEnableForRealObjects()
|
||||
{
|
||||
Assert.IsTrue(PathAnimationManager.ShouldUseRealObjectOverrideRotation(true));
|
||||
Assert.IsFalse(PathAnimationManager.ShouldUseRealObjectOverrideRotation(false));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -2748,7 +2748,7 @@ namespace NavisworksTransport.Core.Animation
|
||||
try
|
||||
{
|
||||
ModelItem controlledObject = CurrentControlledObject;
|
||||
bool isRailRealObject = _route?.PathType == PathType.Rail && IsRealObjectMode && controlledObject != null;
|
||||
bool usesRealObjectOverrideRotation = ShouldUseRealObjectOverrideRotation(IsRealObjectMode) && controlledObject != null;
|
||||
if (controlledObject == null)
|
||||
{
|
||||
return;
|
||||
@ -2841,7 +2841,7 @@ namespace NavisworksTransport.Core.Animation
|
||||
}
|
||||
currentRotationForTransform = currentRotation;
|
||||
|
||||
if (isRailRealObject)
|
||||
if (usesRealObjectOverrideRotation)
|
||||
{
|
||||
if (ModelItemTransformHelper.TryGetCurrentOverrideRotation(controlledObject, out var currentOverrideRotation))
|
||||
{
|
||||
@ -2896,11 +2896,11 @@ namespace NavisworksTransport.Core.Animation
|
||||
$"Y=({targetLinear.Get(0, 1):F4},{targetLinear.Get(1, 1):F4},{targetLinear.Get(2, 1):F4}), " +
|
||||
$"Z=({targetLinear.Get(0, 2):F4},{targetLinear.Get(1, 2):F4},{targetLinear.Get(2, 2):F4})");
|
||||
|
||||
if (isRailRealObject)
|
||||
if (usesRealObjectOverrideRotation)
|
||||
{
|
||||
var overrideLinear = new Transform3D(targetRotationForTransform).Linear;
|
||||
LogManager.Debug(
|
||||
$"[Rail覆盖姿态] {controlledObject.DisplayName} Override目标: " +
|
||||
$"[真实物体覆盖姿态] {controlledObject.DisplayName} Override目标: " +
|
||||
$"X=({overrideLinear.Get(0, 0):F4},{overrideLinear.Get(1, 0):F4},{overrideLinear.Get(2, 0):F4}), " +
|
||||
$"Y=({overrideLinear.Get(0, 1):F4},{overrideLinear.Get(1, 1):F4},{overrideLinear.Get(2, 1):F4}), " +
|
||||
$"Z=({overrideLinear.Get(0, 2):F4},{overrideLinear.Get(1, 2):F4},{overrideLinear.Get(2, 2):F4})");
|
||||
@ -2918,11 +2918,11 @@ namespace NavisworksTransport.Core.Animation
|
||||
_hasTrackedRotation = true;
|
||||
_currentYaw = ModelItemTransformHelper.GetYawFromRotation(appliedTargetRotation);
|
||||
|
||||
if (isRailRealObject)
|
||||
if (usesRealObjectOverrideRotation)
|
||||
{
|
||||
Point3D hostActualAfter = GetTrackedObjectPosition(controlledObject);
|
||||
LogManager.Debug(
|
||||
$"[Rail姿态应用] 宿主最终跟踪中心=({hostActualAfter.X:F3},{hostActualAfter.Y:F3},{hostActualAfter.Z:F3}), " +
|
||||
$"[真实物体姿态应用] 宿主最终跟踪中心=({hostActualAfter.X:F3},{hostActualAfter.Y:F3},{hostActualAfter.Z:F3}), " +
|
||||
$"目标跟踪中心=({newPosition.X:F3},{newPosition.Y:F3},{newPosition.Z:F3}), " +
|
||||
$"偏差=({hostActualAfter.X - newPosition.X:F3},{hostActualAfter.Y - newPosition.Y:F3},{hostActualAfter.Z - newPosition.Z:F3})");
|
||||
}
|
||||
@ -4036,6 +4036,11 @@ namespace NavisworksTransport.Core.Animation
|
||||
return transformRotation;
|
||||
}
|
||||
|
||||
internal static bool ShouldUseRealObjectOverrideRotation(bool isRealObjectMode)
|
||||
{
|
||||
return isRealObjectMode;
|
||||
}
|
||||
|
||||
private void SyncTrackedRotationToDisplayedPose(ModelItem sourceObject)
|
||||
{
|
||||
if (sourceObject == null)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user