From dc6b7bb5c9d4ba26a043566f3c6f969d56268132 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 6 Jan 2013 12:07:16 +0000 Subject: [PATCH 1/4] don't try to read geom positions outside main ode thread :( --- .../Physics/UbitOdePlugin/ODESitAvatar.cs | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/OpenSim/Region/Physics/UbitOdePlugin/ODESitAvatar.cs b/OpenSim/Region/Physics/UbitOdePlugin/ODESitAvatar.cs index ecc732a129..e9023c3221 100644 --- a/OpenSim/Region/Physics/UbitOdePlugin/ODESitAvatar.cs +++ b/OpenSim/Region/Physics/UbitOdePlugin/ODESitAvatar.cs @@ -78,8 +78,12 @@ namespace OpenSim.Region.Physics.OdePlugin IntPtr geom = ((OdePrim)actor).prim_geom; - Vector3 geopos = d.GeomGetPositionOMV(geom); - Quaternion geomOri = d.GeomGetQuaternionOMV(geom); +// Vector3 geopos = d.GeomGetPositionOMV(geom); +// Quaternion geomOri = d.GeomGetQuaternionOMV(geom); + + Vector3 geopos = actor.Position; + Quaternion geomOri = actor.Orientation; + Quaternion geomInvOri = Quaternion.Conjugate(geomOri); Quaternion ori = Quaternion.Identity; @@ -116,6 +120,7 @@ namespace OpenSim.Region.Physics.OdePlugin } int status = 1; + offset = rayResults[0].Pos - geopos; d.GeomClassID geoclass = d.GeomGetClass(geom); @@ -191,13 +196,12 @@ namespace OpenSim.Region.Physics.OdePlugin if (norm.Z < 0.5f) { float rayDist = 4.0f; - float curEdgeDist = 0.0f; for (int i = 0; i < 6; i++) { - pivot.X -= 0.005f * norm.X; - pivot.Y -= 0.005f * norm.Y; - pivot.Z -= 0.005f * norm.Z; + pivot.X -= 0.01f * norm.X; + pivot.Y -= 0.01f * norm.Y; + pivot.Z -= 0.01f * norm.Z; rayDir.X = -norm.X * norm.Z; rayDir.Y = -norm.Y * norm.Z; @@ -208,8 +212,6 @@ namespace OpenSim.Region.Physics.OdePlugin if (rayResults.Count == 0) break; - curEdgeDist += rayResults[0].Depth; - if (Math.Abs(rayResults[0].Normal.Z) < 0.7f) { rayDist -= rayResults[0].Depth; @@ -226,7 +228,6 @@ namespace OpenSim.Region.Physics.OdePlugin else { foundEdge = true; - edgeDist = curEdgeDist; edgePos = rayResults[0].Pos; break; } @@ -254,7 +255,7 @@ namespace OpenSim.Region.Physics.OdePlugin for (int i = 0; i < 3; i++) { - pivot.Z -= 0.005f; + pivot.Z -= 0.01f; rayDir.X = toCamX; rayDir.Y = toCamY; rayDir.Z = (-toCamX * norm.X - toCamY * norm.Y) / norm.Z; From ca40e656ab4f0915b37356a9f6394f93cd1119a3 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 7 Jan 2013 10:35:55 +0000 Subject: [PATCH 2/4] in raycast for camera exclude self detection --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 5087882771..4504e18de8 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -1415,8 +1415,9 @@ namespace OpenSim.Region.Framework.Scenes if (m_followCamAuto) { - if (hitYN) + if (hitYN && localid != LocalId) { + CameraConstraintActive = true; //m_log.DebugFormat("[RAYCASTRESULT]: {0}, {1}, {2}, {3}", hitYN, collisionPoint, localid, distance); @@ -2282,7 +2283,6 @@ namespace OpenSim.Region.Framework.Scenes ControllingClient.SendAlertMessage(" Sit position on restricted land, try another spot"); return; } -// m_log.InfoFormat("physsit {0} {1}", offset.ToString(),Orientation.ToString()); RemoveFromPhysicalScene(); @@ -2293,7 +2293,6 @@ namespace OpenSim.Region.Framework.Scenes part.AddSittingAvatar(UUID); - Vector3 cameraAtOffset = part.GetCameraAtOffset(); Vector3 cameraEyeOffset = part.GetCameraEyeOffset(); bool forceMouselook = part.GetForceMouselook(); From 982328b4ed2f632765e3c3d3bd1cc1110fdb91fa Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 7 Jan 2013 10:56:30 +0000 Subject: [PATCH 3/4] exclude avatars from unfiltered RaycastWorld --- OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs b/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs index d045b59484..f58870ad4e 100644 --- a/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs +++ b/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs @@ -2586,7 +2586,7 @@ namespace OpenSim.Region.Physics.OdePlugin req.Normal = direction; req.Origin = position; req.Count = 0; - req.filter = RayFilterFlags.All; + req.filter = RayFilterFlags.AllPrims | RayFilterFlags.land; m_rayCastManager.QueueRequest(req); } @@ -2603,7 +2603,7 @@ namespace OpenSim.Region.Physics.OdePlugin req.Normal = direction; req.Origin = position; req.Count = Count; - req.filter = RayFilterFlags.All; + req.filter = RayFilterFlags.AllPrims | RayFilterFlags.land; m_rayCastManager.QueueRequest(req); } @@ -2631,7 +2631,7 @@ namespace OpenSim.Region.Physics.OdePlugin req.Normal = direction; req.Origin = position; req.Count = Count; - req.filter = RayFilterFlags.All; + req.filter = RayFilterFlags.AllPrims | RayFilterFlags.land; lock (SyncObject) { From d2cb2da7909aa79260af52a7abbc7b491c5495c2 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 7 Jan 2013 11:03:36 +0000 Subject: [PATCH 4/4] also exclude land --- OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs b/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs index f58870ad4e..0d18adb04d 100644 --- a/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs +++ b/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs @@ -2586,7 +2586,7 @@ namespace OpenSim.Region.Physics.OdePlugin req.Normal = direction; req.Origin = position; req.Count = 0; - req.filter = RayFilterFlags.AllPrims | RayFilterFlags.land; + req.filter = RayFilterFlags.AllPrims; m_rayCastManager.QueueRequest(req); } @@ -2603,7 +2603,7 @@ namespace OpenSim.Region.Physics.OdePlugin req.Normal = direction; req.Origin = position; req.Count = Count; - req.filter = RayFilterFlags.AllPrims | RayFilterFlags.land; + req.filter = RayFilterFlags.AllPrims; m_rayCastManager.QueueRequest(req); } @@ -2631,7 +2631,7 @@ namespace OpenSim.Region.Physics.OdePlugin req.Normal = direction; req.Origin = position; req.Count = Count; - req.filter = RayFilterFlags.AllPrims | RayFilterFlags.land; + req.filter = RayFilterFlags.AllPrims; lock (SyncObject) {