aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Physics')
-rw-r--r--OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs12
-rw-r--r--OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs12
-rw-r--r--OpenSim/Region/Physics/Manager/PhysicsActor.cs35
-rw-r--r--OpenSim/Region/Physics/OdePlugin/ODECharacter.cs31
-rw-r--r--OpenSim/Region/Physics/OdePlugin/ODEPrim.cs47
-rw-r--r--OpenSim/Region/Physics/OdePlugin/OdePlugin.cs215
-rw-r--r--OpenSim/Region/Physics/POSPlugin/POSPlugin.cs24
-rw-r--r--OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs25
8 files changed, 309 insertions, 92 deletions
diff --git a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs
index 08fdd80..0d54dad 100644
--- a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs
+++ b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs
@@ -398,5 +398,17 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
398 public override PhysicsVector PIDTarget { set { return; } } 398 public override PhysicsVector PIDTarget { set { return; } }
399 public override bool PIDActive { set { return; } } 399 public override bool PIDActive { set { return; } }
400 public override float PIDTau { set { return; } } 400 public override float PIDTau { set { return; } }
401 public override void SubscribeEvents(int ms)
402 {
403
404 }
405 public override void UnSubscribeEvents()
406 {
407
408 }
409 public override bool SubscribedEvents()
410 {
411 return false;
412 }
401 } 413 }
402} 414}
diff --git a/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs b/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs
index f3b3a20..9bd5f08 100644
--- a/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs
+++ b/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs
@@ -996,6 +996,18 @@ namespace OpenSim.Region.Physics.BulletXPlugin
996 public override PhysicsVector PIDTarget { set { return; } } 996 public override PhysicsVector PIDTarget { set { return; } }
997 public override bool PIDActive { set { return; } } 997 public override bool PIDActive { set { return; } }
998 public override float PIDTau { set { return; } } 998 public override float PIDTau { set { return; } }
999 public override void SubscribeEvents(int ms)
1000 {
1001
1002 }
1003 public override void UnSubscribeEvents()
1004 {
1005
1006 }
1007 public override bool SubscribedEvents()
1008 {
1009 return false;
1010 }
999 } 1011 }
1000 1012
1001 /// <summary> 1013 /// <summary>
diff --git a/OpenSim/Region/Physics/Manager/PhysicsActor.cs b/OpenSim/Region/Physics/Manager/PhysicsActor.cs
index f48f129..046c285 100644
--- a/OpenSim/Region/Physics/Manager/PhysicsActor.cs
+++ b/OpenSim/Region/Physics/Manager/PhysicsActor.cs
@@ -51,9 +51,9 @@ namespace OpenSim.Region.Physics.Manager
51 public int m_colliderType; 51 public int m_colliderType;
52 public int m_GenericStartEnd; 52 public int m_GenericStartEnd;
53 //public uint m_LocalID; 53 //public uint m_LocalID;
54 public List<uint> m_objCollisionList; 54 public Dictionary<uint,float> m_objCollisionList = new Dictionary<uint,float>();
55 55
56 public CollisionEventUpdate(uint localID, int colliderType, int GenericStartEnd, List<uint> objCollisionList) 56 public CollisionEventUpdate(uint localID, int colliderType, int GenericStartEnd, Dictionary<uint, float> objCollisionList)
57 { 57 {
58 m_colliderType = colliderType; 58 m_colliderType = colliderType;
59 m_GenericStartEnd = GenericStartEnd; 59 m_GenericStartEnd = GenericStartEnd;
@@ -64,7 +64,8 @@ namespace OpenSim.Region.Physics.Manager
64 { 64 {
65 m_colliderType = (int) ActorTypes.Unknown; 65 m_colliderType = (int) ActorTypes.Unknown;
66 m_GenericStartEnd = 1; 66 m_GenericStartEnd = 1;
67 m_objCollisionList = null; 67 // m_objCollisionList = null;
68 m_objCollisionList = new Dictionary<uint, float>();
68 } 69 }
69 70
70 public int collidertype 71 public int collidertype
@@ -79,9 +80,17 @@ namespace OpenSim.Region.Physics.Manager
79 set { m_GenericStartEnd = value; } 80 set { m_GenericStartEnd = value; }
80 } 81 }
81 82
82 public void addCollider(uint localID) 83 public void addCollider(uint localID, float depth)
83 { 84 {
84 m_objCollisionList.Add(localID); 85 if (!m_objCollisionList.ContainsKey(localID))
86 {
87 m_objCollisionList.Add(localID, depth);
88 }
89 else
90 {
91 if (m_objCollisionList[localID] < depth)
92 m_objCollisionList[localID] = depth;
93 }
85 } 94 }
86 } 95 }
87 96
@@ -189,6 +198,9 @@ namespace OpenSim.Region.Physics.Manager
189 198
190 public abstract void AddForce(PhysicsVector force); 199 public abstract void AddForce(PhysicsVector force);
191 public abstract void SetMomentum(PhysicsVector momentum); 200 public abstract void SetMomentum(PhysicsVector momentum);
201 public abstract void SubscribeEvents(int ms);
202 public abstract void UnSubscribeEvents();
203 public abstract bool SubscribedEvents();
192 } 204 }
193 205
194 public class NullPhysicsActor : PhysicsActor 206 public class NullPhysicsActor : PhysicsActor
@@ -370,5 +382,18 @@ namespace OpenSim.Region.Physics.Manager
370 public override void SetMomentum(PhysicsVector momentum) 382 public override void SetMomentum(PhysicsVector momentum)
371 { 383 {
372 } 384 }
385
386 public override void SubscribeEvents(int ms)
387 {
388
389 }
390 public override void UnSubscribeEvents()
391 {
392
393 }
394 public override bool SubscribedEvents()
395 {
396 return false;
397 }
373 } 398 }
374} 399}
diff --git a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
index 9f6b14e..39f94cb 100644
--- a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
+++ b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
@@ -112,6 +112,9 @@ namespace OpenSim.Region.Physics.OdePlugin
112 public d.Mass ShellMass; 112 public d.Mass ShellMass;
113 public bool collidelock = false; 113 public bool collidelock = false;
114 114
115 public int m_eventsubscription = 0;
116 private CollisionEventUpdate CollisionEventsThisFrame = null;
117
115 public OdeCharacter(String avName, OdeScene parent_scene, PhysicsVector pos, CollisionLocker dode, PhysicsVector size) 118 public OdeCharacter(String avName, OdeScene parent_scene, PhysicsVector pos, CollisionLocker dode, PhysicsVector size)
116 { 119 {
117 ode = dode; 120 ode = dode;
@@ -863,5 +866,33 @@ namespace OpenSim.Region.Physics.OdePlugin
863 public override PhysicsVector PIDTarget { set { return; } } 866 public override PhysicsVector PIDTarget { set { return; } }
864 public override bool PIDActive { set { return; } } 867 public override bool PIDActive { set { return; } }
865 public override float PIDTau { set { return; } } 868 public override float PIDTau { set { return; } }
869 public override void SubscribeEvents(int ms)
870 {
871 m_eventsubscription = ms;
872 }
873 public override void UnSubscribeEvents()
874 {
875 m_eventsubscription = 0;
876 }
877 public void AddCollisionEvent(uint CollidedWith, float depth)
878 {
879 if (m_eventsubscription > 0)
880 CollisionEventsThisFrame.addCollider(CollidedWith,depth);
881 }
882
883 public void SendCollisions()
884 {
885 if (m_eventsubscription > 0)
886 {
887 base.SendCollisionUpdate(CollisionEventsThisFrame);
888 CollisionEventsThisFrame = new CollisionEventUpdate();
889 }
890 }
891 public override bool SubscribedEvents()
892 {
893 if (m_eventsubscription > 0)
894 return true;
895 return false;
896 }
866 } 897 }
867} 898}
diff --git a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
index 58dbd63..4e1696d 100644
--- a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
+++ b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
@@ -136,8 +136,12 @@ namespace OpenSim.Region.Physics.OdePlugin
136 private PhysicsVector _target_velocity; 136 private PhysicsVector _target_velocity;
137 public d.Mass pMass; 137 public d.Mass pMass;
138 138
139 public int m_eventsubscription = 0;
140 private CollisionEventUpdate CollisionEventsThisFrame = null;
141
139 private IntPtr m_linkJoint = (IntPtr)0; 142 private IntPtr m_linkJoint = (IntPtr)0;
140 143
144
141 public OdePrim(String primName, OdeScene parent_scene, PhysicsVector pos, PhysicsVector size, 145 public OdePrim(String primName, OdeScene parent_scene, PhysicsVector pos, PhysicsVector size,
142 Quaternion rotation, IMesh mesh, PrimitiveBaseShape pbs, bool pisPhysical, CollisionLocker dode) 146 Quaternion rotation, IMesh mesh, PrimitiveBaseShape pbs, bool pisPhysical, CollisionLocker dode)
143 { 147 {
@@ -201,12 +205,6 @@ namespace OpenSim.Region.Physics.OdePlugin
201 205
202 } 206 }
203 207
204 /// <summary>
205 /// Nasty, however without this you get
206 /// 'invalid operation for locked space' when things are really loaded down
207 /// </summary>
208 /// <param name="space"></param>
209
210 public override int PhysicsActorType 208 public override int PhysicsActorType
211 { 209 {
212 get { return (int) ActorTypes.Prim; } 210 get { return (int) ActorTypes.Prim; }
@@ -2229,5 +2227,42 @@ namespace OpenSim.Region.Physics.OdePlugin
2229 d.JointSetAMotorParam(Amotor, (int)dParam.FudgeFactor, 0f); 2227 d.JointSetAMotorParam(Amotor, (int)dParam.FudgeFactor, 0f);
2230 d.JointSetAMotorParam(Amotor, (int)dParam.FMax, m_tensor); 2228 d.JointSetAMotorParam(Amotor, (int)dParam.FMax, m_tensor);
2231 } 2229 }
2230 public override void SubscribeEvents(int ms)
2231 {
2232 m_eventsubscription = ms;
2233 _parent_scene.addCollisionEventReporting(this);
2234 }
2235 public override void UnSubscribeEvents()
2236 {
2237 _parent_scene.remCollisionEventReporting(this);
2238 m_eventsubscription = 0;
2239 }
2240 public void AddCollisionEvent(uint CollidedWith, float depth)
2241 {
2242 if (CollisionEventsThisFrame == null)
2243 CollisionEventsThisFrame = new CollisionEventUpdate();
2244 CollisionEventsThisFrame.addCollider(CollidedWith,depth);
2245 }
2246
2247 public void SendCollisions()
2248 {
2249 if (CollisionEventsThisFrame == null)
2250 return;
2251
2252 //if (CollisionEventsThisFrame.m_objCollisionList == null)
2253 // return;
2254
2255 if (CollisionEventsThisFrame.m_objCollisionList.Count > 0)
2256 {
2257 base.SendCollisionUpdate(CollisionEventsThisFrame);
2258 CollisionEventsThisFrame = new CollisionEventUpdate();
2259 }
2260 }
2261 public override bool SubscribedEvents()
2262 {
2263 if (m_eventsubscription > 0)
2264 return true;
2265 return false;
2266 }
2232 } 2267 }
2233} 2268}
diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
index 02b5628..acc0cee 100644
--- a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
+++ b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
@@ -131,7 +131,7 @@ namespace OpenSim.Region.Physics.OdePlugin
131 131
132 private float waterlevel = 0f; 132 private float waterlevel = 0f;
133 private int framecount = 0; 133 private int framecount = 0;
134 private int m_returncollisions = 10; 134 //private int m_returncollisions = 10;
135 135
136 private IntPtr contactgroup; 136 private IntPtr contactgroup;
137 private IntPtr LandGeom = (IntPtr) 0; 137 private IntPtr LandGeom = (IntPtr) 0;
@@ -151,6 +151,7 @@ namespace OpenSim.Region.Physics.OdePlugin
151 private List<OdePrim> _prims = new List<OdePrim>(); 151 private List<OdePrim> _prims = new List<OdePrim>();
152 private List<OdePrim> _activeprims = new List<OdePrim>(); 152 private List<OdePrim> _activeprims = new List<OdePrim>();
153 private List<OdePrim> _taintedPrim = new List<OdePrim>(); 153 private List<OdePrim> _taintedPrim = new List<OdePrim>();
154 private List<PhysicsActor> _collisionEventPrim = new List<PhysicsActor>();
154 public Dictionary<IntPtr, String> geom_name_map = new Dictionary<IntPtr, String>(); 155 public Dictionary<IntPtr, String> geom_name_map = new Dictionary<IntPtr, String>();
155 public Dictionary<IntPtr, PhysicsActor> actor_name_map = new Dictionary<IntPtr, PhysicsActor>(); 156 public Dictionary<IntPtr, PhysicsActor> actor_name_map = new Dictionary<IntPtr, PhysicsActor>();
156 private d.ContactGeom[] contacts = new d.ContactGeom[80]; 157 private d.ContactGeom[] contacts = new d.ContactGeom[80];
@@ -171,16 +172,16 @@ namespace OpenSim.Region.Physics.OdePlugin
171//Ckrinke: Comment out until used. We declare it, initialize it, but do not use it 172//Ckrinke: Comment out until used. We declare it, initialize it, but do not use it
172//Ckrinke private int ms = 0; 173//Ckrinke private int ms = 0;
173 public IntPtr world; 174 public IntPtr world;
174 private bool returncollisions = false; 175 //private bool returncollisions = false;
175 private uint obj1LocalID = 0; 176 private uint obj1LocalID = 0;
176 private uint obj2LocalID = 0; 177 private uint obj2LocalID = 0;
177 private int ctype = 0; 178 //private int ctype = 0;
178 private OdeCharacter cc1; 179 private OdeCharacter cc1;
179 private OdePrim cp1; 180 private OdePrim cp1;
180 private OdeCharacter cc2; 181 private OdeCharacter cc2;
181 private OdePrim cp2; 182 private OdePrim cp2;
182 private int cStartStop = 0; 183 //private int cStartStop = 0;
183 private string cDictKey = ""; 184 //private string cDictKey = "";
184 185
185 public IntPtr space; 186 public IntPtr space;
186 187
@@ -413,27 +414,32 @@ namespace OpenSim.Region.Physics.OdePlugin
413 PhysicsActor p1; 414 PhysicsActor p1;
414 PhysicsActor p2; 415 PhysicsActor p2;
415 416
417 if (!actor_name_map.TryGetValue(g1, out p1))
418 {
419 p1 = PANull;
420 }
421 if (!actor_name_map.TryGetValue(g2, out p2))
422 {
423 p2 = PANull;
424 }
425
426 float max_collision_depth = 0f;
427
416 for (int i = 0; i < count; i++) 428 for (int i = 0; i < count; i++)
417 { 429 {
430 max_collision_depth = (contacts[i].depth > max_collision_depth) ? contacts[i].depth : max_collision_depth;
418 //m_log.Warn("[CCOUNT]: " + count); 431 //m_log.Warn("[CCOUNT]: " + count);
419 IntPtr joint; 432 IntPtr joint;
420 // If we're colliding with terrain, use 'TerrainContact' instead of contact. 433 // If we're colliding with terrain, use 'TerrainContact' instead of contact.
421 // allows us to have different settings 434 // allows us to have different settings
422 435
423 if (!actor_name_map.TryGetValue(g1, out p1)) 436
424 {
425 p1 = PANull;
426 }
427 if (!actor_name_map.TryGetValue(g2, out p2))
428 {
429 p2 = PANull;
430 }
431 437
432 // We only need to test p2 for 'jump crouch purposes' 438 // We only need to test p2 for 'jump crouch purposes'
433 p2.IsColliding = true; 439 p2.IsColliding = true;
434 440
435 //if ((framecount % m_returncollisions) == 0) 441 //if ((framecount % m_returncollisions) == 0)
436 //collision_accounting_events(p1, p2); 442
437 443
438 444
439 switch (p1.PhysicsActorType) 445 switch (p1.PhysicsActorType)
@@ -674,7 +680,7 @@ namespace OpenSim.Region.Physics.OdePlugin
674 } 680 }
675 d.JointAttach(joint, b1, b2); 681 d.JointAttach(joint, b1, b2);
676 } 682 }
677 683 collision_accounting_events(p1, p2, max_collision_depth);
678 if (count > 3) 684 if (count > 3)
679 { 685 {
680 // If there are more then 3 contact points, it's likely 686 // If there are more then 3 contact points, it's likely
@@ -690,130 +696,134 @@ namespace OpenSim.Region.Physics.OdePlugin
690 696
691 } 697 }
692 698
693 private void collision_accounting_events(PhysicsActor p1, PhysicsActor p2) 699 private void collision_accounting_events(PhysicsActor p1, PhysicsActor p2, float collisiondepth)
694 { 700 {
695 obj1LocalID = 0; 701 obj1LocalID = 0;
696 returncollisions = false; 702 //returncollisions = false;
697 obj2LocalID = 0; 703 obj2LocalID = 0;
698 ctype = 0; 704 //ctype = 0;
699 cStartStop = 0; 705 //cStartStop = 0;
706 if (!p2.SubscribedEvents() && !p1.SubscribedEvents())
707 return;
700 708
701 switch ((ActorTypes)p2.PhysicsActorType) 709 switch ((ActorTypes)p2.PhysicsActorType)
702 { 710 {
703 case ActorTypes.Agent: 711 case ActorTypes.Agent:
704 cc2 = (OdeCharacter)p2; 712 cc2 = (OdeCharacter)p2;
705 if (cc2.m_returnCollisions) 713
706 {
707 obj1LocalID = cc2.m_localID; 714 obj1LocalID = cc2.m_localID;
708 switch ((ActorTypes)p1.PhysicsActorType) 715 switch ((ActorTypes)p1.PhysicsActorType)
709 { 716 {
710 case ActorTypes.Agent: 717 case ActorTypes.Agent:
711 cc1 = (OdeCharacter)p1; 718 cc1 = (OdeCharacter)p1;
712 obj2LocalID = cc1.m_localID; 719 obj2LocalID = cc1.m_localID;
713 ctype = (int)CollisionCategories.Character; 720 cc1.AddCollisionEvent(cc2.m_localID, collisiondepth);
721 //ctype = (int)CollisionCategories.Character;
714 722
715 if (cc1.CollidingObj) 723 //if (cc1.CollidingObj)
716 cStartStop = (int)StatusIndicators.Generic; 724 //cStartStop = (int)StatusIndicators.Generic;
717 else 725 //else
718 cStartStop = (int)StatusIndicators.Start; 726 //cStartStop = (int)StatusIndicators.Start;
719 727
720 returncollisions = true; 728 //returncollisions = true;
721 break; 729 break;
722 case ActorTypes.Prim: 730 case ActorTypes.Prim:
723 cp1 = (OdePrim)p1; 731 cp1 = (OdePrim)p1;
724 obj2LocalID = cp1.m_localID; 732 obj2LocalID = cp1.m_localID;
725 ctype = (int)CollisionCategories.Geom; 733 cp1.AddCollisionEvent(cc2.m_localID, collisiondepth);
734 //ctype = (int)CollisionCategories.Geom;
726 735
727 if (cp1.CollidingObj) 736 //if (cp1.CollidingObj)
728 cStartStop = (int)StatusIndicators.Generic; 737 //cStartStop = (int)StatusIndicators.Generic;
729 else 738 //else
730 cStartStop = (int)StatusIndicators.Start; 739 //cStartStop = (int)StatusIndicators.Start;
731 740
732 returncollisions = true; 741 //returncollisions = true;
733 break; 742 break;
734 743
735 case ActorTypes.Ground: 744 case ActorTypes.Ground:
736 case ActorTypes.Unknown: 745 case ActorTypes.Unknown:
737 obj2LocalID = 0; 746 obj2LocalID = 0;
738 ctype = (int)CollisionCategories.Land; 747 //ctype = (int)CollisionCategories.Land;
739 returncollisions = true; 748 //returncollisions = true;
740 break; 749 break;
741 } 750 }
742 751
743 752
744 } 753
745 754 cc2.AddCollisionEvent(obj2LocalID, collisiondepth);
746 break; 755 break;
747 case ActorTypes.Prim: 756 case ActorTypes.Prim:
748 cp2 = (OdePrim)p2; 757 cp2 = (OdePrim)p2;
749 if (cp2.m_returnCollisions) 758
750 {
751 obj1LocalID = cp2.m_localID; 759 obj1LocalID = cp2.m_localID;
752 switch ((ActorTypes)p1.PhysicsActorType) 760 switch ((ActorTypes)p1.PhysicsActorType)
753 { 761 {
754 case ActorTypes.Agent: 762 case ActorTypes.Agent:
755 cc1 = (OdeCharacter)p1; 763 cc1 = (OdeCharacter)p1;
756 obj2LocalID = cc1.m_localID; 764 obj2LocalID = cc1.m_localID;
757 ctype = (int)CollisionCategories.Character; 765 cc1.AddCollisionEvent(cp2.m_localID, collisiondepth);
758 766 //ctype = (int)CollisionCategories.Character;
759 if (cc1.CollidingObj) 767
760 cStartStop = (int)StatusIndicators.Generic; 768 //if (cc1.CollidingObj)
761 else 769 //cStartStop = (int)StatusIndicators.Generic;
762 cStartStop = (int)StatusIndicators.Start; 770 //else
763 returncollisions = true; 771 //cStartStop = (int)StatusIndicators.Start;
772 //returncollisions = true;
764 773
765 break; 774 break;
766 case ActorTypes.Prim: 775 case ActorTypes.Prim:
767 cp1 = (OdePrim)p1; 776 cp1 = (OdePrim)p1;
768 obj2LocalID = cp1.m_localID; 777 obj2LocalID = cp1.m_localID;
769 ctype = (int)CollisionCategories.Geom; 778 cp1.AddCollisionEvent(cp2.m_localID, collisiondepth);
779 //ctype = (int)CollisionCategories.Geom;
770 780
771 if (cp1.CollidingObj) 781 //if (cp1.CollidingObj)
772 cStartStop = (int)StatusIndicators.Generic; 782 //cStartStop = (int)StatusIndicators.Generic;
773 else 783 //else
774 cStartStop = (int)StatusIndicators.Start; 784 //cStartStop = (int)StatusIndicators.Start;
775 785
776 returncollisions = true; 786 //returncollisions = true;
777 break; 787 break;
778 788
779 case ActorTypes.Ground: 789 case ActorTypes.Ground:
780 case ActorTypes.Unknown: 790 case ActorTypes.Unknown:
781 obj2LocalID = 0; 791 obj2LocalID = 0;
782 ctype = (int)CollisionCategories.Land; 792 //ctype = (int)CollisionCategories.Land;
783 793
784 returncollisions = true; 794 //returncollisions = true;
785 break; 795 break;
786 } 796 }
787 } 797
788 798 cp2.AddCollisionEvent(obj2LocalID, collisiondepth);
789 break; 799 break;
790 } 800 }
791 if (returncollisions) 801 //if (returncollisions)
792 { 802 //{
793 803
794 lock (m_storedCollisions) 804 //lock (m_storedCollisions)
795 { 805 //{
796 cDictKey = obj1LocalID.ToString() + obj2LocalID.ToString() + cStartStop.ToString() + ctype.ToString(); 806 //cDictKey = obj1LocalID.ToString() + obj2LocalID.ToString() + cStartStop.ToString() + ctype.ToString();
797 if (m_storedCollisions.ContainsKey(cDictKey)) 807 //if (m_storedCollisions.ContainsKey(cDictKey))
798 { 808 //{
799 sCollisionData objd = m_storedCollisions[cDictKey]; 809 //sCollisionData objd = m_storedCollisions[cDictKey];
800 objd.NumberOfCollisions += 1; 810 //objd.NumberOfCollisions += 1;
801 objd.lastframe = framecount; 811 //objd.lastframe = framecount;
802 m_storedCollisions[cDictKey] = objd; 812 //m_storedCollisions[cDictKey] = objd;
803 } 813 //}
804 else 814 //else
805 { 815 //{
806 sCollisionData objd = new sCollisionData(); 816 //sCollisionData objd = new sCollisionData();
807 objd.ColliderLocalId = obj1LocalID; 817 //objd.ColliderLocalId = obj1LocalID;
808 objd.CollidedWithLocalId = obj2LocalID; 818 //objd.CollidedWithLocalId = obj2LocalID;
809 objd.CollisionType = ctype; 819 //objd.CollisionType = ctype;
810 objd.NumberOfCollisions = 1; 820 //objd.NumberOfCollisions = 1;
811 objd.lastframe = framecount; 821 //objd.lastframe = framecount;
812 objd.StatusIndicator = cStartStop; 822 //objd.StatusIndicator = cStartStop;
813 m_storedCollisions.Add(cDictKey, objd); 823 //m_storedCollisions.Add(cDictKey, objd);
814 } 824 //}
815 } 825 //}
816 } 826 // }
817 } 827 }
818 828
819 public int TriArrayCallback(IntPtr trimesh, IntPtr refObject, int[] triangleIndex, int triCount) 829 public int TriArrayCallback(IntPtr trimesh, IntPtr refObject, int[] triangleIndex, int triCount)
@@ -940,6 +950,26 @@ namespace OpenSim.Region.Physics.OdePlugin
940// return (float)_origheightmap[(int)y * Constants.RegionSize + (int)x]; 950// return (float)_origheightmap[(int)y * Constants.RegionSize + (int)x];
941// } 951// }
942 952
953 public void addCollisionEventReporting(PhysicsActor obj)
954 {
955 lock(_collisionEventPrim)
956 {
957 if (!_collisionEventPrim.Contains(obj))
958 _collisionEventPrim.Add(obj);
959
960 }
961 }
962
963 public void remCollisionEventReporting(PhysicsActor obj)
964 {
965 lock (_collisionEventPrim)
966 {
967 if (!_collisionEventPrim.Contains(obj))
968 _collisionEventPrim.Remove(obj);
969 }
970 }
971
972
943 #region Add/Remove Entities 973 #region Add/Remove Entities
944 974
945 public override PhysicsActor AddAvatar(string avName, PhysicsVector position, PhysicsVector size) 975 public override PhysicsActor AddAvatar(string avName, PhysicsVector position, PhysicsVector size)
@@ -1068,6 +1098,7 @@ namespace OpenSim.Region.Physics.OdePlugin
1068 { 1098 {
1069 lock (prim) 1099 lock (prim)
1070 { 1100 {
1101 remCollisionEventReporting(prim);
1071 lock (ode) 1102 lock (ode)
1072 { 1103 {
1073 if (prim.prim_geom != (IntPtr)0) 1104 if (prim.prim_geom != (IntPtr)0)
@@ -1551,6 +1582,28 @@ namespace OpenSim.Region.Physics.OdePlugin
1551 1582
1552 collision_optimized(timeStep); 1583 collision_optimized(timeStep);
1553 1584
1585 lock (_collisionEventPrim)
1586 {
1587 foreach (PhysicsActor obj in _collisionEventPrim)
1588 {
1589 if (obj == null)
1590 continue;
1591
1592 switch ((ActorTypes)obj.PhysicsActorType)
1593 {
1594 case ActorTypes.Agent:
1595 OdeCharacter cobj = (OdeCharacter)obj;
1596 cobj.SendCollisions();
1597 break;
1598 case ActorTypes.Prim:
1599 OdePrim pobj = (OdePrim)obj;
1600 pobj.SendCollisions();
1601 break;
1602 }
1603
1604 }
1605 }
1606
1554 d.WorldQuickStep(world, ODE_STEPSIZE); 1607 d.WorldQuickStep(world, ODE_STEPSIZE);
1555 1608
1556 d.JointGroupEmpty(contactgroup); 1609 d.JointGroupEmpty(contactgroup);
diff --git a/OpenSim/Region/Physics/POSPlugin/POSPlugin.cs b/OpenSim/Region/Physics/POSPlugin/POSPlugin.cs
index b7f38d4..836e620 100644
--- a/OpenSim/Region/Physics/POSPlugin/POSPlugin.cs
+++ b/OpenSim/Region/Physics/POSPlugin/POSPlugin.cs
@@ -527,6 +527,18 @@ namespace OpenSim.Region.Physics.POSPlugin
527 public override PhysicsVector PIDTarget { set { return; } } 527 public override PhysicsVector PIDTarget { set { return; } }
528 public override bool PIDActive { set { return; } } 528 public override bool PIDActive { set { return; } }
529 public override float PIDTau { set { return; } } 529 public override float PIDTau { set { return; } }
530 public override void SubscribeEvents(int ms)
531 {
532
533 }
534 public override void UnSubscribeEvents()
535 {
536
537 }
538 public override bool SubscribedEvents()
539 {
540 return false;
541 }
530 } 542 }
531 543
532 public class POSPrim : PhysicsActor 544 public class POSPrim : PhysicsActor
@@ -728,5 +740,17 @@ namespace OpenSim.Region.Physics.POSPlugin
728 public override PhysicsVector PIDTarget { set { return; } } 740 public override PhysicsVector PIDTarget { set { return; } }
729 public override bool PIDActive { set { return; } } 741 public override bool PIDActive { set { return; } }
730 public override float PIDTau { set { return; } } 742 public override float PIDTau { set { return; } }
743 public override void SubscribeEvents(int ms)
744 {
745
746 }
747 public override void UnSubscribeEvents()
748 {
749
750 }
751 public override bool SubscribedEvents()
752 {
753 return false;
754 }
731 } 755 }
732} 756}
diff --git a/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs b/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs
index 2d40134..49fe1b5 100644
--- a/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs
+++ b/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs
@@ -441,6 +441,18 @@ namespace OpenSim.Region.Physics.PhysXPlugin
441 public override PhysicsVector PIDTarget { set { return; } } 441 public override PhysicsVector PIDTarget { set { return; } }
442 public override bool PIDActive { set { return; } } 442 public override bool PIDActive { set { return; } }
443 public override float PIDTau { set { return; } } 443 public override float PIDTau { set { return; } }
444 public override void SubscribeEvents(int ms)
445 {
446
447 }
448 public override void UnSubscribeEvents()
449 {
450
451 }
452 public override bool SubscribedEvents()
453 {
454 return false;
455 }
444 } 456 }
445 457
446 458
@@ -666,5 +678,18 @@ namespace OpenSim.Region.Physics.PhysXPlugin
666 public override PhysicsVector PIDTarget { set { return; } } 678 public override PhysicsVector PIDTarget { set { return; } }
667 public override bool PIDActive { set { return; } } 679 public override bool PIDActive { set { return; } }
668 public override float PIDTau { set { return; } } 680 public override float PIDTau { set { return; } }
681
682 public override void SubscribeEvents(int ms)
683 {
684
685 }
686 public override void UnSubscribeEvents()
687 {
688
689 }
690 public override bool SubscribedEvents()
691 {
692 return false;
693 }
669 } 694 }
670} 695}