diff options
Diffstat (limited to 'OpenSim/Region/Physics')
3 files changed, 43 insertions, 25 deletions
diff --git a/OpenSim/Region/Physics/UbitOdePlugin/ODERayCastRequestManager.cs b/OpenSim/Region/Physics/UbitOdePlugin/ODERayCastRequestManager.cs index 6e9281b..7fe3109 100644 --- a/OpenSim/Region/Physics/UbitOdePlugin/ODERayCastRequestManager.cs +++ b/OpenSim/Region/Physics/UbitOdePlugin/ODERayCastRequestManager.cs | |||
@@ -173,8 +173,13 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
173 | d.GeomRaySetClosestHit(ray, closestHit); | 173 | d.GeomRaySetClosestHit(ray, closestHit); |
174 | 174 | ||
175 | if (req.callbackMethod is RaycastCallback) | 175 | if (req.callbackMethod is RaycastCallback) |
176 | { | ||
176 | // if we only want one get only one per Collision pair saving memory | 177 | // if we only want one get only one per Collision pair saving memory |
177 | CurrentRayFilter |= RayFilterFlags.ClosestHit; | 178 | CurrentRayFilter |= RayFilterFlags.ClosestHit; |
179 | d.GeomRaySetClosestHit(ray, 1); | ||
180 | } | ||
181 | else | ||
182 | d.GeomRaySetClosestHit(ray, closestHit); | ||
178 | } | 183 | } |
179 | 184 | ||
180 | if ((CurrentRayFilter & RayFilterFlags.ContactsUnImportant) != 0) | 185 | if ((CurrentRayFilter & RayFilterFlags.ContactsUnImportant) != 0) |
@@ -555,10 +560,13 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
555 | 560 | ||
556 | ContactResult collisionresult = new ContactResult(); | 561 | ContactResult collisionresult = new ContactResult(); |
557 | collisionresult.ConsumerID = ID; | 562 | collisionresult.ConsumerID = ID; |
558 | collisionresult.Pos = new Vector3(curcontact.pos.X, curcontact.pos.Y, curcontact.pos.Z); | 563 | collisionresult.Pos.X = curcontact.pos.X; |
564 | collisionresult.Pos.Y = curcontact.pos.Y; | ||
565 | collisionresult.Pos.Z = curcontact.pos.Z; | ||
559 | collisionresult.Depth = curcontact.depth; | 566 | collisionresult.Depth = curcontact.depth; |
560 | collisionresult.Normal = new Vector3(curcontact.normal.X, curcontact.normal.Y, | 567 | collisionresult.Normal.X = curcontact.normal.X; |
561 | curcontact.normal.Z); | 568 | collisionresult.Normal.Y = curcontact.normal.Y; |
569 | collisionresult.Normal.Z = curcontact.normal.Z; | ||
562 | lock (m_contactResults) | 570 | lock (m_contactResults) |
563 | { | 571 | { |
564 | m_contactResults.Add(collisionresult); | 572 | m_contactResults.Add(collisionresult); |
@@ -581,10 +589,13 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
581 | 589 | ||
582 | if (curcontact.depth < collisionresult.Depth) | 590 | if (curcontact.depth < collisionresult.Depth) |
583 | { | 591 | { |
584 | collisionresult.Pos = new Vector3(curcontact.pos.X, curcontact.pos.Y, curcontact.pos.Z); | 592 | collisionresult.Pos.X = curcontact.pos.X; |
593 | collisionresult.Pos.Y = curcontact.pos.Y; | ||
594 | collisionresult.Pos.Z = curcontact.pos.Z; | ||
585 | collisionresult.Depth = curcontact.depth; | 595 | collisionresult.Depth = curcontact.depth; |
586 | collisionresult.Normal = new Vector3(curcontact.normal.X, curcontact.normal.Y, | 596 | collisionresult.Normal.X = curcontact.normal.X; |
587 | curcontact.normal.Z); | 597 | collisionresult.Normal.Y = curcontact.normal.Y; |
598 | collisionresult.Normal.Z = curcontact.normal.Z; | ||
588 | } | 599 | } |
589 | } | 600 | } |
590 | 601 | ||
@@ -699,10 +710,13 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
699 | 710 | ||
700 | ContactResult collisionresult = new ContactResult(); | 711 | ContactResult collisionresult = new ContactResult(); |
701 | collisionresult.ConsumerID = ID; | 712 | collisionresult.ConsumerID = ID; |
702 | collisionresult.Pos = new Vector3(curcontact.pos.X, curcontact.pos.Y, curcontact.pos.Z); | 713 | collisionresult.Pos.X = curcontact.pos.X; |
714 | collisionresult.Pos.Y = curcontact.pos.Y; | ||
715 | collisionresult.Pos.Z = curcontact.pos.Z; | ||
703 | collisionresult.Depth = curcontact.depth; | 716 | collisionresult.Depth = curcontact.depth; |
704 | collisionresult.Normal = new Vector3(curcontact.normal.X, curcontact.normal.Y, | 717 | collisionresult.Normal.X = curcontact.normal.X; |
705 | curcontact.normal.Z); | 718 | collisionresult.Normal.Y = curcontact.normal.Y; |
719 | collisionresult.Normal.Z = curcontact.normal.Z; | ||
706 | lock (m_contactResults) | 720 | lock (m_contactResults) |
707 | { | 721 | { |
708 | m_contactResults.Add(collisionresult); | 722 | m_contactResults.Add(collisionresult); |
@@ -725,10 +739,13 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
725 | 739 | ||
726 | if (curcontact.depth < collisionresult.Depth) | 740 | if (curcontact.depth < collisionresult.Depth) |
727 | { | 741 | { |
728 | collisionresult.Pos = new Vector3(curcontact.pos.X, curcontact.pos.Y, curcontact.pos.Z); | 742 | collisionresult.Pos.X = curcontact.pos.X; |
743 | collisionresult.Pos.Y = curcontact.pos.Y; | ||
744 | collisionresult.Pos.Z = curcontact.pos.Z; | ||
729 | collisionresult.Depth = curcontact.depth; | 745 | collisionresult.Depth = curcontact.depth; |
730 | collisionresult.Normal = new Vector3(curcontact.normal.X, curcontact.normal.Y, | 746 | collisionresult.Normal.X = curcontact.normal.X; |
731 | curcontact.normal.Z); | 747 | collisionresult.Normal.Y = curcontact.normal.Y; |
748 | collisionresult.Normal.Z = curcontact.normal.Z; | ||
732 | } | 749 | } |
733 | } | 750 | } |
734 | 751 | ||
diff --git a/OpenSim/Region/Physics/UbitOdePlugin/ODESitAvatar.cs b/OpenSim/Region/Physics/UbitOdePlugin/ODESitAvatar.cs index ecc732a..e9023c3 100644 --- a/OpenSim/Region/Physics/UbitOdePlugin/ODESitAvatar.cs +++ b/OpenSim/Region/Physics/UbitOdePlugin/ODESitAvatar.cs | |||
@@ -78,8 +78,12 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
78 | 78 | ||
79 | IntPtr geom = ((OdePrim)actor).prim_geom; | 79 | IntPtr geom = ((OdePrim)actor).prim_geom; |
80 | 80 | ||
81 | Vector3 geopos = d.GeomGetPositionOMV(geom); | 81 | // Vector3 geopos = d.GeomGetPositionOMV(geom); |
82 | Quaternion geomOri = d.GeomGetQuaternionOMV(geom); | 82 | // Quaternion geomOri = d.GeomGetQuaternionOMV(geom); |
83 | |||
84 | Vector3 geopos = actor.Position; | ||
85 | Quaternion geomOri = actor.Orientation; | ||
86 | |||
83 | Quaternion geomInvOri = Quaternion.Conjugate(geomOri); | 87 | Quaternion geomInvOri = Quaternion.Conjugate(geomOri); |
84 | 88 | ||
85 | Quaternion ori = Quaternion.Identity; | 89 | Quaternion ori = Quaternion.Identity; |
@@ -116,6 +120,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
116 | } | 120 | } |
117 | 121 | ||
118 | int status = 1; | 122 | int status = 1; |
123 | |||
119 | offset = rayResults[0].Pos - geopos; | 124 | offset = rayResults[0].Pos - geopos; |
120 | 125 | ||
121 | d.GeomClassID geoclass = d.GeomGetClass(geom); | 126 | d.GeomClassID geoclass = d.GeomGetClass(geom); |
@@ -191,13 +196,12 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
191 | if (norm.Z < 0.5f) | 196 | if (norm.Z < 0.5f) |
192 | { | 197 | { |
193 | float rayDist = 4.0f; | 198 | float rayDist = 4.0f; |
194 | float curEdgeDist = 0.0f; | ||
195 | 199 | ||
196 | for (int i = 0; i < 6; i++) | 200 | for (int i = 0; i < 6; i++) |
197 | { | 201 | { |
198 | pivot.X -= 0.005f * norm.X; | 202 | pivot.X -= 0.01f * norm.X; |
199 | pivot.Y -= 0.005f * norm.Y; | 203 | pivot.Y -= 0.01f * norm.Y; |
200 | pivot.Z -= 0.005f * norm.Z; | 204 | pivot.Z -= 0.01f * norm.Z; |
201 | 205 | ||
202 | rayDir.X = -norm.X * norm.Z; | 206 | rayDir.X = -norm.X * norm.Z; |
203 | rayDir.Y = -norm.Y * norm.Z; | 207 | rayDir.Y = -norm.Y * norm.Z; |
@@ -208,8 +212,6 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
208 | if (rayResults.Count == 0) | 212 | if (rayResults.Count == 0) |
209 | break; | 213 | break; |
210 | 214 | ||
211 | curEdgeDist += rayResults[0].Depth; | ||
212 | |||
213 | if (Math.Abs(rayResults[0].Normal.Z) < 0.7f) | 215 | if (Math.Abs(rayResults[0].Normal.Z) < 0.7f) |
214 | { | 216 | { |
215 | rayDist -= rayResults[0].Depth; | 217 | rayDist -= rayResults[0].Depth; |
@@ -226,7 +228,6 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
226 | else | 228 | else |
227 | { | 229 | { |
228 | foundEdge = true; | 230 | foundEdge = true; |
229 | edgeDist = curEdgeDist; | ||
230 | edgePos = rayResults[0].Pos; | 231 | edgePos = rayResults[0].Pos; |
231 | break; | 232 | break; |
232 | } | 233 | } |
@@ -254,7 +255,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
254 | 255 | ||
255 | for (int i = 0; i < 3; i++) | 256 | for (int i = 0; i < 3; i++) |
256 | { | 257 | { |
257 | pivot.Z -= 0.005f; | 258 | pivot.Z -= 0.01f; |
258 | rayDir.X = toCamX; | 259 | rayDir.X = toCamX; |
259 | rayDir.Y = toCamY; | 260 | rayDir.Y = toCamY; |
260 | rayDir.Z = (-toCamX * norm.X - toCamY * norm.Y) / norm.Z; | 261 | rayDir.Z = (-toCamX * norm.X - toCamY * norm.Y) / norm.Z; |
diff --git a/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs b/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs index d045b59..0d18adb 100644 --- a/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs +++ b/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs | |||
@@ -2586,7 +2586,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
2586 | req.Normal = direction; | 2586 | req.Normal = direction; |
2587 | req.Origin = position; | 2587 | req.Origin = position; |
2588 | req.Count = 0; | 2588 | req.Count = 0; |
2589 | req.filter = RayFilterFlags.All; | 2589 | req.filter = RayFilterFlags.AllPrims; |
2590 | 2590 | ||
2591 | m_rayCastManager.QueueRequest(req); | 2591 | m_rayCastManager.QueueRequest(req); |
2592 | } | 2592 | } |
@@ -2603,7 +2603,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
2603 | req.Normal = direction; | 2603 | req.Normal = direction; |
2604 | req.Origin = position; | 2604 | req.Origin = position; |
2605 | req.Count = Count; | 2605 | req.Count = Count; |
2606 | req.filter = RayFilterFlags.All; | 2606 | req.filter = RayFilterFlags.AllPrims; |
2607 | 2607 | ||
2608 | m_rayCastManager.QueueRequest(req); | 2608 | m_rayCastManager.QueueRequest(req); |
2609 | } | 2609 | } |
@@ -2631,7 +2631,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
2631 | req.Normal = direction; | 2631 | req.Normal = direction; |
2632 | req.Origin = position; | 2632 | req.Origin = position; |
2633 | req.Count = Count; | 2633 | req.Count = Count; |
2634 | req.filter = RayFilterFlags.All; | 2634 | req.filter = RayFilterFlags.AllPrims; |
2635 | 2635 | ||
2636 | lock (SyncObject) | 2636 | lock (SyncObject) |
2637 | { | 2637 | { |