aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2011-11-16 23:01:59 +0000
committerJustin Clark-Casey (justincc)2011-11-16 23:01:59 +0000
commitb6d83e9c0f4bd1d450e36270278285be50d5ace8 (patch)
treea5a05ee468964d2a5a8b90b186145e615368de71 /OpenSim
parentCall public ForEach instead of using m_entities directly. No semantic changes... (diff)
downloadopensim-SC-b6d83e9c0f4bd1d450e36270278285be50d5ace8.zip
opensim-SC-b6d83e9c0f4bd1d450e36270278285be50d5ace8.tar.gz
opensim-SC-b6d83e9c0f4bd1d450e36270278285be50d5ace8.tar.bz2
opensim-SC-b6d83e9c0f4bd1d450e36270278285be50d5ace8.tar.xz
Stop OdePrim and OdeCharacter insanely overriding set LocalID to set their own private m_localID property but leaving get to return the then unset PhysicsActor.LocalId!
Instead, just have both subclasses use the PhysicsActor.LocalID property. This restores collision functionality that fell away in 45c7789 yesterday
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Framework/Scenes/EntityBase.cs6
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs6
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs2
-rw-r--r--OpenSim/Region/Physics/Manager/PhysicsActor.cs16
-rw-r--r--OpenSim/Region/Physics/OdePlugin/ODECharacter.cs6
-rw-r--r--OpenSim/Region/Physics/OdePlugin/ODEPrim.cs11
-rw-r--r--OpenSim/Region/Physics/OdePlugin/ODERayCastRequestManager.cs7
-rw-r--r--OpenSim/Region/Physics/OdePlugin/OdeScene.cs28
-rw-r--r--OpenSim/Region/Physics/OdePlugin/Tests/ODETestClass.cs2
9 files changed, 40 insertions, 44 deletions
diff --git a/OpenSim/Region/Framework/Scenes/EntityBase.cs b/OpenSim/Region/Framework/Scenes/EntityBase.cs
index 664be01..741f53b 100644
--- a/OpenSim/Region/Framework/Scenes/EntityBase.cs
+++ b/OpenSim/Region/Framework/Scenes/EntityBase.cs
@@ -103,7 +103,11 @@ namespace OpenSim.Region.Framework.Scenes
103 public virtual uint LocalId 103 public virtual uint LocalId
104 { 104 {
105 get { return m_localId; } 105 get { return m_localId; }
106 set { m_localId = value; } 106 set
107 {
108 m_localId = value;
109// m_log.DebugFormat("[ENTITY BASE]: Set part {0} to local id {1}", Name, m_localId);
110 }
107 } 111 }
108 112
109 /// <summary> 113 /// <summary>
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index f693b36..4e79311 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -517,7 +517,11 @@ namespace OpenSim.Region.Framework.Scenes
517 public uint LocalId 517 public uint LocalId
518 { 518 {
519 get { return m_localId; } 519 get { return m_localId; }
520 set { m_localId = value; } 520 set
521 {
522 m_localId = value;
523// m_log.DebugFormat("[SCENE OBJECT PART]: Set part {0} to local id {1}", Name, m_localId);
524 }
521 } 525 }
522 526
523 public virtual string Name 527 public virtual string Name
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 5587073..7d901c9 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -756,7 +756,7 @@ namespace OpenSim.Region.Framework.Scenes
756 m_name = String.Format("{0} {1}", Firstname, Lastname); 756 m_name = String.Format("{0} {1}", Firstname, Lastname);
757 m_scene = world; 757 m_scene = world;
758 m_uuid = client.AgentId; 758 m_uuid = client.AgentId;
759 m_localId = m_scene.AllocateLocalId(); 759 LocalId = m_scene.AllocateLocalId();
760 760
761 UserAccount account = m_scene.UserAccountService.GetUserAccount(m_scene.RegionInfo.ScopeID, m_uuid); 761 UserAccount account = m_scene.UserAccountService.GetUserAccount(m_scene.RegionInfo.ScopeID, m_uuid);
762 if (account != null) 762 if (account != null)
diff --git a/OpenSim/Region/Physics/Manager/PhysicsActor.cs b/OpenSim/Region/Physics/Manager/PhysicsActor.cs
index 49f60f8..798a0a4 100644
--- a/OpenSim/Region/Physics/Manager/PhysicsActor.cs
+++ b/OpenSim/Region/Physics/Manager/PhysicsActor.cs
@@ -25,8 +25,10 @@
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28using log4net;
28using System; 29using System;
29using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Reflection;
30using OpenSim.Framework; 32using OpenSim.Framework;
31using OpenMetaverse; 33using OpenMetaverse;
32 34
@@ -46,10 +48,10 @@ namespace OpenSim.Region.Physics.Manager
46 48
47 public enum PIDHoverType 49 public enum PIDHoverType
48 { 50 {
49 Ground 51 Ground,
50 , GroundAndWater 52 GroundAndWater,
51 , Water 53 Water,
52 , Absolute 54 Absolute
53 } 55 }
54 56
55 public struct ContactPoint 57 public struct ContactPoint
@@ -114,6 +116,8 @@ namespace OpenSim.Region.Physics.Manager
114 116
115 public abstract class PhysicsActor 117 public abstract class PhysicsActor
116 { 118 {
119// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
120
117 public delegate void RequestTerseUpdate(); 121 public delegate void RequestTerseUpdate();
118 public delegate void CollisionUpdate(EventArgs e); 122 public delegate void CollisionUpdate(EventArgs e);
119 public delegate void OutOfBounds(Vector3 pos); 123 public delegate void OutOfBounds(Vector3 pos);
@@ -197,10 +201,10 @@ namespace OpenSim.Region.Physics.Manager
197 { 201 {
198 CollisionUpdate handler = OnCollisionUpdate; 202 CollisionUpdate handler = OnCollisionUpdate;
199 203
204// m_log.DebugFormat("[PHYSICS ACTOR]: Sending collision for {0}", LocalID);
205
200 if (handler != null) 206 if (handler != null)
201 {
202 handler(e); 207 handler(e);
203 }
204 } 208 }
205 209
206 public virtual void SetMaterial (int material) 210 public virtual void SetMaterial (int material)
diff --git a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
index 3630510..c37d588 100644
--- a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
+++ b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
@@ -108,7 +108,6 @@ namespace OpenSim.Region.Physics.OdePlugin
108 /// </summary> 108 /// </summary>
109 private Vector3 m_taintForce; 109 private Vector3 m_taintForce;
110 110
111 internal uint m_localID = 0;
112 // taints and their non-tainted counterparts 111 // taints and their non-tainted counterparts
113 private bool m_isPhysical = false; // the current physical status 112 private bool m_isPhysical = false; // the current physical status
114 private bool m_tainted_isPhysical = false; // set when the physical status is tainted (false=not existing in physics engine, true=existing) 113 private bool m_tainted_isPhysical = false; // set when the physical status is tainted (false=not existing in physics engine, true=existing)
@@ -231,11 +230,6 @@ namespace OpenSim.Region.Physics.OdePlugin
231 set { m_alwaysRun = value; } 230 set { m_alwaysRun = value; }
232 } 231 }
233 232
234 public override uint LocalID
235 {
236 set { m_localID = value; }
237 }
238
239 public override bool Grabbed 233 public override bool Grabbed
240 { 234 {
241 set { return; } 235 set { return; }
diff --git a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
index 2f9a54b..1ba7ef7 100644
--- a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
+++ b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
@@ -142,8 +142,6 @@ namespace OpenSim.Region.Physics.OdePlugin
142 public bool m_taintselected { get; private set; } 142 public bool m_taintselected { get; private set; }
143 public bool m_taintCollidesWater { get; private set; } 143 public bool m_taintCollidesWater { get; private set; }
144 144
145 public uint m_localID { get; private set; }
146
147 private bool m_taintforce = false; 145 private bool m_taintforce = false;
148 private bool m_taintaddangularforce = false; 146 private bool m_taintaddangularforce = false;
149 private Vector3 m_force; 147 private Vector3 m_force;
@@ -290,13 +288,6 @@ namespace OpenSim.Region.Physics.OdePlugin
290 set { return; } 288 set { return; }
291 } 289 }
292 290
293 public override uint LocalID
294 {
295 set {
296 //m_log.Info("[PHYSICS]: Setting TrackerID: " + value);
297 m_localID = value; }
298 }
299
300 public override bool Grabbed 291 public override bool Grabbed
301 { 292 {
302 set { return; } 293 set { return; }
@@ -1058,7 +1049,7 @@ Console.WriteLine("ZProcessTaints for " + Name);
1058 private void AddChildPrim(OdePrim prim) 1049 private void AddChildPrim(OdePrim prim)
1059 { 1050 {
1060//Console.WriteLine("AddChildPrim " + Name); 1051//Console.WriteLine("AddChildPrim " + Name);
1061 if (this.m_localID != prim.m_localID) 1052 if (LocalID != prim.LocalID)
1062 { 1053 {
1063 if (Body == IntPtr.Zero) 1054 if (Body == IntPtr.Zero)
1064 { 1055 {
diff --git a/OpenSim/Region/Physics/OdePlugin/ODERayCastRequestManager.cs b/OpenSim/Region/Physics/OdePlugin/ODERayCastRequestManager.cs
index 6c2bdde..8d7d3b3 100644
--- a/OpenSim/Region/Physics/OdePlugin/ODERayCastRequestManager.cs
+++ b/OpenSim/Region/Physics/OdePlugin/ODERayCastRequestManager.cs
@@ -371,12 +371,13 @@ namespace OpenSim.Region.Physics.OdePlugin
371 // Loop over contacts, build results. 371 // Loop over contacts, build results.
372 for (int i = 0; i < count; i++) 372 for (int i = 0; i < count; i++)
373 { 373 {
374 if (p1 != null) { 374 if (p1 != null)
375 {
375 if (p1 is OdePrim) 376 if (p1 is OdePrim)
376 { 377 {
377 ContactResult collisionresult = new ContactResult(); 378 ContactResult collisionresult = new ContactResult();
378 379
379 collisionresult.ConsumerID = ((OdePrim)p1).m_localID; 380 collisionresult.ConsumerID = p1.LocalID;
380 collisionresult.Pos = new Vector3(contacts[i].pos.X, contacts[i].pos.Y, contacts[i].pos.Z); 381 collisionresult.Pos = new Vector3(contacts[i].pos.X, contacts[i].pos.Y, contacts[i].pos.Z);
381 collisionresult.Depth = contacts[i].depth; 382 collisionresult.Depth = contacts[i].depth;
382 collisionresult.Normal = new Vector3(contacts[i].normal.X, contacts[i].normal.Y, 383 collisionresult.Normal = new Vector3(contacts[i].normal.X, contacts[i].normal.Y,
@@ -392,7 +393,7 @@ namespace OpenSim.Region.Physics.OdePlugin
392 { 393 {
393 ContactResult collisionresult = new ContactResult(); 394 ContactResult collisionresult = new ContactResult();
394 395
395 collisionresult.ConsumerID = ((OdePrim)p2).m_localID; 396 collisionresult.ConsumerID = p2.LocalID;
396 collisionresult.Pos = new Vector3(contacts[i].pos.X, contacts[i].pos.Y, contacts[i].pos.Z); 397 collisionresult.Pos = new Vector3(contacts[i].pos.X, contacts[i].pos.Y, contacts[i].pos.Z);
397 collisionresult.Depth = contacts[i].depth; 398 collisionresult.Depth = contacts[i].depth;
398 collisionresult.Normal = new Vector3(contacts[i].normal.X, contacts[i].normal.Y, 399 collisionresult.Normal = new Vector3(contacts[i].normal.X, contacts[i].normal.Y,
diff --git a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs
index 740037f..43d852b 100644
--- a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs
+++ b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs
@@ -1306,8 +1306,8 @@ namespace OpenSim.Region.Physics.OdePlugin
1306 { 1306 {
1307 case ActorTypes.Agent: 1307 case ActorTypes.Agent:
1308 cc1 = (OdeCharacter)p1; 1308 cc1 = (OdeCharacter)p1;
1309 obj2LocalID = cc1.m_localID; 1309 obj2LocalID = cc1.LocalID;
1310 cc1.AddCollisionEvent(cc2.m_localID, contact); 1310 cc1.AddCollisionEvent(cc2.LocalID, contact);
1311 //ctype = (int)CollisionCategories.Character; 1311 //ctype = (int)CollisionCategories.Character;
1312 1312
1313 //if (cc1.CollidingObj) 1313 //if (cc1.CollidingObj)
@@ -1322,8 +1322,8 @@ namespace OpenSim.Region.Physics.OdePlugin
1322 if (p1 is OdePrim) 1322 if (p1 is OdePrim)
1323 { 1323 {
1324 cp1 = (OdePrim) p1; 1324 cp1 = (OdePrim) p1;
1325 obj2LocalID = cp1.m_localID; 1325 obj2LocalID = cp1.LocalID;
1326 cp1.AddCollisionEvent(cc2.m_localID, contact); 1326 cp1.AddCollisionEvent(cc2.LocalID, contact);
1327 } 1327 }
1328 //ctype = (int)CollisionCategories.Geom; 1328 //ctype = (int)CollisionCategories.Geom;
1329 1329
@@ -1359,8 +1359,8 @@ namespace OpenSim.Region.Physics.OdePlugin
1359 if (p1 is OdeCharacter) 1359 if (p1 is OdeCharacter)
1360 { 1360 {
1361 cc1 = (OdeCharacter) p1; 1361 cc1 = (OdeCharacter) p1;
1362 obj2LocalID = cc1.m_localID; 1362 obj2LocalID = cc1.LocalID;
1363 cc1.AddCollisionEvent(cp2.m_localID, contact); 1363 cc1.AddCollisionEvent(cp2.LocalID, contact);
1364 //ctype = (int)CollisionCategories.Character; 1364 //ctype = (int)CollisionCategories.Character;
1365 1365
1366 //if (cc1.CollidingObj) 1366 //if (cc1.CollidingObj)
@@ -1375,8 +1375,8 @@ namespace OpenSim.Region.Physics.OdePlugin
1375 if (p1 is OdePrim) 1375 if (p1 is OdePrim)
1376 { 1376 {
1377 cp1 = (OdePrim) p1; 1377 cp1 = (OdePrim) p1;
1378 obj2LocalID = cp1.m_localID; 1378 obj2LocalID = cp1.LocalID;
1379 cp1.AddCollisionEvent(cp2.m_localID, contact); 1379 cp1.AddCollisionEvent(cp2.LocalID, contact);
1380 //ctype = (int)CollisionCategories.Geom; 1380 //ctype = (int)CollisionCategories.Geom;
1381 1381
1382 //if (cp1.CollidingObj) 1382 //if (cp1.CollidingObj)
@@ -1638,7 +1638,7 @@ namespace OpenSim.Region.Physics.OdePlugin
1638 /// <param name="obj"></param> 1638 /// <param name="obj"></param>
1639 internal void AddCollisionEventReporting(PhysicsActor obj) 1639 internal void AddCollisionEventReporting(PhysicsActor obj)
1640 { 1640 {
1641// m_log.DebugFormat("[PHYSICS]: Adding {0} to collision event reporting", obj.SOPName); 1641// m_log.DebugFormat("[PHYSICS]: Adding {0} {1} to collision event reporting", obj.SOPName, obj.LocalID);
1642 1642
1643 lock (_collisionEventPrimChanges) 1643 lock (_collisionEventPrimChanges)
1644 _collisionEventPrimChanges[obj.LocalID] = obj; 1644 _collisionEventPrimChanges[obj.LocalID] = obj;
@@ -1650,7 +1650,7 @@ namespace OpenSim.Region.Physics.OdePlugin
1650 /// <param name="obj"></param> 1650 /// <param name="obj"></param>
1651 internal void RemoveCollisionEventReporting(PhysicsActor obj) 1651 internal void RemoveCollisionEventReporting(PhysicsActor obj)
1652 { 1652 {
1653// m_log.DebugFormat("[PHYSICS]: Removing {0} from collision event reporting", obj.SOPName); 1653// m_log.DebugFormat("[PHYSICS]: Removing {0} {1} from collision event reporting", obj.SOPName, obj.LocalID);
1654 1654
1655 lock (_collisionEventPrimChanges) 1655 lock (_collisionEventPrimChanges)
1656 _collisionEventPrimChanges[obj.LocalID] = null; 1656 _collisionEventPrimChanges[obj.LocalID] = null;
@@ -1754,9 +1754,7 @@ namespace OpenSim.Region.Physics.OdePlugin
1754 public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position, 1754 public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position,
1755 Vector3 size, Quaternion rotation, bool isPhysical, uint localid) 1755 Vector3 size, Quaternion rotation, bool isPhysical, uint localid)
1756 { 1756 {
1757#if SPAM 1757// m_log.DebugFormat("[ODE SCENE]: Adding physics actor to {0} {1}", primName, localid);
1758 m_log.DebugFormat("[PHYSICS]: Adding physics actor to {0}", primName);
1759#endif
1760 1758
1761 return AddPrim(primName, position, size, rotation, pbs, isPhysical, localid); 1759 return AddPrim(primName, position, size, rotation, pbs, isPhysical, localid);
1762 } 1760 }
@@ -2810,7 +2808,7 @@ Console.WriteLine("AddPhysicsActorTaint to " + taintedprim.Name);
2810 2808
2811 foreach (PhysicsActor obj in _collisionEventPrim.Values) 2809 foreach (PhysicsActor obj in _collisionEventPrim.Values)
2812 { 2810 {
2813// m_log.DebugFormat("[PHYSICS]: Assessing {0} for collision events", obj.SOPName); 2811// m_log.DebugFormat("[PHYSICS]: Assessing {0} {1} for collision events", obj.SOPName, obj.LocalID);
2814 2812
2815 switch ((ActorTypes)obj.PhysicsActorType) 2813 switch ((ActorTypes)obj.PhysicsActorType)
2816 { 2814 {
@@ -3746,7 +3744,7 @@ Console.WriteLine("AddPhysicsActorTaint to " + taintedprim.Name);
3746 { 3744 {
3747 if (prm.CollisionScore > 0) 3745 if (prm.CollisionScore > 0)
3748 { 3746 {
3749 returncolliders.Add(prm.m_localID, prm.CollisionScore); 3747 returncolliders.Add(prm.LocalID, prm.CollisionScore);
3750 cnt++; 3748 cnt++;
3751 prm.CollisionScore = 0f; 3749 prm.CollisionScore = 0f;
3752 if (cnt > 25) 3750 if (cnt > 25)
diff --git a/OpenSim/Region/Physics/OdePlugin/Tests/ODETestClass.cs b/OpenSim/Region/Physics/OdePlugin/Tests/ODETestClass.cs
index 2ea810f..cbc6b95 100644
--- a/OpenSim/Region/Physics/OdePlugin/Tests/ODETestClass.cs
+++ b/OpenSim/Region/Physics/OdePlugin/Tests/ODETestClass.cs
@@ -104,7 +104,7 @@ namespace OpenSim.Region.Physics.OdePlugin.Tests
104 m_log.Info("TargetSpace: " + oprim.m_targetSpace + " - SceneMainSpace: " + pscene.space); 104 m_log.Info("TargetSpace: " + oprim.m_targetSpace + " - SceneMainSpace: " + pscene.space);
105 105
106 Assert.That(!oprim.m_taintadd); 106 Assert.That(!oprim.m_taintadd);
107 m_log.Info("Prim Position (" + oprim.m_localID + "): " + prim.Position.ToString()); 107 m_log.Info("Prim Position (" + oprim.LocalID + "): " + prim.Position);
108 108
109 // Make sure we're above the ground 109 // Make sure we're above the ground
110 //Assert.That(prim.Position.Z > 20f); 110 //Assert.That(prim.Position.Z > 20f);