diff options
Diffstat (limited to 'OpenSim/Region/Environment/Scenes/SceneObjectPart.cs')
-rw-r--r-- | OpenSim/Region/Environment/Scenes/SceneObjectPart.cs | 62 |
1 files changed, 40 insertions, 22 deletions
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs index 614726e..2515122 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs | |||
@@ -1352,14 +1352,14 @@ namespace OpenSim.Region.Environment.Scenes | |||
1352 | AmBb = FaceB[i] - FaceC[i]; | 1352 | AmBb = FaceB[i] - FaceC[i]; |
1353 | d = normals[i].Dot(FaceB[i]); | 1353 | d = normals[i].Dot(FaceB[i]); |
1354 | 1354 | ||
1355 | if (faceCenters) | 1355 | //if (faceCenters) |
1356 | { | 1356 | //{ |
1357 | c = normals[i].Dot(normals[i]); | 1357 | // c = normals[i].Dot(normals[i]); |
1358 | } | 1358 | //} |
1359 | else | 1359 | //else |
1360 | { | 1360 | //{ |
1361 | c = iray.Direction.Dot(normals[i]); | 1361 | c = iray.Direction.Dot(normals[i]); |
1362 | } | 1362 | //} |
1363 | if (c == 0) | 1363 | if (c == 0) |
1364 | continue; | 1364 | continue; |
1365 | 1365 | ||
@@ -1375,21 +1375,21 @@ namespace OpenSim.Region.Environment.Scenes | |||
1375 | if (iray.Direction.Dot(normals[i]) < 0 || !frontFacesOnly) | 1375 | if (iray.Direction.Dot(normals[i]) < 0 || !frontFacesOnly) |
1376 | { | 1376 | { |
1377 | 1377 | ||
1378 | if (faceCenters) | 1378 | //if (faceCenters) |
1379 | { //(FaceA[i] + FaceB[i] + FaceC[1] + FaceD[i]) / 4f; | 1379 | //{ //(FaceA[i] + FaceB[i] + FaceC[1] + FaceD[i]) / 4f; |
1380 | q = iray.Origin + a * normals[i]; | 1380 | // q = iray.Origin + a * normals[i]; |
1381 | } | 1381 | //} |
1382 | else | 1382 | //else |
1383 | { | 1383 | //{ |
1384 | q = iray.Origin + a * iray.Direction; | 1384 | q = iray.Origin + a * iray.Direction; |
1385 | } | 1385 | //} |
1386 | 1386 | ||
1387 | float distance2 = (float)GetDistanceTo(q, AXpos); | 1387 | float distance2 = (float)GetDistanceTo(q, AXpos); |
1388 | // Is this the closest hit to the object's origin? | 1388 | // Is this the closest hit to the object's origin? |
1389 | if (faceCenters) | 1389 | //if (faceCenters) |
1390 | { | 1390 | //{ |
1391 | distance2 = (float)GetDistanceTo(q, iray.Origin); | 1391 | // distance2 = (float)GetDistanceTo(q, iray.Origin); |
1392 | } | 1392 | //} |
1393 | 1393 | ||
1394 | 1394 | ||
1395 | if (distance2 < returnresult.distance) | 1395 | if (distance2 < returnresult.distance) |
@@ -1397,10 +1397,28 @@ namespace OpenSim.Region.Environment.Scenes | |||
1397 | returnresult.distance = distance2; | 1397 | returnresult.distance = distance2; |
1398 | returnresult.HitTF = true; | 1398 | returnresult.HitTF = true; |
1399 | returnresult.ipoint = q; | 1399 | returnresult.ipoint = q; |
1400 | m_log.Info("[FACE]:" + i.ToString()); | 1400 | //m_log.Info("[FACE]:" + i.ToString()); |
1401 | m_log.Info("[POINT]: " + q.ToString()); | 1401 | //m_log.Info("[POINT]: " + q.ToString()); |
1402 | m_log.Info("[DIST]: " + distance2.ToString()); | 1402 | //m_log.Info("[DIST]: " + distance2.ToString()); |
1403 | returnresult.normal = normals[i]; | 1403 | if (faceCenters) |
1404 | { | ||
1405 | returnresult.normal = (AXrot * AAfacenormals[i]); | ||
1406 | |||
1407 | Vector3 scaleComponent = AAfacenormals[i]; | ||
1408 | float ScaleOffset = 0.5f; | ||
1409 | if (scaleComponent.x != 0) ScaleOffset = AXscale.x; | ||
1410 | if (scaleComponent.y != 0) ScaleOffset = AXscale.y; | ||
1411 | if (scaleComponent.z != 0) ScaleOffset = AXscale.z; | ||
1412 | ScaleOffset = Math.Abs(ScaleOffset); | ||
1413 | Vector3 offset = (returnresult.normal * ScaleOffset); | ||
1414 | returnresult.ipoint = (AXpos + offset ); | ||
1415 | |||
1416 | ///pos = (intersectionpoint + offset); | ||
1417 | } | ||
1418 | else | ||
1419 | { | ||
1420 | returnresult.normal = normals[i]; | ||
1421 | } | ||
1404 | returnresult.AAfaceNormal = AAfacenormals[i]; | 1422 | returnresult.AAfaceNormal = AAfacenormals[i]; |
1405 | 1423 | ||
1406 | } | 1424 | } |