diff options
author | Melanie | 2012-12-22 01:04:49 +0100 |
---|---|---|
committer | Melanie | 2012-12-22 01:04:49 +0100 |
commit | 2313a86e327c895667b133af785e1bd13233ffa2 (patch) | |
tree | 6180c1546b9f911b81fcaa50f1bb587611135ce3 /OpenSim/Region/Physics | |
parent | * Partial Commit for Avatar Appearance to include the functionality of Cached... (diff) | |
parent | Merge branch 'avination' into ubitwork (diff) | |
download | opensim-SC-2313a86e327c895667b133af785e1bd13233ffa2.zip opensim-SC-2313a86e327c895667b133af785e1bd13233ffa2.tar.gz opensim-SC-2313a86e327c895667b133af785e1bd13233ffa2.tar.bz2 opensim-SC-2313a86e327c895667b133af785e1bd13233ffa2.tar.xz |
Merge branch 'ubitwork' into avination
Diffstat (limited to 'OpenSim/Region/Physics')
4 files changed, 31 insertions, 13 deletions
diff --git a/OpenSim/Region/Physics/Manager/PhysicsScene.cs b/OpenSim/Region/Physics/Manager/PhysicsScene.cs index a442cf0..86e0713 100644 --- a/OpenSim/Region/Physics/Manager/PhysicsScene.cs +++ b/OpenSim/Region/Physics/Manager/PhysicsScene.cs | |||
@@ -353,7 +353,7 @@ namespace OpenSim.Region.Physics.Manager | |||
353 | 353 | ||
354 | public virtual void RaycastActor(PhysicsActor actor, Vector3 position, Vector3 direction, float length, RaycastCallback retMethod){} | 354 | public virtual void RaycastActor(PhysicsActor actor, Vector3 position, Vector3 direction, float length, RaycastCallback retMethod){} |
355 | public virtual void RaycastActor(PhysicsActor actor, Vector3 position, Vector3 direction, float length, int Count, RayCallback retMethod) { } | 355 | public virtual void RaycastActor(PhysicsActor actor, Vector3 position, Vector3 direction, float length, int Count, RayCallback retMethod) { } |
356 | public virtual List<ContactResult> RaycastActor(PhysicsActor actor, Vector3 position, Vector3 direction, float length, int Count) | 356 | public virtual List<ContactResult> RaycastActor(PhysicsActor actor, Vector3 position, Vector3 direction, float length, int Count, RayFilterFlags flags) |
357 | { | 357 | { |
358 | return new List<ContactResult>(); | 358 | return new List<ContactResult>(); |
359 | } | 359 | } |
diff --git a/OpenSim/Region/Physics/UbitOdePlugin/ODERayCastRequestManager.cs b/OpenSim/Region/Physics/UbitOdePlugin/ODERayCastRequestManager.cs index 561ab1c..54a83c2 100644 --- a/OpenSim/Region/Physics/UbitOdePlugin/ODERayCastRequestManager.cs +++ b/OpenSim/Region/Physics/UbitOdePlugin/ODERayCastRequestManager.cs | |||
@@ -199,6 +199,20 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
199 | m_PendingRequests.Enqueue(req); | 199 | m_PendingRequests.Enqueue(req); |
200 | } | 200 | } |
201 | 201 | ||
202 | public void QueueRequest(IntPtr geom, Vector3 position, Vector3 direction, float length, int count,RayFilterFlags flags, RayCallback retMethod) | ||
203 | { | ||
204 | ODERayRequest req = new ODERayRequest(); | ||
205 | req.geom = geom; | ||
206 | req.callbackMethod = retMethod; | ||
207 | req.length = length; | ||
208 | req.Normal = direction; | ||
209 | req.Origin = position; | ||
210 | req.Count = count; | ||
211 | req.filter = flags; | ||
212 | |||
213 | m_PendingRequests.Enqueue(req); | ||
214 | } | ||
215 | |||
202 | public void QueueRequest(Vector3 position, Vector3 direction, float length, int count, RaycastCallback retMethod) | 216 | public void QueueRequest(Vector3 position, Vector3 direction, float length, int count, RaycastCallback retMethod) |
203 | { | 217 | { |
204 | ODERayRequest req = new ODERayRequest(); | 218 | ODERayRequest req = new ODERayRequest(); |
diff --git a/OpenSim/Region/Physics/UbitOdePlugin/ODESitAvatar.cs b/OpenSim/Region/Physics/UbitOdePlugin/ODESitAvatar.cs index 225bff8..fd3a3ba 100644 --- a/OpenSim/Region/Physics/UbitOdePlugin/ODESitAvatar.cs +++ b/OpenSim/Region/Physics/UbitOdePlugin/ODESitAvatar.cs | |||
@@ -52,6 +52,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
52 | } | 52 | } |
53 | 53 | ||
54 | private static Vector3 SitAjust = new Vector3(0, 0, 0.4f); | 54 | private static Vector3 SitAjust = new Vector3(0, 0, 0.4f); |
55 | private const RayFilterFlags RaySitFlags = RayFilterFlags.AllPrims | RayFilterFlags.ClosestHit; | ||
55 | 56 | ||
56 | public void Sit(PhysicsActor actor, Vector3 avPos, Vector3 avCameraPosition, Vector3 offset, Vector3 avOffset, SitAvatarCallback PhysicsSitResponse) | 57 | public void Sit(PhysicsActor actor, Vector3 avPos, Vector3 avCameraPosition, Vector3 offset, Vector3 avOffset, SitAvatarCallback PhysicsSitResponse) |
57 | { | 58 | { |
@@ -93,10 +94,10 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
93 | rayDir.Y *= t; | 94 | rayDir.Y *= t; |
94 | rayDir.Z *= t; | 95 | rayDir.Z *= t; |
95 | 96 | ||
96 | raylen += 0.5f; | 97 | raylen += 30f; // focal point may be far |
97 | List<ContactResult> rayResults; | 98 | List<ContactResult> rayResults; |
98 | 99 | ||
99 | rayResults = m_scene.RaycastActor(actor, avCameraPosition, rayDir , raylen, 1); | 100 | rayResults = m_scene.RaycastActor(actor, avCameraPosition, rayDir, raylen, 1, RaySitFlags); |
100 | if (rayResults.Count == 0 || rayResults[0].ConsumerID != actor.LocalID) | 101 | if (rayResults.Count == 0 || rayResults[0].ConsumerID != actor.LocalID) |
101 | { | 102 | { |
102 | d.GeomGetAABB(geom,out aabb); | 103 | d.GeomGetAABB(geom,out aabb); |
@@ -108,6 +109,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
108 | return; | 109 | return; |
109 | } | 110 | } |
110 | 111 | ||
112 | |||
111 | offset = rayResults[0].Pos - geopos; | 113 | offset = rayResults[0].Pos - geopos; |
112 | double ang; | 114 | double ang; |
113 | float s; | 115 | float s; |
@@ -156,13 +158,16 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
156 | return; | 158 | return; |
157 | } | 159 | } |
158 | 160 | ||
159 | Vector3 norm = rayResults[0].Normal; | 161 | /* |
162 | // contact normals aren't reliable on meshs or sculpts it seems | ||
163 | Vector3 norm = rayResults[0].Normal; | ||
160 | 164 | ||
161 | if (norm.Z < 0) | 165 | if (norm.Z < 0) |
162 | { | 166 | { |
163 | PhysicsSitResponse(0, actor.LocalID, offset, Quaternion.Identity); | 167 | PhysicsSitResponse(0, actor.LocalID, offset, Quaternion.Identity); |
164 | return; | 168 | return; |
165 | } | 169 | } |
170 | */ | ||
166 | 171 | ||
167 | ang = Math.Atan2(-rayDir.Y, -rayDir.X); | 172 | ang = Math.Atan2(-rayDir.Y, -rayDir.X); |
168 | ang *= 0.5d; | 173 | ang *= 0.5d; |
diff --git a/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs b/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs index fbf2f0d..d344d4d 100644 --- a/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs +++ b/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs | |||
@@ -2675,9 +2675,8 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
2675 | m_rayCastManager.QueueRequest(geom,position, direction, length, Count, retMethod); | 2675 | m_rayCastManager.QueueRequest(geom,position, direction, length, Count, retMethod); |
2676 | } | 2676 | } |
2677 | } | 2677 | } |
2678 | 2678 | ||
2679 | // don't like this | 2679 | public override List<ContactResult> RaycastActor(PhysicsActor actor, Vector3 position, Vector3 direction, float length, int Count, RayFilterFlags flags) |
2680 | public override List<ContactResult> RaycastActor(PhysicsActor actor, Vector3 position, Vector3 direction, float length, int Count) | ||
2681 | { | 2680 | { |
2682 | if (actor != null) | 2681 | if (actor != null) |
2683 | { | 2682 | { |
@@ -2698,7 +2697,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
2698 | results.CopyTo(ourResults, 0); | 2697 | results.CopyTo(ourResults, 0); |
2699 | }; | 2698 | }; |
2700 | int waitTime = 0; | 2699 | int waitTime = 0; |
2701 | m_rayCastManager.QueueRequest(geom,position, direction, length, Count, retMethod); | 2700 | m_rayCastManager.QueueRequest(geom,position, direction, length, Count, flags, retMethod); |
2702 | while (ourResults == null && waitTime < 1000) | 2701 | while (ourResults == null && waitTime < 1000) |
2703 | { | 2702 | { |
2704 | Thread.Sleep(1); | 2703 | Thread.Sleep(1); |