diff options
author | Teravus Ovares | 2008-05-03 04:33:17 +0000 |
---|---|---|
committer | Teravus Ovares | 2008-05-03 04:33:17 +0000 |
commit | 07167c9a3f6d93fddf66e6f252f4a9b3a4fde8de (patch) | |
tree | 7b19dfcf5db2afcd1bbacbf55298f14669b0f615 /OpenSim/Region/Environment/Scenes/SceneObjectPart.cs | |
parent | Thank you kindly, Melanie for a patch to solve (diff) | |
download | opensim-SC_OLD-07167c9a3f6d93fddf66e6f252f4a9b3a4fde8de.zip opensim-SC_OLD-07167c9a3f6d93fddf66e6f252f4a9b3a4fde8de.tar.gz opensim-SC_OLD-07167c9a3f6d93fddf66e6f252f4a9b3a4fde8de.tar.bz2 opensim-SC_OLD-07167c9a3f6d93fddf66e6f252f4a9b3a4fde8de.tar.xz |
* Committing some collision stuffs that I'm working on.
* Nothing user facing yet.
Diffstat (limited to 'OpenSim/Region/Environment/Scenes/SceneObjectPart.cs')
-rw-r--r-- | OpenSim/Region/Environment/Scenes/SceneObjectPart.cs | 55 |
1 files changed, 50 insertions, 5 deletions
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs index 35eabbd..9b4f9af 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs | |||
@@ -1329,7 +1329,15 @@ namespace OpenSim.Region.Environment.Scenes | |||
1329 | AmBa = FaceA[i] - FaceB[i]; | 1329 | AmBa = FaceA[i] - FaceB[i]; |
1330 | AmBb = FaceB[i] - FaceC[i]; | 1330 | AmBb = FaceB[i] - FaceC[i]; |
1331 | d = normals[i].Dot(FaceB[i]); | 1331 | d = normals[i].Dot(FaceB[i]); |
1332 | c = iray.Direction.Dot(normals[i]); | 1332 | |
1333 | if (faceCenters) | ||
1334 | { | ||
1335 | c = normals[i].Dot(normals[i]); | ||
1336 | } | ||
1337 | else | ||
1338 | { | ||
1339 | c = iray.Direction.Dot(normals[i]); | ||
1340 | } | ||
1333 | if (c == 0) | 1341 | if (c == 0) |
1334 | continue; | 1342 | continue; |
1335 | 1343 | ||
@@ -1339,12 +1347,15 @@ namespace OpenSim.Region.Environment.Scenes | |||
1339 | continue; | 1347 | continue; |
1340 | 1348 | ||
1341 | // If the normal is pointing outside the object | 1349 | // If the normal is pointing outside the object |
1350 | |||
1351 | |||
1352 | |||
1342 | if (iray.Direction.Dot(normals[i]) < 0 || !frontFacesOnly) | 1353 | if (iray.Direction.Dot(normals[i]) < 0 || !frontFacesOnly) |
1343 | { | 1354 | { |
1344 | 1355 | ||
1345 | if (faceCenters) | 1356 | if (faceCenters) |
1346 | { | 1357 | { //(FaceA[i] + FaceB[i] + FaceC[1] + FaceD[i]) / 4f; |
1347 | q = (FaceA[i] + FaceB[i] + FaceC[1] + FaceD[i]) / 4f; //iray.Origin + a * normals[i]; | 1358 | q = iray.Origin + a * normals[i]; |
1348 | } | 1359 | } |
1349 | else | 1360 | else |
1350 | { | 1361 | { |
@@ -1364,8 +1375,9 @@ namespace OpenSim.Region.Environment.Scenes | |||
1364 | returnresult.distance = distance2; | 1375 | returnresult.distance = distance2; |
1365 | returnresult.HitTF = true; | 1376 | returnresult.HitTF = true; |
1366 | returnresult.ipoint = q; | 1377 | returnresult.ipoint = q; |
1367 | //m_log.Info("[FACE]:" + i.ToString()); | 1378 | m_log.Info("[FACE]:" + i.ToString()); |
1368 | //m_log.Info("[POINT]: " + q.ToString()); | 1379 | m_log.Info("[POINT]: " + q.ToString()); |
1380 | m_log.Info("[DIST]: " + distance2.ToString()); | ||
1369 | returnresult.normal = normals[i]; | 1381 | returnresult.normal = normals[i]; |
1370 | returnresult.AAfaceNormal = AAfacenormals[i]; | 1382 | returnresult.AAfaceNormal = AAfacenormals[i]; |
1371 | 1383 | ||
@@ -2680,6 +2692,20 @@ namespace OpenSim.Region.Environment.Scenes | |||
2680 | ) | 2692 | ) |
2681 | { | 2693 | { |
2682 | // subscribe to physics updates. | 2694 | // subscribe to physics updates. |
2695 | if (PhysActor != null) | ||
2696 | { | ||
2697 | PhysActor.OnCollisionUpdate += PhysicsCollision; | ||
2698 | PhysActor.SubscribeEvents(1000); | ||
2699 | |||
2700 | } | ||
2701 | } | ||
2702 | else | ||
2703 | { | ||
2704 | if (PhysActor != null) | ||
2705 | { | ||
2706 | PhysActor.UnSubscribeEvents(); | ||
2707 | PhysActor.OnCollisionUpdate -= PhysicsCollision; | ||
2708 | } | ||
2683 | } | 2709 | } |
2684 | 2710 | ||
2685 | LocalFlags=(LLObject.ObjectFlags)objectflagupdate; | 2711 | LocalFlags=(LLObject.ObjectFlags)objectflagupdate; |
@@ -2689,5 +2715,24 @@ namespace OpenSim.Region.Environment.Scenes | |||
2689 | else | 2715 | else |
2690 | ScheduleFullUpdate(); | 2716 | ScheduleFullUpdate(); |
2691 | } | 2717 | } |
2718 | public void PhysicsCollision(EventArgs e) | ||
2719 | { | ||
2720 | |||
2721 | return; | ||
2722 | |||
2723 | // | ||
2724 | //if (e == null) | ||
2725 | //{ | ||
2726 | // return; | ||
2727 | //} | ||
2728 | //CollisionEventUpdate a = (CollisionEventUpdate)e; | ||
2729 | //Dictionary<uint, float> collissionswith = a.m_objCollisionList; | ||
2730 | //foreach (uint localid in collissionswith.Keys) | ||
2731 | //{ | ||
2732 | // m_log.Debug("[OBJECT]: Collided with:" + localid.ToString() + " at depth of: " + collissionswith[localid].ToString()); | ||
2733 | //} | ||
2734 | |||
2735 | } | ||
2692 | } | 2736 | } |
2737 | |||
2693 | } | 2738 | } |