aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics
diff options
context:
space:
mode:
authorMelanie2012-05-21 07:32:27 +0200
committerMelanie2012-05-21 07:32:27 +0200
commit7305d2e0ef843de24477e8f41af3091c880d811a (patch)
treea47dcb2bb8202146ced7ae2ae609c7bbcc8aeebb /OpenSim/Region/Physics
parentFix setting positions of attachments. The recent security fix regarding (diff)
parent missing update script events call (diff)
downloadopensim-SC_OLD-7305d2e0ef843de24477e8f41af3091c880d811a.zip
opensim-SC_OLD-7305d2e0ef843de24477e8f41af3091c880d811a.tar.gz
opensim-SC_OLD-7305d2e0ef843de24477e8f41af3091c880d811a.tar.bz2
opensim-SC_OLD-7305d2e0ef843de24477e8f41af3091c880d811a.tar.xz
Merge branch 'ubitwork' into avination
Diffstat (limited to 'OpenSim/Region/Physics')
-rw-r--r--OpenSim/Region/Physics/Manager/PhysicsActor.cs2
-rw-r--r--OpenSim/Region/Physics/UbitOdePlugin/ODECharacter.cs83
-rw-r--r--OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs128
-rw-r--r--OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs119
4 files changed, 178 insertions, 154 deletions
diff --git a/OpenSim/Region/Physics/Manager/PhysicsActor.cs b/OpenSim/Region/Physics/Manager/PhysicsActor.cs
index b66d7f1..fb90887 100644
--- a/OpenSim/Region/Physics/Manager/PhysicsActor.cs
+++ b/OpenSim/Region/Physics/Manager/PhysicsActor.cs
@@ -59,12 +59,14 @@ namespace OpenSim.Region.Physics.Manager
59 public Vector3 Position; 59 public Vector3 Position;
60 public Vector3 SurfaceNormal; 60 public Vector3 SurfaceNormal;
61 public float PenetrationDepth; 61 public float PenetrationDepth;
62 public float RelativeSpeed;
62 63
63 public ContactPoint(Vector3 position, Vector3 surfaceNormal, float penetrationDepth) 64 public ContactPoint(Vector3 position, Vector3 surfaceNormal, float penetrationDepth)
64 { 65 {
65 Position = position; 66 Position = position;
66 SurfaceNormal = surfaceNormal; 67 SurfaceNormal = surfaceNormal;
67 PenetrationDepth = penetrationDepth; 68 PenetrationDepth = penetrationDepth;
69 RelativeSpeed = 0f; // for now let this one be set explicity
68 } 70 }
69 } 71 }
70 72
diff --git a/OpenSim/Region/Physics/UbitOdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/UbitOdePlugin/ODECharacter.cs
index b0711d7..1084b0e 100644
--- a/OpenSim/Region/Physics/UbitOdePlugin/ODECharacter.cs
+++ b/OpenSim/Region/Physics/UbitOdePlugin/ODECharacter.cs
@@ -128,9 +128,10 @@ namespace OpenSim.Region.Physics.OdePlugin
128 public d.Mass ShellMass; 128 public d.Mass ShellMass;
129// public bool collidelock = false; 129// public bool collidelock = false;
130 130
131 private bool m_haseventsubscription = false;
132 public int m_eventsubscription = 0; 131 public int m_eventsubscription = 0;
133 private CollisionEventUpdate CollisionEventsThisFrame = new CollisionEventUpdate(); 132 private int m_cureventsubscription = 0;
133 private CollisionEventUpdate CollisionEventsThisFrame = null;
134 private bool SentEmptyCollisionsEvent;
134 135
135 // unique UUID of this character object 136 // unique UUID of this character object
136 public UUID m_uuid; 137 public UUID m_uuid;
@@ -239,7 +240,7 @@ namespace OpenSim.Region.Physics.OdePlugin
239 240
240 public override bool IsPhysical 241 public override bool IsPhysical
241 { 242 {
242 get { return false; } 243 get { return m_isPhysical; }
243 set { return; } 244 set { return; }
244 } 245 }
245 246
@@ -783,8 +784,6 @@ namespace OpenSim.Region.Physics.OdePlugin
783 784
784 // the Amotor still lets avatar rotation to drift during colisions 785 // the Amotor still lets avatar rotation to drift during colisions
785 // so force it back to identity 786 // so force it back to identity
786
787
788 787
789 d.Quaternion qtmp; 788 d.Quaternion qtmp;
790 qtmp.W = 1; 789 qtmp.W = 1;
@@ -903,6 +902,7 @@ namespace OpenSim.Region.Physics.OdePlugin
903 contact.SurfaceNormal.X = 0f; 902 contact.SurfaceNormal.X = 0f;
904 contact.SurfaceNormal.Y = 0f; 903 contact.SurfaceNormal.Y = 0f;
905 contact.SurfaceNormal.Z = -1f; 904 contact.SurfaceNormal.Z = -1f;
905 contact.RelativeSpeed = -vel.Z;
906 AddCollisionEvent(0, contact); 906 AddCollisionEvent(0, contact);
907 907
908 vec.Z *= 0.5f; 908 vec.Z *= 0.5f;
@@ -1119,47 +1119,71 @@ namespace OpenSim.Region.Physics.OdePlugin
1119 1119
1120 public override void SubscribeEvents(int ms) 1120 public override void SubscribeEvents(int ms)
1121 { 1121 {
1122 m_requestedUpdateFrequency = ms;
1123 m_eventsubscription = ms; 1122 m_eventsubscription = ms;
1124 _parent_scene.AddCollisionEventReporting(this); 1123 m_cureventsubscription = 0;
1125 m_haseventsubscription = true; 1124 if (CollisionEventsThisFrame == null)
1125 CollisionEventsThisFrame = new CollisionEventUpdate();
1126 SentEmptyCollisionsEvent = false;
1126 } 1127 }
1127 1128
1128 public override void UnSubscribeEvents() 1129 public override void UnSubscribeEvents()
1129 { 1130 {
1130 m_haseventsubscription = false; 1131 if (CollisionEventsThisFrame != null)
1131 _parent_scene.RemoveCollisionEventReporting(this); 1132 {
1132 m_requestedUpdateFrequency = 0; 1133 CollisionEventsThisFrame.Clear();
1134 CollisionEventsThisFrame = null;
1135 }
1133 m_eventsubscription = 0; 1136 m_eventsubscription = 0;
1134 } 1137 }
1135 1138
1136 public void AddCollisionEvent(uint CollidedWith, ContactPoint contact) 1139 public void AddCollisionEvent(uint CollidedWith, ContactPoint contact)
1137 { 1140 {
1138 if (m_haseventsubscription) 1141 if (CollisionEventsThisFrame == null)
1139 { 1142 CollisionEventsThisFrame = new CollisionEventUpdate();
1140 // m_log.DebugFormat( 1143 CollisionEventsThisFrame.AddCollider(CollidedWith, contact);
1141 // "[PHYSICS]: Adding collision event for {0}, collidedWith {1}, contact {2}", "", CollidedWith, contact);
1142
1143 CollisionEventsThisFrame.AddCollider(CollidedWith, contact);
1144 }
1145 } 1144 }
1146 1145
1147 public void SendCollisions() 1146 public void SendCollisions()
1148 { 1147 {
1149 if (m_haseventsubscription && m_eventsubscription > m_requestedUpdateFrequency) 1148 if (CollisionEventsThisFrame == null)
1149 return;
1150
1151 if (m_cureventsubscription < m_eventsubscription)
1152 return;
1153
1154 m_cureventsubscription = 0;
1155
1156 int ncolisions = CollisionEventsThisFrame.m_objCollisionList.Count;
1157
1158 if (!SentEmptyCollisionsEvent || ncolisions > 0)
1150 { 1159 {
1151 if (CollisionEventsThisFrame != null) 1160 base.SendCollisionUpdate(CollisionEventsThisFrame);
1161
1162 if (ncolisions == 0)
1152 { 1163 {
1153 base.SendCollisionUpdate(CollisionEventsThisFrame); 1164 SentEmptyCollisionsEvent = true;
1165 _parent_scene.RemoveCollisionEventReporting(this);
1154 } 1166 }
1155 CollisionEventsThisFrame = new CollisionEventUpdate(); 1167 else
1156 m_eventsubscription = 0; 1168 {
1157 } 1169 SentEmptyCollisionsEvent = false;
1170 CollisionEventsThisFrame.Clear();
1171 }
1172 }
1173 }
1174
1175 internal void AddCollisionFrameTime(int t)
1176 {
1177 // protect it from overflow crashing
1178 if (m_cureventsubscription < 50000)
1179 m_cureventsubscription += t;
1158 } 1180 }
1159 1181
1160 public override bool SubscribedEvents() 1182 public override bool SubscribedEvents()
1161 { 1183 {
1162 return m_haseventsubscription; 1184 if (m_eventsubscription > 0)
1185 return true;
1186 return false;
1163 } 1187 }
1164 1188
1165 private void changePhysicsStatus(bool NewStatus) 1189 private void changePhysicsStatus(bool NewStatus)
@@ -1465,14 +1489,5 @@ namespace OpenSim.Region.Physics.OdePlugin
1465 { 1489 {
1466 _parent_scene.AddChange((PhysicsActor)this, what, arg); 1490 _parent_scene.AddChange((PhysicsActor)this, what, arg);
1467 } 1491 }
1468
1469
1470 internal void AddCollisionFrameTime(int p)
1471 {
1472 // protect it from overflow crashing
1473 if (m_eventsubscription + p >= int.MaxValue)
1474 m_eventsubscription = 0;
1475 m_eventsubscription += p;
1476 }
1477 } 1492 }
1478} 1493}
diff --git a/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs
index 5db4f17..62fd279 100644
--- a/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs
+++ b/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs
@@ -477,58 +477,58 @@ namespace OpenSim.Region.Physics.OdePlugin
477 477
478 // if(childPrim) we only know about physical linksets 478 // if(childPrim) we only know about physical linksets
479 return Ptot; 479 return Ptot;
480 /* 480/*
481 float tmass = _mass; 481 float tmass = _mass;
482 Ptot *= tmass; 482 Ptot *= tmass;
483 483
484 float m; 484 float m;
485 485
486 foreach (OdePrim prm in childrenPrim) 486 foreach (OdePrim prm in childrenPrim)
487 { 487 {
488 m = prm._mass; 488 m = prm._mass;
489 Ptot += prm.CenterOfMass * m; 489 Ptot += prm.CenterOfMass * m;
490 tmass += m; 490 tmass += m;
491 } 491 }
492 492
493 if (tmass == 0) 493 if (tmass == 0)
494 tmass = 0; 494 tmass = 0;
495 else 495 else
496 tmass = 1.0f / tmass; 496 tmass = 1.0f / tmass;
497 497
498 Ptot *= tmass; 498 Ptot *= tmass;
499 return Ptot; 499 return Ptot;
500 */ 500*/
501 } 501 }
502 else 502 else
503 return _position; 503 return _position;
504 } 504 }
505 } 505 }
506 } 506 }
507 /* 507/*
508 public override Vector3 PrimOOBsize 508 public override Vector3 PrimOOBsize
509 { 509 {
510 get 510 get
511 { 511 {
512 return primOOBsize; 512 return primOOBsize;
513 } 513 }
514 } 514 }
515 515
516 public override Vector3 PrimOOBoffset 516 public override Vector3 PrimOOBoffset
517 { 517 {
518 get 518 get
519 { 519 {
520 return primOOBoffset; 520 return primOOBoffset;
521 } 521 }
522 } 522 }
523 523
524 public override float PrimOOBRadiusSQ 524 public override float PrimOOBRadiusSQ
525 { 525 {
526 get 526 get
527 { 527 {
528 return primOOBradiusSQ; 528 return primOOBradiusSQ;
529 } 529 }
530 } 530 }
531 */ 531*/
532 public override PrimitiveBaseShape Shape 532 public override PrimitiveBaseShape Shape
533 { 533 {
534 set 534 set
@@ -582,7 +582,7 @@ namespace OpenSim.Region.Physics.OdePlugin
582 if (value.IsFinite()) 582 if (value.IsFinite())
583 { 583 {
584 AddChange(changes.Velocity, value); 584 AddChange(changes.Velocity, value);
585 // _velocity = value; 585// _velocity = value;
586 586
587 } 587 }
588 else 588 else
@@ -937,12 +937,10 @@ namespace OpenSim.Region.Physics.OdePlugin
937 if (CollisionEventsThisFrame == null) 937 if (CollisionEventsThisFrame == null)
938 CollisionEventsThisFrame = new CollisionEventUpdate(); 938 CollisionEventsThisFrame = new CollisionEventUpdate();
939 SentEmptyCollisionsEvent = false; 939 SentEmptyCollisionsEvent = false;
940 _parent_scene.AddCollisionEventReporting(this);
941 } 940 }
942 941
943 public override void UnSubscribeEvents() 942 public override void UnSubscribeEvents()
944 { 943 {
945 _parent_scene.RemoveCollisionEventReporting(this);
946 if (CollisionEventsThisFrame != null) 944 if (CollisionEventsThisFrame != null)
947 { 945 {
948 CollisionEventsThisFrame.Clear(); 946 CollisionEventsThisFrame.Clear();
@@ -975,7 +973,10 @@ namespace OpenSim.Region.Physics.OdePlugin
975 base.SendCollisionUpdate(CollisionEventsThisFrame); 973 base.SendCollisionUpdate(CollisionEventsThisFrame);
976 974
977 if (ncolisions == 0) 975 if (ncolisions == 0)
976 {
978 SentEmptyCollisionsEvent = true; 977 SentEmptyCollisionsEvent = true;
978 _parent_scene.RemoveCollisionEventReporting(this);
979 }
979 else 980 else
980 { 981 {
981 SentEmptyCollisionsEvent = false; 982 SentEmptyCollisionsEvent = false;
@@ -986,11 +987,10 @@ namespace OpenSim.Region.Physics.OdePlugin
986 987
987 internal void AddCollisionFrameTime(int t) 988 internal void AddCollisionFrameTime(int t)
988 { 989 {
989 // protect it from overflow crashing 990 if (m_cureventsubscription < 50000)
990 if (m_cureventsubscription + t >= int.MaxValue) 991 m_cureventsubscription += t;
991 m_cureventsubscription = 0;
992 m_cureventsubscription += t;
993 } 992 }
993
994 public override bool SubscribedEvents() 994 public override bool SubscribedEvents()
995 { 995 {
996 if (m_eventsubscription > 0) 996 if (m_eventsubscription > 0)
@@ -1735,8 +1735,8 @@ namespace OpenSim.Region.Physics.OdePlugin
1735 1735
1736 d.BodySetAutoDisableFlag(Body, true); 1736 d.BodySetAutoDisableFlag(Body, true);
1737 d.BodySetAutoDisableSteps(Body, body_autodisable_frames); 1737 d.BodySetAutoDisableSteps(Body, body_autodisable_frames);
1738 // d.BodySetLinearDampingThreshold(Body, 0.01f); 1738// d.BodySetLinearDampingThreshold(Body, 0.01f);
1739 // d.BodySetAngularDampingThreshold(Body, 0.001f); 1739// d.BodySetAngularDampingThreshold(Body, 0.001f);
1740 d.BodySetDamping(Body, .002f, .002f); 1740 d.BodySetDamping(Body, .002f, .002f);
1741 1741
1742 if (m_targetSpace != IntPtr.Zero) 1742 if (m_targetSpace != IntPtr.Zero)
@@ -2966,7 +2966,7 @@ namespace OpenSim.Region.Physics.OdePlugin
2966 givefakepos--; 2966 givefakepos--;
2967 if (givefakepos < 0) 2967 if (givefakepos < 0)
2968 givefakepos = 0; 2968 givefakepos = 0;
2969 // changeSelectedStatus(); 2969// changeSelectedStatus();
2970 resetCollisionAccounting(); 2970 resetCollisionAccounting();
2971 } 2971 }
2972 2972
@@ -2981,14 +2981,14 @@ namespace OpenSim.Region.Physics.OdePlugin
2981 { 2981 {
2982 _orientation = newOri; 2982 _orientation = newOri;
2983 } 2983 }
2984 /* 2984/*
2985 else if (m_forcePosOrRotation && _orientation != newOri && Body != IntPtr.Zero) 2985 else if (m_forcePosOrRotation && _orientation != newOri && Body != IntPtr.Zero)
2986 { 2986 {
2987 FixInertia(_position, newOri); 2987 FixInertia(_position, newOri);
2988 if (!d.BodyIsEnabled(Body)) 2988 if (!d.BodyIsEnabled(Body))
2989 d.BodyEnable(Body); 2989 d.BodyEnable(Body);
2990 } 2990 }
2991 */ 2991*/
2992 } 2992 }
2993 else 2993 else
2994 { 2994 {
@@ -3939,12 +3939,12 @@ namespace OpenSim.Region.Physics.OdePlugin
3939 changevelocity((Vector3)arg); 3939 changevelocity((Vector3)arg);
3940 break; 3940 break;
3941 3941
3942 // case changes.Acceleration: 3942// case changes.Acceleration:
3943 // changeacceleration((Vector3)arg); 3943// changeacceleration((Vector3)arg);
3944 // break; 3944// break;
3945 // case changes.AngVelocity: 3945// case changes.AngVelocity:
3946 // changeangvelocity((Vector3)arg); 3946// changeangvelocity((Vector3)arg);
3947 // break; 3947// break;
3948 3948
3949 case changes.Force: 3949 case changes.Force:
3950 changeForce((Vector3)arg); 3950 changeForce((Vector3)arg);
diff --git a/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs b/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs
index ddfdea4..bfcfd21 100644
--- a/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs
+++ b/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs
@@ -190,6 +190,7 @@ namespace OpenSim.Region.Physics.OdePlugin
190 190
191 public float ODE_STEPSIZE = 0.020f; 191 public float ODE_STEPSIZE = 0.020f;
192 public float HalfOdeStep = 0.01f; 192 public float HalfOdeStep = 0.01f;
193 public int odetimestepMS = 20; // rounded
193 private float metersInSpace = 25.6f; 194 private float metersInSpace = 25.6f;
194 private float m_timeDilation = 1.0f; 195 private float m_timeDilation = 1.0f;
195 196
@@ -247,6 +248,7 @@ namespace OpenSim.Region.Physics.OdePlugin
247 /// A list of actors that should receive collision events. 248 /// A list of actors that should receive collision events.
248 /// </summary> 249 /// </summary>
249 private readonly List<PhysicsActor> _collisionEventPrim = new List<PhysicsActor>(); 250 private readonly List<PhysicsActor> _collisionEventPrim = new List<PhysicsActor>();
251 private readonly List<PhysicsActor> _collisionEventPrimRemove = new List<PhysicsActor>();
250 252
251 private readonly HashSet<OdeCharacter> _badCharacter = new HashSet<OdeCharacter>(); 253 private readonly HashSet<OdeCharacter> _badCharacter = new HashSet<OdeCharacter>();
252 public Dictionary<IntPtr, String> geom_name_map = new Dictionary<IntPtr, String>(); 254 public Dictionary<IntPtr, String> geom_name_map = new Dictionary<IntPtr, String>();
@@ -489,6 +491,7 @@ namespace OpenSim.Region.Physics.OdePlugin
489 } 491 }
490 492
491 HalfOdeStep = ODE_STEPSIZE * 0.5f; 493 HalfOdeStep = ODE_STEPSIZE * 0.5f;
494 odetimestepMS = (int)(1000.0f * ODE_STEPSIZE +0.5f);
492 495
493 ContactgeomsArray = Marshal.AllocHGlobal(contactsPerCollision * d.ContactGeom.unmanagedSizeOf); 496 ContactgeomsArray = Marshal.AllocHGlobal(contactsPerCollision * d.ContactGeom.unmanagedSizeOf);
494 GlobalContactsArray = GlobalContactsArray = Marshal.AllocHGlobal(maxContactsbeforedeath * d.Contact.unmanagedSizeOf); 497 GlobalContactsArray = GlobalContactsArray = Marshal.AllocHGlobal(maxContactsbeforedeath * d.Contact.unmanagedSizeOf);
@@ -1064,7 +1067,7 @@ namespace OpenSim.Region.Physics.OdePlugin
1064 obj2LocalID = 0; 1067 obj2LocalID = 0;
1065 bool p1events = p1.SubscribedEvents(); 1068 bool p1events = p1.SubscribedEvents();
1066 bool p2events = p2.SubscribedEvents(); 1069 bool p2events = p2.SubscribedEvents();
1067 1070
1068 if (p1.IsVolumeDtc) 1071 if (p1.IsVolumeDtc)
1069 p2events = false; 1072 p2events = false;
1070 if (p2.IsVolumeDtc) 1073 if (p2.IsVolumeDtc)
@@ -1073,6 +1076,21 @@ namespace OpenSim.Region.Physics.OdePlugin
1073 if (!(p2events || p1events)) 1076 if (!(p2events || p1events))
1074 return; 1077 return;
1075 1078
1079 if (p1events)
1080 AddCollisionEventReporting(p1);
1081
1082 if (p2events)
1083 AddCollisionEventReporting(p2);
1084
1085 Vector3 vel = Vector3.Zero;
1086 if (p2 != null && p2.IsPhysical)
1087 vel = p2.Velocity;
1088
1089 if (p1 != null && p1.IsPhysical)
1090 vel -= p1.Velocity;
1091
1092 contact.RelativeSpeed = Vector3.Dot(vel, contact.SurfaceNormal);
1093
1076 switch ((ActorTypes)p1.PhysicsActorType) 1094 switch ((ActorTypes)p1.PhysicsActorType)
1077 { 1095 {
1078 case ActorTypes.Agent: 1096 case ActorTypes.Agent:
@@ -1246,20 +1264,14 @@ namespace OpenSim.Region.Physics.OdePlugin
1246 } 1264 }
1247 1265
1248 #endregion 1266 #endregion
1249
1250
1251
1252 /// <summary> 1267 /// <summary>
1253 /// Add actor to the list that should receive collision events in the simulate loop. 1268 /// Add actor to the list that should receive collision events in the simulate loop.
1254 /// </summary> 1269 /// </summary>
1255 /// <param name="obj"></param> 1270 /// <param name="obj"></param>
1256 public void AddCollisionEventReporting(PhysicsActor obj) 1271 public void AddCollisionEventReporting(PhysicsActor obj)
1257 { 1272 {
1258 lock (_collisionEventPrim) 1273 if (!_collisionEventPrim.Contains(obj))
1259 { 1274 _collisionEventPrim.Add(obj);
1260 if (!_collisionEventPrim.Contains(obj))
1261 _collisionEventPrim.Add(obj);
1262 }
1263 } 1275 }
1264 1276
1265 /// <summary> 1277 /// <summary>
@@ -1268,13 +1280,11 @@ namespace OpenSim.Region.Physics.OdePlugin
1268 /// <param name="obj"></param> 1280 /// <param name="obj"></param>
1269 public void RemoveCollisionEventReporting(PhysicsActor obj) 1281 public void RemoveCollisionEventReporting(PhysicsActor obj)
1270 { 1282 {
1271 lock (_collisionEventPrim) 1283 if (_collisionEventPrim.Contains(obj) && !_collisionEventPrimRemove.Contains(obj))
1272 { 1284 _collisionEventPrimRemove.Add(obj);
1273 if (_collisionEventPrim.Contains(obj))
1274 _collisionEventPrim.Remove(obj);
1275 }
1276 } 1285 }
1277 1286
1287
1278 #region Add/Remove Entities 1288 #region Add/Remove Entities
1279 1289
1280 public override PhysicsActor AddAvatar(string avName, Vector3 position, Vector3 size, bool isFlying) 1290 public override PhysicsActor AddAvatar(string avName, Vector3 position, Vector3 size, bool isFlying)
@@ -1463,6 +1473,7 @@ namespace OpenSim.Region.Physics.OdePlugin
1463 { 1473 {
1464// lock (OdeLock) 1474// lock (OdeLock)
1465 { 1475 {
1476
1466 OdePrim p = (OdePrim)prim; 1477 OdePrim p = (OdePrim)prim;
1467 p.setPrimForRemoval(); 1478 p.setPrimForRemoval();
1468 } 1479 }
@@ -1818,7 +1829,6 @@ namespace OpenSim.Region.Physics.OdePlugin
1818 { 1829 {
1819 int ttmpstart = Util.EnvironmentTickCount(); 1830 int ttmpstart = Util.EnvironmentTickCount();
1820 int ttmp; 1831 int ttmp;
1821 int ttmp2;
1822 1832
1823 while(ChangesQueue.Dequeue(out item)) 1833 while(ChangesQueue.Dequeue(out item))
1824 { 1834 {
@@ -1840,11 +1850,6 @@ namespace OpenSim.Region.Physics.OdePlugin
1840 if (ttmp > 20) 1850 if (ttmp > 20)
1841 break; 1851 break;
1842 } 1852 }
1843
1844 ttmp2 = Util.EnvironmentTickCountSubtract(ttmpstart);
1845 if (ttmp2 > 50)
1846 ttmp2 = 0;
1847
1848 } 1853 }
1849 1854
1850 // Move characters 1855 // Move characters
@@ -1881,53 +1886,55 @@ namespace OpenSim.Region.Physics.OdePlugin
1881 1886
1882 collision_optimized(); 1887 collision_optimized();
1883 1888
1884 lock (_collisionEventPrim) 1889 foreach (PhysicsActor obj in _collisionEventPrim)
1885 { 1890 {
1886 foreach (PhysicsActor obj in _collisionEventPrim) 1891 if (obj == null)
1892 continue;
1893
1894 switch ((ActorTypes)obj.PhysicsActorType)
1887 { 1895 {
1888 if (obj == null) 1896 case ActorTypes.Agent:
1889 continue; 1897 OdeCharacter cobj = (OdeCharacter)obj;
1898 cobj.AddCollisionFrameTime((int)(odetimestepMS));
1899 cobj.SendCollisions();
1900 break;
1890 1901
1891 switch ((ActorTypes)obj.PhysicsActorType) 1902 case ActorTypes.Prim:
1892 { 1903 OdePrim pobj = (OdePrim)obj;
1893 case ActorTypes.Agent: 1904 if (pobj.Body == IntPtr.Zero || (d.BodyIsEnabled(pobj.Body) && !pobj.m_outbounds))
1894 OdeCharacter cobj = (OdeCharacter)obj; 1905 {
1895 cobj.AddCollisionFrameTime((int)(ODE_STEPSIZE*1000.0f)); 1906 pobj.AddCollisionFrameTime((int)(odetimestepMS));
1896 cobj.SendCollisions(); 1907 pobj.SendCollisions();
1897 break; 1908 }
1898 1909 break;
1899 case ActorTypes.Prim:
1900 OdePrim pobj = (OdePrim)obj;
1901 if (pobj.Body == IntPtr.Zero || (d.BodyIsEnabled(pobj.Body) && !pobj.m_outbounds))
1902 {
1903 pobj.AddCollisionFrameTime((int)(ODE_STEPSIZE * 1000.0f));
1904 pobj.SendCollisions();
1905 }
1906 break;
1907 }
1908 } 1910 }
1909 } 1911 }
1910 1912
1913 foreach (PhysicsActor obj in _collisionEventPrimRemove)
1914 _collisionEventPrim.Remove(obj);
1915
1916 _collisionEventPrimRemove.Clear();
1917
1911 // do a ode simulation step 1918 // do a ode simulation step
1912 d.WorldQuickStep(world, ODE_STEPSIZE); 1919 d.WorldQuickStep(world, ODE_STEPSIZE);
1913 d.JointGroupEmpty(contactgroup); 1920 d.JointGroupEmpty(contactgroup);
1914 1921
1915 // update managed ideia of physical data and do updates to core 1922 // update managed ideia of physical data and do updates to core
1916 /* 1923 /*
1917 lock (_characters) 1924 lock (_characters)
1918 { 1925 {
1919 foreach (OdeCharacter actor in _characters) 1926 foreach (OdeCharacter actor in _characters)
1920 { 1927 {
1921 if (actor != null) 1928 if (actor != null)
1922 { 1929 {
1923 if (actor.bad) 1930 if (actor.bad)
1924 m_log.WarnFormat("[PHYSICS]: BAD Actor {0} in _characters list was not removed?", actor.m_uuid); 1931 m_log.WarnFormat("[PHYSICS]: BAD Actor {0} in _characters list was not removed?", actor.m_uuid);
1925 1932
1926 actor.UpdatePositionAndVelocity(); 1933 actor.UpdatePositionAndVelocity();
1927 } 1934 }
1928 } 1935 }
1929 } 1936 }
1930 */ 1937 */
1931 1938
1932 lock (_activegroups) 1939 lock (_activegroups)
1933 { 1940 {