修改预计算和clashdetective检测高度不一致的问题
This commit is contained in:
parent
f02e5cfc28
commit
4f7935499d
@ -596,7 +596,6 @@ namespace NavisworksTransport.Core.Animation
|
||||
{
|
||||
var colliderBox = collider.BoundingBox();
|
||||
|
||||
// 🔥 调试日志:输出包围盒信息
|
||||
// 使用改进的精确距离检测方法(先检查相交,再计算精确距离)
|
||||
double preciseDistance = BoundingBoxGeometryUtils.CalculatePreciseDistance(virtualBoundingBox, colliderBox);
|
||||
bool intersects = preciseDistance <= _detectionGap;
|
||||
@ -617,7 +616,17 @@ namespace NavisworksTransport.Core.Animation
|
||||
(virtualBoundingBox.Min.Y + virtualBoundingBox.Max.Y + colliderBox.Min.Y + colliderBox.Max.Y) / 4,
|
||||
(virtualBoundingBox.Min.Z + virtualBoundingBox.Max.Z + colliderBox.Min.Z + colliderBox.Max.Z) / 4
|
||||
),
|
||||
Item1Position = framePosition,
|
||||
// 🔥 重要:记录虚拟车辆的包围盒中心,而不是底面中心
|
||||
// 原因:
|
||||
// 1. framePosition是路径点,代表车辆在地面上的位置(底面中心)
|
||||
// 2. ClashDetective移动逻辑使用包围盒中心进行定位
|
||||
// 3. 如果记录底面中心,ClashDetective会把包围盒中心移动到底面位置,导致车辆下沉半个高度
|
||||
// 4. 记录包围盒中心可以确保ClashDetective移动后的位置与预计算时的虚拟车辆位置一致
|
||||
Item1Position = new Point3D(
|
||||
framePosition.X,
|
||||
framePosition.Y,
|
||||
framePosition.Z + (virtualBoundingBox.Max.Z - virtualBoundingBox.Min.Z) / 2
|
||||
),
|
||||
Item2Position = GetObjectPosition(collider),
|
||||
HasPositionInfo = true
|
||||
};
|
||||
|
||||
Loading…
Reference in New Issue
Block a user