aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Data/MySQL/MySQLSimulationData.cs9
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs174
-rw-r--r--OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs46
-rw-r--r--OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs33
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs6
5 files changed, 204 insertions, 64 deletions
diff --git a/OpenSim/Data/MySQL/MySQLSimulationData.cs b/OpenSim/Data/MySQL/MySQLSimulationData.cs
index 89600db..9467124 100644
--- a/OpenSim/Data/MySQL/MySQLSimulationData.cs
+++ b/OpenSim/Data/MySQL/MySQLSimulationData.cs
@@ -171,6 +171,7 @@ namespace OpenSim.Data.MySQL
171 "ParticleSystem, ClickAction, Material, " + 171 "ParticleSystem, ClickAction, Material, " +
172 "CollisionSound, CollisionSoundVolume, " + 172 "CollisionSound, CollisionSoundVolume, " +
173 "PassTouches, " + 173 "PassTouches, " +
174 "PassCollisions, " +
174 "LinkNumber, MediaURL, KeyframeMotion, " + 175 "LinkNumber, MediaURL, KeyframeMotion, " +
175 "PhysicsShapeType, Density, GravityModifier, " + 176 "PhysicsShapeType, Density, GravityModifier, " +
176 "Friction, Restitution) values (" + "?UUID, " + 177 "Friction, Restitution) values (" + "?UUID, " +
@@ -204,7 +205,7 @@ namespace OpenSim.Data.MySQL
204 "?SaleType, ?ColorR, ?ColorG, " + 205 "?SaleType, ?ColorR, ?ColorG, " +
205 "?ColorB, ?ColorA, ?ParticleSystem, " + 206 "?ColorB, ?ColorA, ?ParticleSystem, " +
206 "?ClickAction, ?Material, ?CollisionSound, " + 207 "?ClickAction, ?Material, ?CollisionSound, " +
207 "?CollisionSoundVolume, ?PassTouches, " + 208 "?CollisionSoundVolume, ?PassTouches, ?PassCollisions, " +
208 "?LinkNumber, ?MediaURL, ?KeyframeMotion, " + 209 "?LinkNumber, ?MediaURL, ?KeyframeMotion, " +
209 "?PhysicsShapeType, ?Density, ?GravityModifier, " + 210 "?PhysicsShapeType, ?Density, ?GravityModifier, " +
210 "?Friction, ?Restitution)"; 211 "?Friction, ?Restitution)";
@@ -1231,6 +1232,7 @@ namespace OpenSim.Data.MySQL
1231 prim.CollisionSoundVolume = (float)(double)row["CollisionSoundVolume"]; 1232 prim.CollisionSoundVolume = (float)(double)row["CollisionSoundVolume"];
1232 1233
1233 prim.PassTouches = ((sbyte)row["PassTouches"] != 0); 1234 prim.PassTouches = ((sbyte)row["PassTouches"] != 0);
1235 prim.PassCollisions = ((sbyte)row["PassCollisions"] != 0);
1234 prim.LinkNum = (int)row["LinkNumber"]; 1236 prim.LinkNum = (int)row["LinkNumber"];
1235 1237
1236 if (!(row["MediaURL"] is System.DBNull)) 1238 if (!(row["MediaURL"] is System.DBNull))
@@ -1605,6 +1607,11 @@ namespace OpenSim.Data.MySQL
1605 else 1607 else
1606 cmd.Parameters.AddWithValue("PassTouches", 0); 1608 cmd.Parameters.AddWithValue("PassTouches", 0);
1607 1609
1610 if (prim.PassCollisions)
1611 cmd.Parameters.AddWithValue("PassCollisions", 1);
1612 else
1613 cmd.Parameters.AddWithValue("PassCollisions", 0);
1614
1608 cmd.Parameters.AddWithValue("LinkNumber", prim.LinkNum); 1615 cmd.Parameters.AddWithValue("LinkNumber", prim.LinkNum);
1609 cmd.Parameters.AddWithValue("MediaURL", prim.MediaUrl); 1616 cmd.Parameters.AddWithValue("MediaURL", prim.MediaUrl);
1610 1617
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 6064279..f62eef3 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -123,11 +123,17 @@ namespace OpenSim.Region.Framework.Scenes
123 /// </value> 123 /// </value>
124 public const int ALL_SIDES = -1; 124 public const int ALL_SIDES = -1;
125 125
126 private const scriptEvents PhyscicsNeededSubsEvents = ( 126 private const scriptEvents PhysicsNeededSubsEvents = (
127 scriptEvents.collision | scriptEvents.collision_start | scriptEvents.collision_end | 127 scriptEvents.collision | scriptEvents.collision_start | scriptEvents.collision_end |
128 scriptEvents.land_collision | scriptEvents.land_collision_start | scriptEvents.land_collision_end 128 scriptEvents.land_collision | scriptEvents.land_collision_start | scriptEvents.land_collision_end
129 ); 129 );
130 130 private const scriptEvents PhyscicsPhantonSubsEvents = (
131 scriptEvents.land_collision | scriptEvents.land_collision_start | scriptEvents.land_collision_end
132 );
133 private const scriptEvents PhyscicsVolumeDtcSubsEvents = (
134 scriptEvents.collision_start | scriptEvents.collision_end
135 );
136
131 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 137 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
132 138
133 /// <value> 139 /// <value>
@@ -1882,7 +1888,10 @@ namespace OpenSim.Region.Framework.Scenes
1882 { 1888 {
1883 if ((!isPhantom || isPhysical || _VolumeDetectActive) && !ParentGroup.IsAttachment 1889 if ((!isPhantom || isPhysical || _VolumeDetectActive) && !ParentGroup.IsAttachment
1884 && !(Shape.PathCurve == (byte)Extrusion.Flexible)) 1890 && !(Shape.PathCurve == (byte)Extrusion.Flexible))
1891 {
1885 AddToPhysics(isPhysical, isPhantom, building, isPhysical); 1892 AddToPhysics(isPhysical, isPhantom, building, isPhysical);
1893 UpdatePhysicsSubscribedEvents(); // not sure if appliable here
1894 }
1886 else 1895 else
1887 PhysActor = null; // just to be sure 1896 PhysActor = null; // just to be sure
1888 } 1897 }
@@ -1975,6 +1984,7 @@ namespace OpenSim.Region.Framework.Scenes
1975 1984
1976 bool UsePhysics = ((dupe.Flags & PrimFlags.Physics) != 0); 1985 bool UsePhysics = ((dupe.Flags & PrimFlags.Physics) != 0);
1977 dupe.DoPhysicsPropertyUpdate(UsePhysics, true); 1986 dupe.DoPhysicsPropertyUpdate(UsePhysics, true);
1987// dupe.UpdatePhysicsSubscribedEvents(); // not sure...
1978 } 1988 }
1979 1989
1980 if (dupe.PhysActor != null) 1990 if (dupe.PhysActor != null)
@@ -2605,45 +2615,61 @@ namespace OpenSim.Region.Framework.Scenes
2605 List<uint> endedColliders = new List<uint>(); 2615 List<uint> endedColliders = new List<uint>();
2606 List<uint> startedColliders = new List<uint>(); 2616 List<uint> startedColliders = new List<uint>();
2607 2617
2608 // calculate things that started colliding this time 2618 if (collissionswith.Count == 0)
2609 // and build up list of colliders this time
2610 foreach (uint localid in collissionswith.Keys)
2611 { 2619 {
2612 thisHitColliders.Add(localid); 2620 if (m_lastColliders.Count == 0)
2613 if (!m_lastColliders.Contains(localid)) 2621 return; // nothing to do
2614 startedColliders.Add(localid);
2615 }
2616 2622
2617 // calculate things that ended colliding 2623 foreach (uint localID in m_lastColliders)
2618 foreach (uint localID in m_lastColliders) 2624 {
2619 {
2620 if (!thisHitColliders.Contains(localID))
2621 endedColliders.Add(localID); 2625 endedColliders.Add(localID);
2626 }
2627 m_lastColliders.Clear();
2622 } 2628 }
2623 2629
2624 //add the items that started colliding this time to the last colliders list. 2630 else
2625 foreach (uint localID in startedColliders) 2631 {
2626 m_lastColliders.Add(localID);
2627 2632
2628 // remove things that ended colliding from the last colliders list 2633 // calculate things that started colliding this time
2629 foreach (uint localID in endedColliders) 2634 // and build up list of colliders this time
2630 m_lastColliders.Remove(localID); 2635 foreach (uint localid in collissionswith.Keys)
2636 {
2637 thisHitColliders.Add(localid);
2638 if (!m_lastColliders.Contains(localid))
2639 startedColliders.Add(localid);
2640 }
2631 2641
2642 // calculate things that ended colliding
2643 foreach (uint localID in m_lastColliders)
2644 {
2645 if (!thisHitColliders.Contains(localID))
2646 endedColliders.Add(localID);
2647 }
2648
2649 //add the items that started colliding this time to the last colliders list.
2650 foreach (uint localID in startedColliders)
2651 m_lastColliders.Add(localID);
2652
2653 // remove things that ended colliding from the last colliders list
2654 foreach (uint localID in endedColliders)
2655 m_lastColliders.Remove(localID);
2656 }
2632 // play the sound. 2657 // play the sound.
2633 if (startedColliders.Count > 0 && CollisionSound != UUID.Zero && CollisionSoundVolume > 0.0f) 2658
2659 bool IsNotVolumeDtc = !VolumeDetectActive;
2660
2661 if (startedColliders.Count > 0 && CollisionSound != UUID.Zero && CollisionSoundVolume > 0.0f && IsNotVolumeDtc)
2634 SendSound(CollisionSound.ToString(), CollisionSoundVolume, true, (byte)0, 0, false, false); 2662 SendSound(CollisionSound.ToString(), CollisionSoundVolume, true, (byte)0, 0, false, false);
2635 2663
2636 SendCollisionEvent(scriptEvents.collision_start, startedColliders, ParentGroup.Scene.EventManager.TriggerScriptCollidingStart); 2664 SendCollisionEvent(scriptEvents.collision_start, startedColliders, ParentGroup.Scene.EventManager.TriggerScriptCollidingStart);
2637 SendCollisionEvent(scriptEvents.collision , m_lastColliders , ParentGroup.Scene.EventManager.TriggerScriptColliding); 2665 if (IsNotVolumeDtc)
2666 SendCollisionEvent(scriptEvents.collision , m_lastColliders , ParentGroup.Scene.EventManager.TriggerScriptColliding);
2638 SendCollisionEvent(scriptEvents.collision_end , endedColliders , ParentGroup.Scene.EventManager.TriggerScriptCollidingEnd); 2667 SendCollisionEvent(scriptEvents.collision_end , endedColliders , ParentGroup.Scene.EventManager.TriggerScriptCollidingEnd);
2639 2668
2640 if (startedColliders.Contains(0)) 2669 if (startedColliders.Contains(0))
2641 { 2670 SendLandCollisionEvent(scriptEvents.land_collision_start, ParentGroup.Scene.EventManager.TriggerScriptLandCollidingStart);
2642 if (m_lastColliders.Contains(0)) 2671 if (m_lastColliders.Contains(0))
2643 SendLandCollisionEvent(scriptEvents.land_collision, ParentGroup.Scene.EventManager.TriggerScriptLandColliding); 2672 SendLandCollisionEvent(scriptEvents.land_collision, ParentGroup.Scene.EventManager.TriggerScriptLandColliding);
2644 else
2645 SendLandCollisionEvent(scriptEvents.land_collision_start, ParentGroup.Scene.EventManager.TriggerScriptLandCollidingStart);
2646 }
2647 if (endedColliders.Contains(0)) 2673 if (endedColliders.Contains(0))
2648 SendLandCollisionEvent(scriptEvents.land_collision_end, ParentGroup.Scene.EventManager.TriggerScriptLandCollidingEnd); 2674 SendLandCollisionEvent(scriptEvents.land_collision_end, ParentGroup.Scene.EventManager.TriggerScriptLandCollidingEnd);
2649 } 2675 }
@@ -4386,26 +4412,28 @@ namespace OpenSim.Region.Framework.Scenes
4386 { 4412 {
4387 if (pa == null) 4413 if (pa == null)
4388 { 4414 {
4389 AddToPhysics(UsePhysics, SetPhantom, building , false); 4415 AddToPhysics(UsePhysics, SetPhantom, building, false);
4390 pa = PhysActor; 4416 pa = PhysActor;
4391 4417 /*
4392 if (pa != null) 4418 if (pa != null)
4393 { 4419 {
4394 if ( 4420 if (
4395// ((AggregateScriptEvents & scriptEvents.collision) != 0) || 4421 // ((AggregateScriptEvents & scriptEvents.collision) != 0) ||
4396// ((AggregateScriptEvents & scriptEvents.collision_end) != 0) || 4422 // ((AggregateScriptEvents & scriptEvents.collision_end) != 0) ||
4397// ((AggregateScriptEvents & scriptEvents.collision_start) != 0) || 4423 // ((AggregateScriptEvents & scriptEvents.collision_start) != 0) ||
4398// ((AggregateScriptEvents & scriptEvents.land_collision_start) != 0) || 4424 // ((AggregateScriptEvents & scriptEvents.land_collision_start) != 0) ||
4399// ((AggregateScriptEvents & scriptEvents.land_collision) != 0) || 4425 // ((AggregateScriptEvents & scriptEvents.land_collision) != 0) ||
4400// ((AggregateScriptEvents & scriptEvents.land_collision_end) != 0) || 4426 // ((AggregateScriptEvents & scriptEvents.land_collision_end) != 0) ||
4401 ((AggregateScriptEvents & PhyscicsNeededSubsEvents) != 0) || ((ParentGroup.RootPart.AggregateScriptEvents & PhyscicsNeededSubsEvents) != 0) || (CollisionSound != UUID.Zero) 4427 ((AggregateScriptEvents & PhysicsNeededSubsEvents) != 0) ||
4402// (CollisionSound != UUID.Zero) 4428 ((ParentGroup.RootPart.AggregateScriptEvents & PhysicsNeededSubsEvents) != 0) ||
4403 ) 4429 (CollisionSound != UUID.Zero)
4404 { 4430 )
4405 pa.OnCollisionUpdate += PhysicsCollision; 4431 {
4406 pa.SubscribeEvents(1000); 4432 pa.OnCollisionUpdate += PhysicsCollision;
4407 } 4433 pa.SubscribeEvents(1000);
4408 } 4434 }
4435 }
4436 */
4409 } 4437 }
4410 else // it already has a physical representation 4438 else // it already has a physical representation
4411 { 4439 {
@@ -4416,9 +4444,13 @@ namespace OpenSim.Region.Framework.Scenes
4416 else 4444 else
4417 pa.SetVolumeDetect(0); 4445 pa.SetVolumeDetect(0);
4418 */ 4446 */
4447
4448
4419 if (pa.Building != building) 4449 if (pa.Building != building)
4420 pa.Building = building; 4450 pa.Building = building;
4421 } 4451 }
4452
4453 UpdatePhysicsSubscribedEvents();
4422 } 4454 }
4423 } 4455 }
4424 4456
@@ -4541,8 +4573,7 @@ namespace OpenSim.Region.Framework.Scenes
4541 /// </summary> 4573 /// </summary>
4542 /// <remarks> 4574 /// <remarks>
4543 /// This isn't the same as turning off physical, since even without being physical the prim has a physics 4575 /// This isn't the same as turning off physical, since even without being physical the prim has a physics
4544 /// representation for collision detection. Rather, this would be used in situations such as making a prim 4576 /// representation for collision detection.
4545 /// phantom.
4546 /// </remarks> 4577 /// </remarks>
4547 public void RemoveFromPhysics() 4578 public void RemoveFromPhysics()
4548 { 4579 {
@@ -4706,6 +4737,46 @@ namespace OpenSim.Region.Framework.Scenes
4706 ScheduleFullUpdate(); 4737 ScheduleFullUpdate();
4707 } 4738 }
4708 4739
4740
4741 private void UpdatePhysicsSubscribedEvents()
4742 {
4743 PhysicsActor pa = PhysActor;
4744 if (pa == null)
4745 return;
4746
4747 pa.OnCollisionUpdate -= PhysicsCollision;
4748
4749 bool hassound = ( CollisionSound != UUID.Zero && CollisionSoundVolume > 0.0f);
4750 scriptEvents CombinedEvents = AggregateScriptEvents;
4751
4752 // merge with root part
4753 if (ParentGroup != null && ParentGroup.RootPart != null)
4754 CombinedEvents |= ParentGroup.RootPart.AggregateScriptEvents;
4755
4756 // submit to this part case
4757 if (VolumeDetectActive)
4758 {
4759 CombinedEvents &= PhyscicsVolumeDtcSubsEvents;
4760 hassound = false;
4761 }
4762 else if ((Flags & PrimFlags.Phantom) != 0)
4763 CombinedEvents &= PhyscicsPhantonSubsEvents;
4764 else
4765 CombinedEvents &= PhysicsNeededSubsEvents;
4766
4767 if (hassound || CombinedEvents != 0)
4768 {
4769 // subscribe to physics updates.
4770 pa.OnCollisionUpdate += PhysicsCollision;
4771 pa.SubscribeEvents(50); // 20 reports per second
4772 }
4773 else
4774 {
4775 pa.UnSubscribeEvents();
4776 }
4777 }
4778
4779
4709 public void aggregateScriptEvents() 4780 public void aggregateScriptEvents()
4710 { 4781 {
4711 if (ParentGroup == null || ParentGroup.RootPart == null) 4782 if (ParentGroup == null || ParentGroup.RootPart == null)
@@ -4742,7 +4813,7 @@ namespace OpenSim.Region.Framework.Scenes
4742 { 4813 {
4743 objectflagupdate |= (uint) PrimFlags.AllowInventoryDrop; 4814 objectflagupdate |= (uint) PrimFlags.AllowInventoryDrop;
4744 } 4815 }
4745 4816/*
4746 PhysicsActor pa = PhysActor; 4817 PhysicsActor pa = PhysActor;
4747 if (pa != null) 4818 if (pa != null)
4748 { 4819 {
@@ -4753,7 +4824,7 @@ namespace OpenSim.Region.Framework.Scenes
4753// ((AggregateScriptEvents & scriptEvents.land_collision_start) != 0) || 4824// ((AggregateScriptEvents & scriptEvents.land_collision_start) != 0) ||
4754// ((AggregateScriptEvents & scriptEvents.land_collision) != 0) || 4825// ((AggregateScriptEvents & scriptEvents.land_collision) != 0) ||
4755// ((AggregateScriptEvents & scriptEvents.land_collision_end) != 0) || 4826// ((AggregateScriptEvents & scriptEvents.land_collision_end) != 0) ||
4756 ((AggregateScriptEvents & PhyscicsNeededSubsEvents) != 0) || ((ParentGroup.RootPart.AggregateScriptEvents & PhyscicsNeededSubsEvents) != 0) || (CollisionSound != UUID.Zero) 4827 ((AggregateScriptEvents & PhysicsNeededSubsEvents) != 0) || ((ParentGroup.RootPart.AggregateScriptEvents & PhysicsNeededSubsEvents) != 0) || (CollisionSound != UUID.Zero)
4757 ) 4828 )
4758 { 4829 {
4759 // subscribe to physics updates. 4830 // subscribe to physics updates.
@@ -4766,6 +4837,9 @@ namespace OpenSim.Region.Framework.Scenes
4766 pa.OnCollisionUpdate -= PhysicsCollision; 4837 pa.OnCollisionUpdate -= PhysicsCollision;
4767 } 4838 }
4768 } 4839 }
4840 */
4841 UpdatePhysicsSubscribedEvents();
4842
4769 //if ((GetEffectiveObjectFlags() & (uint)PrimFlags.Scripted) != 0) 4843 //if ((GetEffectiveObjectFlags() & (uint)PrimFlags.Scripted) != 0)
4770 //{ 4844 //{
4771 // ParentGroup.Scene.EventManager.OnScriptTimerEvent += handleTimerAccounting; 4845 // ParentGroup.Scene.EventManager.OnScriptTimerEvent += handleTimerAccounting;
diff --git a/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs
index 87a7e51..5db4f17 100644
--- a/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs
+++ b/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs
@@ -194,8 +194,10 @@ namespace OpenSim.Region.Physics.OdePlugin
194 public int givefakeori = 0; 194 public int givefakeori = 0;
195 private Quaternion fakeori; 195 private Quaternion fakeori;
196 196
197 public int m_eventsubscription; 197 private int m_eventsubscription;
198 private CollisionEventUpdate CollisionEventsThisFrame = new CollisionEventUpdate(); 198 private int m_cureventsubscription;
199 private CollisionEventUpdate CollisionEventsThisFrame = null;
200 private bool SentEmptyCollisionsEvent;
199 201
200 public volatile bool childPrim; 202 public volatile bool childPrim;
201 203
@@ -931,12 +933,21 @@ namespace OpenSim.Region.Physics.OdePlugin
931 public override void SubscribeEvents(int ms) 933 public override void SubscribeEvents(int ms)
932 { 934 {
933 m_eventsubscription = ms; 935 m_eventsubscription = ms;
936 m_cureventsubscription = 0;
937 if (CollisionEventsThisFrame == null)
938 CollisionEventsThisFrame = new CollisionEventUpdate();
939 SentEmptyCollisionsEvent = false;
934 _parent_scene.AddCollisionEventReporting(this); 940 _parent_scene.AddCollisionEventReporting(this);
935 } 941 }
936 942
937 public override void UnSubscribeEvents() 943 public override void UnSubscribeEvents()
938 { 944 {
939 _parent_scene.RemoveCollisionEventReporting(this); 945 _parent_scene.RemoveCollisionEventReporting(this);
946 if (CollisionEventsThisFrame != null)
947 {
948 CollisionEventsThisFrame.Clear();
949 CollisionEventsThisFrame = null;
950 }
940 m_eventsubscription = 0; 951 m_eventsubscription = 0;
941 } 952 }
942 953
@@ -944,7 +955,6 @@ namespace OpenSim.Region.Physics.OdePlugin
944 { 955 {
945 if (CollisionEventsThisFrame == null) 956 if (CollisionEventsThisFrame == null)
946 CollisionEventsThisFrame = new CollisionEventUpdate(); 957 CollisionEventsThisFrame = new CollisionEventUpdate();
947
948 CollisionEventsThisFrame.AddCollider(CollidedWith, contact); 958 CollisionEventsThisFrame.AddCollider(CollidedWith, contact);
949 } 959 }
950 960
@@ -953,14 +963,34 @@ namespace OpenSim.Region.Physics.OdePlugin
953 if (CollisionEventsThisFrame == null) 963 if (CollisionEventsThisFrame == null)
954 return; 964 return;
955 965
956 base.SendCollisionUpdate(CollisionEventsThisFrame); 966 if (m_cureventsubscription < m_eventsubscription)
967 return;
957 968
958 if (CollisionEventsThisFrame.m_objCollisionList.Count == 0) 969 m_cureventsubscription = 0;
959 CollisionEventsThisFrame = null; 970
960 else 971 int ncolisions = CollisionEventsThisFrame.m_objCollisionList.Count;
961 CollisionEventsThisFrame = new CollisionEventUpdate(); 972
973 if (!SentEmptyCollisionsEvent || ncolisions > 0)
974 {
975 base.SendCollisionUpdate(CollisionEventsThisFrame);
976
977 if (ncolisions == 0)
978 SentEmptyCollisionsEvent = true;
979 else
980 {
981 SentEmptyCollisionsEvent = false;
982 CollisionEventsThisFrame.Clear();
983 }
984 }
962 } 985 }
963 986
987 internal void AddCollisionFrameTime(int t)
988 {
989 // protect it from overflow crashing
990 if (m_cureventsubscription + t >= int.MaxValue)
991 m_cureventsubscription = 0;
992 m_cureventsubscription += t;
993 }
964 public override bool SubscribedEvents() 994 public override bool SubscribedEvents()
965 { 995 {
966 if (m_eventsubscription > 0) 996 if (m_eventsubscription > 0)
diff --git a/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs b/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs
index 7367719..ddfdea4 100644
--- a/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs
+++ b/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs
@@ -620,8 +620,6 @@ namespace OpenSim.Region.Physics.OdePlugin
620 return d.JointCreateContactPtr(world, contactgroup, contact); 620 return d.JointCreateContactPtr(world, contactgroup, contact);
621 } 621 }
622 622
623
624
625 private bool GetCurContactGeom(int index, ref d.ContactGeom newcontactgeom) 623 private bool GetCurContactGeom(int index, ref d.ContactGeom newcontactgeom)
626 { 624 {
627 if (ContactgeomsArray == IntPtr.Zero || index >= contactsPerCollision) 625 if (ContactgeomsArray == IntPtr.Zero || index >= contactsPerCollision)
@@ -1153,6 +1151,31 @@ namespace OpenSim.Region.Physics.OdePlugin
1153 } 1151 }
1154 } 1152 }
1155 break; 1153 break;
1154 case ActorTypes.Ground:
1155 case ActorTypes.Unknown:
1156 default:
1157 switch ((ActorTypes)p2.PhysicsActorType)
1158 {
1159 case ActorTypes.Agent:
1160 if (p2 is OdeCharacter)
1161 {
1162 cc2 = (OdeCharacter)p2;
1163 obj2LocalID = cc2.m_localID;
1164 if (p2events)
1165 cc2.AddCollisionEvent(0, contact);
1166 }
1167 break;
1168 case ActorTypes.Prim:
1169 if (p2 is OdePrim)
1170 {
1171 cp2 = (OdePrim)p2;
1172 obj2LocalID = cp2.m_localID;
1173 if (p2events)
1174 cp2.AddCollisionEvent(0, contact);
1175 }
1176 break;
1177 }
1178 break;
1156 } 1179 }
1157 } 1180 }
1158 1181
@@ -1875,7 +1898,11 @@ namespace OpenSim.Region.Physics.OdePlugin
1875 1898
1876 case ActorTypes.Prim: 1899 case ActorTypes.Prim:
1877 OdePrim pobj = (OdePrim)obj; 1900 OdePrim pobj = (OdePrim)obj;
1878 pobj.SendCollisions(); 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 }
1879 break; 1906 break;
1880 } 1907 }
1881 } 1908 }
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 8072e72..c7e59ac 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -10366,7 +10366,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
10366 } 10366 }
10367 m_host.TaskInventory.LockItemsForRead(false); 10367 m_host.TaskInventory.LockItemsForRead(false);
10368 10368
10369 ScenePresence presence = World.GetScenePresence(m_host.OwnerID); 10369// ScenePresence presence = World.GetScenePresence(m_host.OwnerID);
10370 ScenePresence presence = World.GetScenePresence(agentID);
10370 if (presence != null) 10371 if (presence != null)
10371 { 10372 {
10372 LSL_Vector pos = new LSL_Vector(presence.CameraPosition.X, presence.CameraPosition.Y, presence.CameraPosition.Z); 10373 LSL_Vector pos = new LSL_Vector(presence.CameraPosition.X, presence.CameraPosition.Y, presence.CameraPosition.Z);
@@ -10389,7 +10390,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
10389 } 10390 }
10390 m_host.TaskInventory.LockItemsForRead(false); 10391 m_host.TaskInventory.LockItemsForRead(false);
10391 10392
10392 ScenePresence presence = World.GetScenePresence(m_host.OwnerID); 10393// ScenePresence presence = World.GetScenePresence(m_host.OwnerID);
10394 ScenePresence presence = World.GetScenePresence(agentID);
10393 if (presence != null) 10395 if (presence != null)
10394 { 10396 {
10395 return new LSL_Rotation(presence.CameraRotation.X, presence.CameraRotation.Y, presence.CameraRotation.Z, presence.CameraRotation.W); 10397 return new LSL_Rotation(presence.CameraRotation.X, presence.CameraRotation.Y, presence.CameraRotation.Z, presence.CameraRotation.W);