diff options
author | Melanie | 2012-07-16 22:22:42 +0100 |
---|---|---|
committer | Melanie | 2012-07-16 22:22:42 +0100 |
commit | c256447f46db1738131763960c9394f03b072c46 (patch) | |
tree | 277255a693b3ce62366816338482a602d7d979bf /OpenSim/Region | |
parent | Merge branch 'master' into careminster (diff) | |
parent | Allow setting linked avatar positions from within a prim not the one sat on (diff) | |
download | opensim-SC-c256447f46db1738131763960c9394f03b072c46.zip opensim-SC-c256447f46db1738131763960c9394f03b072c46.tar.gz opensim-SC-c256447f46db1738131763960c9394f03b072c46.tar.bz2 opensim-SC-c256447f46db1738131763960c9394f03b072c46.tar.xz |
Merge branch 'avination' into careminster
Conflicts:
OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs
OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
OpenSim/Region/Framework/Scenes/Scene.cs
Diffstat (limited to '')
12 files changed, 201 insertions, 201 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index bcb45cf..79e35f4 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs | |||
@@ -155,6 +155,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
155 | /// <summary>Flag to signal when clients should send pings</summary> | 155 | /// <summary>Flag to signal when clients should send pings</summary> |
156 | protected bool m_sendPing; | 156 | protected bool m_sendPing; |
157 | 157 | ||
158 | private ExpiringCache<IPEndPoint, Queue<UDPPacketBuffer>> m_pendingCache = new ExpiringCache<IPEndPoint, Queue<UDPPacketBuffer>>(); | ||
159 | |||
158 | private int m_defaultRTO = 0; | 160 | private int m_defaultRTO = 0; |
159 | private int m_maxRTO = 0; | 161 | private int m_maxRTO = 0; |
160 | private int m_ackTimeout = 0; | 162 | private int m_ackTimeout = 0; |
@@ -765,21 +767,46 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
765 | 767 | ||
766 | #region Packet to Client Mapping | 768 | #region Packet to Client Mapping |
767 | 769 | ||
768 | // UseCircuitCode handling | 770 | // If there is already a client for this endpoint, don't process UseCircuitCode |
769 | if (packet.Type == PacketType.UseCircuitCode) | 771 | IClientAPI client = null; |
772 | if (!m_scene.TryGetClient(address, out client)) | ||
770 | { | 773 | { |
771 | object[] array = new object[] { buffer, packet }; | 774 | // UseCircuitCode handling |
775 | if (packet.Type == PacketType.UseCircuitCode) | ||
776 | { | ||
777 | // And if there is a UseCircuitCode pending, also drop it | ||
778 | lock (m_pendingCache) | ||
779 | { | ||
780 | if (m_pendingCache.Contains(address)) | ||
781 | return; | ||
772 | 782 | ||
773 | Util.FireAndForget(HandleUseCircuitCode, array); | 783 | m_pendingCache.AddOrUpdate(address, new Queue<UDPPacketBuffer>(), 60); |
784 | } | ||
774 | 785 | ||
775 | return; | 786 | object[] array = new object[] { buffer, packet }; |
787 | |||
788 | Util.FireAndForget(HandleUseCircuitCode, array); | ||
789 | |||
790 | return; | ||
791 | } | ||
792 | } | ||
793 | |||
794 | // If this is a pending connection, enqueue, don't process yet | ||
795 | lock (m_pendingCache) | ||
796 | { | ||
797 | Queue<UDPPacketBuffer> queue; | ||
798 | if (m_pendingCache.TryGetValue(address, out queue)) | ||
799 | { | ||
800 | //m_log.DebugFormat("[LLUDPSERVER]: Enqueued a {0} packet into the pending queue", packet.Type); | ||
801 | queue.Enqueue(buffer); | ||
802 | return; | ||
803 | } | ||
776 | } | 804 | } |
777 | 805 | ||
778 | // Determine which agent this packet came from | 806 | // Determine which agent this packet came from |
779 | IClientAPI client; | 807 | if (client == null || !(client is LLClientView)) |
780 | if (!m_scene.TryGetClient(address, out client) || !(client is LLClientView)) | ||
781 | { | 808 | { |
782 | // m_log.Debug("[LLUDPSERVER]: Received a " + packet.Type + " packet from an unrecognized source: " + address + " in " + m_scene.RegionInfo.RegionName); | 809 | //m_log.Debug("[LLUDPSERVER]: Received a " + packet.Type + " packet from an unrecognized source: " + address + " in " + m_scene.RegionInfo.RegionName); |
783 | return; | 810 | return; |
784 | } | 811 | } |
785 | 812 | ||
@@ -1014,6 +1041,32 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1014 | // We only want to send initial data to new clients, not ones which are being converted from child to root. | 1041 | // We only want to send initial data to new clients, not ones which are being converted from child to root. |
1015 | if (client != null) | 1042 | if (client != null) |
1016 | client.SceneAgent.SendInitialDataToMe(); | 1043 | client.SceneAgent.SendInitialDataToMe(); |
1044 | |||
1045 | // Now we know we can handle more data | ||
1046 | Thread.Sleep(200); | ||
1047 | |||
1048 | // Obtain the queue and remove it from the cache | ||
1049 | Queue<UDPPacketBuffer> queue = null; | ||
1050 | |||
1051 | lock (m_pendingCache) | ||
1052 | { | ||
1053 | if (!m_pendingCache.TryGetValue(remoteEndPoint, out queue)) | ||
1054 | { | ||
1055 | m_log.DebugFormat("[LLUDPSERVER]: Client created but no pending queue present"); | ||
1056 | return; | ||
1057 | } | ||
1058 | m_pendingCache.Remove(remoteEndPoint); | ||
1059 | } | ||
1060 | |||
1061 | m_log.DebugFormat("[LLUDPSERVER]: Client created, processing pending queue, {0} entries", queue.Count); | ||
1062 | |||
1063 | // Reinject queued packets | ||
1064 | while(queue.Count > 0) | ||
1065 | { | ||
1066 | UDPPacketBuffer buf = queue.Dequeue(); | ||
1067 | PacketReceived(buf); | ||
1068 | } | ||
1069 | queue = null; | ||
1017 | } | 1070 | } |
1018 | else | 1071 | else |
1019 | { | 1072 | { |
@@ -1021,6 +1074,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1021 | m_log.WarnFormat( | 1074 | m_log.WarnFormat( |
1022 | "[LLUDPSERVER]: Ignoring connection request for {0} to {1} with unknown circuit code {2} from IP {3}", | 1075 | "[LLUDPSERVER]: Ignoring connection request for {0} to {1} with unknown circuit code {2} from IP {3}", |
1023 | uccp.CircuitCode.ID, m_scene.RegionInfo.RegionName, uccp.CircuitCode.Code, remoteEndPoint); | 1076 | uccp.CircuitCode.ID, m_scene.RegionInfo.RegionName, uccp.CircuitCode.Code, remoteEndPoint); |
1077 | lock (m_pendingCache) | ||
1078 | m_pendingCache.Remove(remoteEndPoint); | ||
1024 | } | 1079 | } |
1025 | 1080 | ||
1026 | // m_log.DebugFormat( | 1081 | // m_log.DebugFormat( |
diff --git a/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs b/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs index 7f2f147..f4a89bd 100644 --- a/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs | |||
@@ -215,7 +215,7 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp | |||
215 | engine.PostScriptEvent(itemID, "http_request", new Object[] { urlcode.ToString(), "URL_REQUEST_DENIED", "" }); | 215 | engine.PostScriptEvent(itemID, "http_request", new Object[] { urlcode.ToString(), "URL_REQUEST_DENIED", "" }); |
216 | return urlcode; | 216 | return urlcode; |
217 | } | 217 | } |
218 | string url = "https://" + m_ExternalHostNameForLSL + ":" + m_HttpsServer.Port.ToString() + "/lslhttps/" + urlcode.ToString() + "/"; | 218 | string url = "https://" + m_ExternalHostNameForLSL + ":" + m_HttpsServer.Port.ToString() + "/lslhttps/" + urlcode.ToString(); |
219 | 219 | ||
220 | UrlData urlData = new UrlData(); | 220 | UrlData urlData = new UrlData(); |
221 | urlData.hostID = host.UUID; | 221 | urlData.hostID = host.UUID; |
@@ -228,11 +228,11 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp | |||
228 | 228 | ||
229 | m_UrlMap[url] = urlData; | 229 | m_UrlMap[url] = urlData; |
230 | 230 | ||
231 | string uri = "/lslhttps/" + urlcode.ToString() + "/"; | 231 | string uri = "/lslhttps/" + urlcode.ToString(); |
232 | 232 | ||
233 | m_HttpsServer.AddPollServiceHTTPHandler( | 233 | PollServiceEventArgs args = new PollServiceEventArgs(HttpRequestHandler, HasEvents, GetEvents, NoEvents, urlcode, 25000); |
234 | uri, | 234 | args.Type = PollServiceEventArgs.EventType.LslHttp; |
235 | new PollServiceEventArgs(HttpRequestHandler, HasEvents, GetEvents, NoEvents, urlcode,25000)); | 235 | m_HttpsServer.AddPollServiceHTTPHandler(uri, args); |
236 | 236 | ||
237 | m_log.DebugFormat( | 237 | m_log.DebugFormat( |
238 | "[URL MODULE]: Set up incoming secure request url {0} for {1} in {2} {3}", | 238 | "[URL MODULE]: Set up incoming secure request url {0} for {1} in {2} {3}", |
diff --git a/OpenSim/Region/Framework/Scenes/SOPVehicle.cs b/OpenSim/Region/Framework/Scenes/SOPVehicle.cs index 41e8944..9cb901a 100644 --- a/OpenSim/Region/Framework/Scenes/SOPVehicle.cs +++ b/OpenSim/Region/Framework/Scenes/SOPVehicle.cs | |||
@@ -36,7 +36,6 @@ using System.Xml; | |||
36 | using OpenSim.Framework.Serialization; | 36 | using OpenSim.Framework.Serialization; |
37 | using OpenSim.Framework.Serialization.External; | 37 | using OpenSim.Framework.Serialization.External; |
38 | using OpenSim.Region.Framework.Scenes.Serialization; | 38 | using OpenSim.Region.Framework.Scenes.Serialization; |
39 | using OpenSim.Region.Framework.Scenes.Serialization; | ||
40 | 39 | ||
41 | namespace OpenSim.Region.Framework.Scenes | 40 | namespace OpenSim.Region.Framework.Scenes |
42 | { | 41 | { |
@@ -215,7 +214,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
215 | switch (pParam) | 214 | switch (pParam) |
216 | { | 215 | { |
217 | case Vehicle.REFERENCE_FRAME: | 216 | case Vehicle.REFERENCE_FRAME: |
218 | vd.m_referenceFrame = Quaternion.Inverse(pValue); | 217 | vd.m_referenceFrame = pValue; |
219 | break; | 218 | break; |
220 | } | 219 | } |
221 | }//end ProcessRotationVehicleParam | 220 | }//end ProcessRotationVehicleParam |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 19f319c..f437bc8 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -879,6 +879,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
879 | StatsReporter = new SimStatsReporter(this); | 879 | StatsReporter = new SimStatsReporter(this); |
880 | StatsReporter.OnSendStatsResult += SendSimStatsPackets; | 880 | StatsReporter.OnSendStatsResult += SendSimStatsPackets; |
881 | StatsReporter.OnStatsIncorrect += m_sceneGraph.RecalculateStats; | 881 | StatsReporter.OnStatsIncorrect += m_sceneGraph.RecalculateStats; |
882 | |||
883 | MainConsole.Instance.Commands.AddCommand("scene", false, "gc collect", "gc collect", "gc collect", "Cause the garbage collector to make a single pass", HandleGcCollect); | ||
882 | } | 884 | } |
883 | 885 | ||
884 | public Scene(RegionInfo regInfo) : base(regInfo) | 886 | public Scene(RegionInfo regInfo) : base(regInfo) |
@@ -5773,5 +5775,10 @@ Environment.Exit(1); | |||
5773 | m_SpawnPoint = 1; | 5775 | m_SpawnPoint = 1; |
5774 | return m_SpawnPoint - 1; | 5776 | return m_SpawnPoint - 1; |
5775 | } | 5777 | } |
5778 | |||
5779 | private void HandleGcCollect(string module, string[] args) | ||
5780 | { | ||
5781 | GC.Collect(); | ||
5782 | } | ||
5776 | } | 5783 | } |
5777 | } | 5784 | } |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 33a2cc5..f1f94a7 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |||
@@ -2061,8 +2061,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
2061 | HasGroupChangedDueToDelink = false; | 2061 | HasGroupChangedDueToDelink = false; |
2062 | 2062 | ||
2063 | m_scene.EventManager.TriggerOnSceneObjectPreSave(backup_group, this); | 2063 | m_scene.EventManager.TriggerOnSceneObjectPreSave(backup_group, this); |
2064 | datastore.StoreObject(backup_group, m_scene.RegionInfo.RegionID); | ||
2065 | |||
2066 | backup_group.ForEachPart(delegate(SceneObjectPart part) | 2064 | backup_group.ForEachPart(delegate(SceneObjectPart part) |
2067 | { | 2065 | { |
2068 | if (part.KeyframeMotion != null) | 2066 | if (part.KeyframeMotion != null) |
@@ -2070,6 +2068,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
2070 | part.KeyframeMotion = KeyframeMotion.FromData(backup_group, part.KeyframeMotion.Serialize()); | 2068 | part.KeyframeMotion = KeyframeMotion.FromData(backup_group, part.KeyframeMotion.Serialize()); |
2071 | part.KeyframeMotion.UpdateSceneObject(this); | 2069 | part.KeyframeMotion.UpdateSceneObject(this); |
2072 | } | 2070 | } |
2071 | }); | ||
2072 | |||
2073 | datastore.StoreObject(backup_group, m_scene.RegionInfo.RegionID); | ||
2074 | |||
2075 | backup_group.ForEachPart(delegate(SceneObjectPart part) | ||
2076 | { | ||
2073 | part.Inventory.ProcessInventoryBackup(datastore); | 2077 | part.Inventory.ProcessInventoryBackup(datastore); |
2074 | }); | 2078 | }); |
2075 | 2079 | ||
diff --git a/OpenSim/Region/Physics/UbitOdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/UbitOdePlugin/ODECharacter.cs index 865180f..b506b1c 100644 --- a/OpenSim/Region/Physics/UbitOdePlugin/ODECharacter.cs +++ b/OpenSim/Region/Physics/UbitOdePlugin/ODECharacter.cs | |||
@@ -95,7 +95,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
95 | private bool m_iscollidingObj = false; | 95 | private bool m_iscollidingObj = false; |
96 | private bool m_alwaysRun = false; | 96 | private bool m_alwaysRun = false; |
97 | private int m_requestedUpdateFrequency = 0; | 97 | private int m_requestedUpdateFrequency = 0; |
98 | public uint m_localID = 0; | 98 | private uint m_localID = 0; |
99 | public bool m_returnCollisions = false; | 99 | public bool m_returnCollisions = false; |
100 | // taints and their non-tainted counterparts | 100 | // taints and their non-tainted counterparts |
101 | public bool m_isPhysical = false; // the current physical status | 101 | public bool m_isPhysical = false; // the current physical status |
@@ -214,6 +214,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
214 | 214 | ||
215 | public override uint LocalID | 215 | public override uint LocalID |
216 | { | 216 | { |
217 | get { return m_localID; } | ||
217 | set { m_localID = value; } | 218 | set { m_localID = value; } |
218 | } | 219 | } |
219 | 220 | ||
diff --git a/OpenSim/Region/Physics/UbitOdePlugin/ODEDynamics.cs b/OpenSim/Region/Physics/UbitOdePlugin/ODEDynamics.cs index e900c02..a7dda7a 100644 --- a/OpenSim/Region/Physics/UbitOdePlugin/ODEDynamics.cs +++ b/OpenSim/Region/Physics/UbitOdePlugin/ODEDynamics.cs | |||
@@ -425,7 +425,8 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
425 | switch (pParam) | 425 | switch (pParam) |
426 | { | 426 | { |
427 | case Vehicle.REFERENCE_FRAME: | 427 | case Vehicle.REFERENCE_FRAME: |
428 | m_referenceFrame = Quaternion.Inverse(pValue); | 428 | // m_referenceFrame = Quaternion.Inverse(pValue); |
429 | m_referenceFrame = pValue; | ||
429 | break; | 430 | break; |
430 | case Vehicle.ROLL_FRAME: | 431 | case Vehicle.ROLL_FRAME: |
431 | m_RollreferenceFrame = pValue; | 432 | m_RollreferenceFrame = pValue; |
diff --git a/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs index ff17a6e..6d322e2 100644 --- a/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs +++ b/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs | |||
@@ -101,7 +101,6 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
101 | private float m_invTimeStep = 50.0f; | 101 | private float m_invTimeStep = 50.0f; |
102 | private float m_timeStep = .02f; | 102 | private float m_timeStep = .02f; |
103 | 103 | ||
104 | |||
105 | private Vector3 m_PIDTarget; | 104 | private Vector3 m_PIDTarget; |
106 | private float m_PIDTau; | 105 | private float m_PIDTau; |
107 | private bool m_usePID; | 106 | private bool m_usePID; |
@@ -119,7 +118,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
119 | private float m_buoyancy; //KF: m_buoyancy should be set by llSetBuoyancy() for non-vehicle. | 118 | private float m_buoyancy; //KF: m_buoyancy should be set by llSetBuoyancy() for non-vehicle. |
120 | 119 | ||
121 | private int body_autodisable_frames = 5; | 120 | private int body_autodisable_frames = 5; |
122 | private int bodydisablecontrol = 0; | 121 | public int bodydisablecontrol = 0; |
123 | 122 | ||
124 | 123 | ||
125 | // Default we're a Geometry | 124 | // Default we're a Geometry |
@@ -134,7 +133,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
134 | 133 | ||
135 | // private bool m_collidesLand = true; | 134 | // private bool m_collidesLand = true; |
136 | private bool m_collidesWater; | 135 | private bool m_collidesWater; |
137 | public bool m_returnCollisions; | 136 | // public bool m_returnCollisions; |
138 | 137 | ||
139 | private bool m_NoColide; // for now only for internal use for bad meshs | 138 | private bool m_NoColide; // for now only for internal use for bad meshs |
140 | 139 | ||
@@ -144,7 +143,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
144 | 143 | ||
145 | public bool m_disabled; | 144 | public bool m_disabled; |
146 | 145 | ||
147 | public uint m_localID; | 146 | private uint m_localID; |
148 | 147 | ||
149 | private IMesh m_mesh; | 148 | private IMesh m_mesh; |
150 | private object m_meshlock = new object(); | 149 | private object m_meshlock = new object(); |
@@ -164,10 +163,10 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
164 | private List<OdePrim> childrenPrim = new List<OdePrim>(); | 163 | private List<OdePrim> childrenPrim = new List<OdePrim>(); |
165 | 164 | ||
166 | 165 | ||
167 | private bool m_throttleUpdates; | 166 | // private bool m_throttleUpdates; |
168 | private int throttleCounter; | 167 | // private int throttleCounter; |
169 | public float m_collisionscore; | 168 | public float m_collisionscore; |
170 | int m_colliderfilter = 0; | 169 | private int m_colliderfilter = 0; |
171 | 170 | ||
172 | public IntPtr collide_geom; // for objects: geom if single prim space it linkset | 171 | public IntPtr collide_geom; // for objects: geom if single prim space it linkset |
173 | 172 | ||
@@ -235,7 +234,6 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
235 | } | 234 | } |
236 | } | 235 | } |
237 | 236 | ||
238 | |||
239 | public override bool Phantom // this is not reliable for internal use | 237 | public override bool Phantom // this is not reliable for internal use |
240 | { | 238 | { |
241 | get { return m_fakeisphantom; } | 239 | get { return m_fakeisphantom; } |
@@ -293,14 +291,18 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
293 | 291 | ||
294 | public override uint LocalID | 292 | public override uint LocalID |
295 | { | 293 | { |
294 | get { return m_localID; } | ||
295 | set { m_localID = value; } | ||
296 | } | ||
297 | |||
298 | public OdePrim Parent | ||
299 | { | ||
296 | get | 300 | get |
297 | { | 301 | { |
298 | return m_localID; | 302 | if (childPrim) |
299 | } | 303 | return (OdePrim)_parent; |
300 | set | 304 | else |
301 | { | 305 | return this; |
302 | //m_log.Info("[PHYSICS]: Setting TrackerID: " + value); | ||
303 | m_localID = value; | ||
304 | } | 306 | } |
305 | } | 307 | } |
306 | 308 | ||
@@ -363,12 +365,14 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
363 | set { return; } | 365 | set { return; } |
364 | } | 366 | } |
365 | 367 | ||
366 | public override bool ThrottleUpdates | 368 | |
369 | public override bool ThrottleUpdates {get;set;} | ||
370 | /* | ||
367 | { | 371 | { |
368 | get { return m_throttleUpdates; } | 372 | get { return m_throttleUpdates; } |
369 | set { m_throttleUpdates = value; } | 373 | set { m_throttleUpdates = value; } |
370 | } | 374 | } |
371 | 375 | */ | |
372 | public override bool Stopped | 376 | public override bool Stopped |
373 | { | 377 | { |
374 | get { return _zeroFlag; } | 378 | get { return _zeroFlag; } |
@@ -943,15 +947,15 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
943 | CollisionEventsThisFrame = null; | 947 | CollisionEventsThisFrame = null; |
944 | } | 948 | } |
945 | m_eventsubscription = 0; | 949 | m_eventsubscription = 0; |
946 | // for now still done on odescene | 950 | _parent_scene.RemoveCollisionEventReporting(this); |
947 | // _parent_scene.RemoveCollisionEventReporting(this); | ||
948 | } | 951 | } |
949 | 952 | ||
950 | public void AddCollisionEvent(uint CollidedWith, ContactPoint contact) | 953 | public void AddCollisionEvent(uint CollidedWith, ContactPoint contact) |
951 | { | 954 | { |
952 | if (CollisionEventsThisFrame == null) | 955 | if (CollisionEventsThisFrame == null) |
953 | CollisionEventsThisFrame = new CollisionEventUpdate(); | 956 | CollisionEventsThisFrame = new CollisionEventUpdate(); |
954 | CollisionEventsThisFrame.AddCollider(CollidedWith, contact); | 957 | // if(CollisionEventsThisFrame.Count < 32) |
958 | CollisionEventsThisFrame.AddCollider(CollidedWith, contact); | ||
955 | } | 959 | } |
956 | 960 | ||
957 | public void SendCollisions() | 961 | public void SendCollisions() |
@@ -1746,8 +1750,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1746 | if (childrenPrim.Count == 0) | 1750 | if (childrenPrim.Count == 0) |
1747 | { | 1751 | { |
1748 | collide_geom = prim_geom; | 1752 | collide_geom = prim_geom; |
1749 | m_targetSpace = _parent_scene.ActiveSpace; | 1753 | m_targetSpace = _parent_scene.ActiveSpace; |
1750 | d.SpaceAdd(m_targetSpace, prim_geom); | ||
1751 | } | 1754 | } |
1752 | else | 1755 | else |
1753 | { | 1756 | { |
@@ -1755,7 +1758,6 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1755 | d.HashSpaceSetLevels(m_targetSpace, -2, 8); | 1758 | d.HashSpaceSetLevels(m_targetSpace, -2, 8); |
1756 | d.SpaceSetSublevel(m_targetSpace, 3); | 1759 | d.SpaceSetSublevel(m_targetSpace, 3); |
1757 | d.SpaceSetCleanup(m_targetSpace, false); | 1760 | d.SpaceSetCleanup(m_targetSpace, false); |
1758 | d.SpaceAdd(m_targetSpace, prim_geom); | ||
1759 | 1761 | ||
1760 | d.GeomSetCategoryBits(m_targetSpace, (uint)(CollisionCategories.Space | | 1762 | d.GeomSetCategoryBits(m_targetSpace, (uint)(CollisionCategories.Space | |
1761 | CollisionCategories.Geom | | 1763 | CollisionCategories.Geom | |
@@ -1766,12 +1768,21 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1766 | collide_geom = m_targetSpace; | 1768 | collide_geom = m_targetSpace; |
1767 | } | 1769 | } |
1768 | 1770 | ||
1771 | d.SpaceAdd(m_targetSpace, prim_geom); | ||
1772 | |||
1769 | if (m_delaySelect) | 1773 | if (m_delaySelect) |
1770 | { | 1774 | { |
1771 | m_isSelected = true; | 1775 | m_isSelected = true; |
1772 | m_delaySelect = false; | 1776 | m_delaySelect = false; |
1773 | } | 1777 | } |
1774 | 1778 | ||
1779 | m_collisionscore = 0; | ||
1780 | |||
1781 | UpdateCollisionCatFlags(); | ||
1782 | ApplyCollisionCatFlags(); | ||
1783 | |||
1784 | _parent_scene.addActivePrim(this); | ||
1785 | |||
1775 | lock (childrenPrim) | 1786 | lock (childrenPrim) |
1776 | { | 1787 | { |
1777 | foreach (OdePrim prm in childrenPrim) | 1788 | foreach (OdePrim prm in childrenPrim) |
@@ -1809,10 +1820,6 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1809 | createAMotor(m_angularlock); | 1820 | createAMotor(m_angularlock); |
1810 | } | 1821 | } |
1811 | 1822 | ||
1812 | m_collisionscore = 0; | ||
1813 | |||
1814 | UpdateCollisionCatFlags(); | ||
1815 | ApplyCollisionCatFlags(); | ||
1816 | 1823 | ||
1817 | if (m_isSelected || m_disabled) | 1824 | if (m_isSelected || m_disabled) |
1818 | { | 1825 | { |
@@ -1822,9 +1829,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1822 | { | 1829 | { |
1823 | d.BodySetAngularVel(Body, m_rotationalVelocity.X, m_rotationalVelocity.Y, m_rotationalVelocity.Z); | 1830 | d.BodySetAngularVel(Body, m_rotationalVelocity.X, m_rotationalVelocity.Y, m_rotationalVelocity.Z); |
1824 | d.BodySetLinearVel(Body, _velocity.X, _velocity.Y, _velocity.Z); | 1831 | d.BodySetLinearVel(Body, _velocity.X, _velocity.Y, _velocity.Z); |
1825 | } | 1832 | } |
1826 | |||
1827 | _parent_scene.addActivePrim(this); | ||
1828 | _parent_scene.addActiveGroups(this); | 1833 | _parent_scene.addActiveGroups(this); |
1829 | } | 1834 | } |
1830 | 1835 | ||
@@ -3441,92 +3446,14 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
3441 | if (++bodydisablecontrol < 20) | 3446 | if (++bodydisablecontrol < 20) |
3442 | return; | 3447 | return; |
3443 | 3448 | ||
3444 | bodydisablecontrol = 0; | 3449 | |
3445 | d.BodyEnable(Body); | 3450 | d.BodyEnable(Body); |
3446 | } | 3451 | } |
3447 | 3452 | ||
3448 | d.Vector3 lpos = d.GeomGetPosition(prim_geom); // root position that is seem by rest of simulator | 3453 | bodydisablecontrol = 0; |
3449 | |||
3450 | /* moved down to UpdateMove... where it belongs again | ||
3451 | |||
3452 | // check outside region | ||
3453 | |||
3454 | if (lpos.Z < -100 || lpos.Z > 100000f) | ||
3455 | { | ||
3456 | m_outbounds = true; | ||
3457 | |||
3458 | lpos.Z = Util.Clip(lpos.Z, -100f, 100000f); | ||
3459 | _acceleration.X = 0; | ||
3460 | _acceleration.Y = 0; | ||
3461 | _acceleration.Z = 0; | ||
3462 | |||
3463 | _velocity.X = 0; | ||
3464 | _velocity.Y = 0; | ||
3465 | _velocity.Z = 0; | ||
3466 | m_rotationalVelocity.X = 0; | ||
3467 | m_rotationalVelocity.Y = 0; | ||
3468 | m_rotationalVelocity.Z = 0; | ||
3469 | |||
3470 | d.BodySetLinearVel(Body, 0, 0, 0); // stop it | ||
3471 | d.BodySetAngularVel(Body, 0, 0, 0); // stop it | ||
3472 | d.BodySetPosition(Body, lpos.X, lpos.Y, lpos.Z); // put it somewhere | ||
3473 | m_lastposition = _position; | ||
3474 | m_lastorientation = _orientation; | ||
3475 | |||
3476 | base.RequestPhysicsterseUpdate(); | ||
3477 | |||
3478 | throttleCounter = 0; | ||
3479 | _zeroFlag = true; | ||
3480 | |||
3481 | disableBodySoft(); // disable it and colisions | ||
3482 | base.RaiseOutOfBounds(_position); | ||
3483 | return; | ||
3484 | } | ||
3485 | |||
3486 | if (lpos.X < 0f) | ||
3487 | { | ||
3488 | _position.X = Util.Clip(lpos.X, -2f, -0.1f); | ||
3489 | m_outbounds = true; | ||
3490 | } | ||
3491 | else if (lpos.X > _parent_scene.WorldExtents.X) | ||
3492 | { | ||
3493 | _position.X = Util.Clip(lpos.X, _parent_scene.WorldExtents.X + 0.1f, _parent_scene.WorldExtents.X + 2f); | ||
3494 | m_outbounds = true; | ||
3495 | } | ||
3496 | if (lpos.Y < 0f) | ||
3497 | { | ||
3498 | _position.Y = Util.Clip(lpos.Y, -2f, -0.1f); | ||
3499 | m_outbounds = true; | ||
3500 | } | ||
3501 | else if (lpos.Y > _parent_scene.WorldExtents.Y) | ||
3502 | { | ||
3503 | _position.Y = Util.Clip(lpos.Y, _parent_scene.WorldExtents.Y + 0.1f, _parent_scene.WorldExtents.Y + 2f); | ||
3504 | m_outbounds = true; | ||
3505 | } | ||
3506 | |||
3507 | if (m_outbounds) | ||
3508 | { | ||
3509 | m_lastposition = _position; | ||
3510 | m_lastorientation = _orientation; | ||
3511 | |||
3512 | d.Vector3 dtmp = d.BodyGetAngularVel(Body); | ||
3513 | m_rotationalVelocity.X = dtmp.X; | ||
3514 | m_rotationalVelocity.Y = dtmp.Y; | ||
3515 | m_rotationalVelocity.Z = dtmp.Z; | ||
3516 | 3454 | ||
3517 | dtmp = d.BodyGetLinearVel(Body); | 3455 | d.Vector3 lpos = d.GeomGetPosition(prim_geom); // root position that is seem by rest of simulator |
3518 | _velocity.X = dtmp.X; | ||
3519 | _velocity.Y = dtmp.Y; | ||
3520 | _velocity.Z = dtmp.Z; | ||
3521 | 3456 | ||
3522 | d.BodySetLinearVel(Body, 0, 0, 0); // stop it | ||
3523 | d.BodySetAngularVel(Body, 0, 0, 0); | ||
3524 | d.GeomSetPosition(prim_geom, _position.X, _position.Y, _position.Z); | ||
3525 | disableBodySoft(); // stop collisions | ||
3526 | base.RequestPhysicsterseUpdate(); | ||
3527 | return; | ||
3528 | } | ||
3529 | */ | ||
3530 | if (m_vehicle != null && m_vehicle.Type != Vehicle.TYPE_NONE) | 3457 | if (m_vehicle != null && m_vehicle.Type != Vehicle.TYPE_NONE) |
3531 | { | 3458 | { |
3532 | // 'VEHICLES' are dealt with in ODEDynamics.cs | 3459 | // 'VEHICLES' are dealt with in ODEDynamics.cs |
@@ -3721,7 +3648,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
3721 | 3648 | ||
3722 | base.RequestPhysicsterseUpdate(); | 3649 | base.RequestPhysicsterseUpdate(); |
3723 | 3650 | ||
3724 | throttleCounter = 0; | 3651 | // throttleCounter = 0; |
3725 | _zeroFlag = true; | 3652 | _zeroFlag = true; |
3726 | 3653 | ||
3727 | disableBodySoft(); // disable it and colisions | 3654 | disableBodySoft(); // disable it and colisions |
@@ -3769,6 +3696,8 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
3769 | d.BodySetAngularVel(Body, 0, 0, 0); | 3696 | d.BodySetAngularVel(Body, 0, 0, 0); |
3770 | d.GeomSetPosition(prim_geom, _position.X, _position.Y, _position.Z); | 3697 | d.GeomSetPosition(prim_geom, _position.X, _position.Y, _position.Z); |
3771 | disableBodySoft(); // stop collisions | 3698 | disableBodySoft(); // stop collisions |
3699 | UnSubscribeEvents(); | ||
3700 | |||
3772 | base.RequestPhysicsterseUpdate(); | 3701 | base.RequestPhysicsterseUpdate(); |
3773 | return; | 3702 | return; |
3774 | } | 3703 | } |
@@ -3940,8 +3869,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
3940 | m_vehicle = null; | 3869 | m_vehicle = null; |
3941 | RemoveGeom(); | 3870 | RemoveGeom(); |
3942 | m_targetSpace = IntPtr.Zero; | 3871 | m_targetSpace = IntPtr.Zero; |
3943 | if (m_eventsubscription > 0) | 3872 | UnSubscribeEvents(); |
3944 | UnSubscribeEvents(); | ||
3945 | return true; | 3873 | return true; |
3946 | 3874 | ||
3947 | case changes.Link: | 3875 | case changes.Link: |
diff --git a/OpenSim/Region/Physics/UbitOdePlugin/ODERayCastRequestManager.cs b/OpenSim/Region/Physics/UbitOdePlugin/ODERayCastRequestManager.cs index 5122ebf..3d108f8 100644 --- a/OpenSim/Region/Physics/UbitOdePlugin/ODERayCastRequestManager.cs +++ b/OpenSim/Region/Physics/UbitOdePlugin/ODERayCastRequestManager.cs | |||
@@ -509,14 +509,14 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
509 | if ((thisFlags & CurrentRayFilter) == 0) | 509 | if ((thisFlags & CurrentRayFilter) == 0) |
510 | return; | 510 | return; |
511 | 511 | ||
512 | ID = ((OdePrim)p2).m_localID; | 512 | ID = ((OdePrim)p2).LocalID; |
513 | } | 513 | } |
514 | else if (p2 is OdeCharacter) | 514 | else if (p2 is OdeCharacter) |
515 | { | 515 | { |
516 | if ((CurrentRayFilter & RayFilterFlags.agent) == 0) | 516 | if ((CurrentRayFilter & RayFilterFlags.agent) == 0) |
517 | return; | 517 | return; |
518 | else | 518 | else |
519 | ID = ((OdeCharacter)p2).m_localID; | 519 | ID = ((OdeCharacter)p2).LocalID; |
520 | } | 520 | } |
521 | else //?? | 521 | else //?? |
522 | return; | 522 | return; |
diff --git a/OpenSim/Region/Physics/UbitOdePlugin/OdeApi.cs b/OpenSim/Region/Physics/UbitOdePlugin/OdeApi.cs index 2341186..ee48db5 100644 --- a/OpenSim/Region/Physics/UbitOdePlugin/OdeApi.cs +++ b/OpenSim/Region/Physics/UbitOdePlugin/OdeApi.cs | |||
@@ -61,6 +61,8 @@ namespace OdeAPI | |||
61 | public static int NTotalBodies = 0; | 61 | public static int NTotalBodies = 0; |
62 | public static int NTotalGeoms = 0; | 62 | public static int NTotalGeoms = 0; |
63 | 63 | ||
64 | public const uint CONTACTS_UNIMPORTANT = 0x80000000; | ||
65 | |||
64 | #region Flags and Enumerations | 66 | #region Flags and Enumerations |
65 | 67 | ||
66 | [Flags] | 68 | [Flags] |
diff --git a/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs b/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs index 7848b35..2928257 100644 --- a/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs +++ b/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs | |||
@@ -713,8 +713,18 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
713 | 713 | ||
714 | if (b1 != IntPtr.Zero && b2 != IntPtr.Zero && d.AreConnectedExcluding(b1, b2, d.JointType.Contact)) | 714 | if (b1 != IntPtr.Zero && b2 != IntPtr.Zero && d.AreConnectedExcluding(b1, b2, d.JointType.Contact)) |
715 | return; | 715 | return; |
716 | 716 | if(d.GeomGetCategoryBits(g1) == (uint)CollisionCategories.VolumeDtc || | |
717 | count = d.CollidePtr(g1, g2, (contactsPerCollision & 0xffff), ContactgeomsArray, d.ContactGeom.unmanagedSizeOf); | 717 | d.GeomGetCategoryBits(g1) == (uint)CollisionCategories.VolumeDtc) |
718 | { | ||
719 | int cflags; | ||
720 | unchecked | ||
721 | { | ||
722 | cflags = (int)(1 | d.CONTACTS_UNIMPORTANT); | ||
723 | } | ||
724 | count = d.CollidePtr(g1, g2, cflags, ContactgeomsArray, d.ContactGeom.unmanagedSizeOf); | ||
725 | } | ||
726 | else | ||
727 | count = d.CollidePtr(g1, g2, (contactsPerCollision & 0xffff), ContactgeomsArray, d.ContactGeom.unmanagedSizeOf); | ||
718 | } | 728 | } |
719 | catch (SEHException) | 729 | catch (SEHException) |
720 | { | 730 | { |
@@ -1161,6 +1171,8 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1161 | OdePrim cp1; | 1171 | OdePrim cp1; |
1162 | OdeCharacter cc2; | 1172 | OdeCharacter cc2; |
1163 | OdePrim cp2; | 1173 | OdePrim cp2; |
1174 | OdePrim cp1Parent; | ||
1175 | OdePrim cp2Parent; | ||
1164 | 1176 | ||
1165 | uint obj2LocalID = 0; | 1177 | uint obj2LocalID = 0; |
1166 | bool p1events = p1.SubscribedEvents(); | 1178 | bool p1events = p1.SubscribedEvents(); |
@@ -1197,18 +1209,19 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1197 | { | 1209 | { |
1198 | case ActorTypes.Agent: | 1210 | case ActorTypes.Agent: |
1199 | cc2 = (OdeCharacter)p2; | 1211 | cc2 = (OdeCharacter)p2; |
1200 | obj2LocalID = cc2.m_localID; | 1212 | obj2LocalID = cc2.LocalID; |
1201 | if (p2events) | 1213 | if (p2events) |
1202 | cc2.AddCollisionEvent(cc1.m_localID, contact); | 1214 | cc2.AddCollisionEvent(cc1.LocalID, contact); |
1203 | break; | 1215 | break; |
1204 | 1216 | ||
1205 | case ActorTypes.Prim: | 1217 | case ActorTypes.Prim: |
1206 | if (p2 is OdePrim) | 1218 | if (p2 is OdePrim) |
1207 | { | 1219 | { |
1208 | cp2 = (OdePrim)p2; | 1220 | cp2 = (OdePrim)p2; |
1209 | obj2LocalID = cp2.m_localID; | ||
1210 | if (p2events) | 1221 | if (p2events) |
1211 | cp2.AddCollisionEvent(cc1.m_localID, contact); | 1222 | cp2.AddCollisionEvent(cc1.LocalID, contact); |
1223 | cp2 = cp2.Parent; | ||
1224 | obj2LocalID = cp2.LocalID; | ||
1212 | } | 1225 | } |
1213 | break; | 1226 | break; |
1214 | 1227 | ||
@@ -1230,17 +1243,16 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1230 | if (p1 is OdePrim) | 1243 | if (p1 is OdePrim) |
1231 | { | 1244 | { |
1232 | cp1 = (OdePrim)p1; | 1245 | cp1 = (OdePrim)p1; |
1233 | 1246 | cp1Parent = cp1.Parent; | |
1234 | // obj1LocalID = cp2.m_localID; | ||
1235 | switch ((ActorTypes)p2.PhysicsActorType) | 1247 | switch ((ActorTypes)p2.PhysicsActorType) |
1236 | { | 1248 | { |
1237 | case ActorTypes.Agent: | 1249 | case ActorTypes.Agent: |
1238 | if (p2 is OdeCharacter) | 1250 | if (p2 is OdeCharacter) |
1239 | { | 1251 | { |
1240 | cc2 = (OdeCharacter)p2; | 1252 | cc2 = (OdeCharacter)p2; |
1241 | obj2LocalID = cc2.m_localID; | 1253 | obj2LocalID = cc2.LocalID; |
1242 | if (p2events) | 1254 | if (p2events) |
1243 | cc2.AddCollisionEvent(cp1.m_localID, contact); | 1255 | cc2.AddCollisionEvent(cp1Parent.LocalID, contact); |
1244 | } | 1256 | } |
1245 | break; | 1257 | break; |
1246 | case ActorTypes.Prim: | 1258 | case ActorTypes.Prim: |
@@ -1248,9 +1260,10 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1248 | if (p2 is OdePrim) | 1260 | if (p2 is OdePrim) |
1249 | { | 1261 | { |
1250 | cp2 = (OdePrim)p2; | 1262 | cp2 = (OdePrim)p2; |
1251 | obj2LocalID = cp2.m_localID; | ||
1252 | if (p2events) | 1263 | if (p2events) |
1253 | cp2.AddCollisionEvent(cp1.m_localID, contact); | 1264 | cp2.AddCollisionEvent(cp1Parent.LocalID, contact); |
1265 | cp2 = cp2.Parent; | ||
1266 | obj2LocalID = cp2.LocalID; | ||
1254 | } | 1267 | } |
1255 | break; | 1268 | break; |
1256 | 1269 | ||
@@ -1276,7 +1289,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1276 | if (p2 is OdeCharacter) | 1289 | if (p2 is OdeCharacter) |
1277 | { | 1290 | { |
1278 | cc2 = (OdeCharacter)p2; | 1291 | cc2 = (OdeCharacter)p2; |
1279 | obj2LocalID = cc2.m_localID; | 1292 | obj2LocalID = cc2.LocalID; |
1280 | if (p2events) | 1293 | if (p2events) |
1281 | cc2.AddCollisionEvent(0, contact); | 1294 | cc2.AddCollisionEvent(0, contact); |
1282 | } | 1295 | } |
@@ -1285,7 +1298,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1285 | if (p2 is OdePrim) | 1298 | if (p2 is OdePrim) |
1286 | { | 1299 | { |
1287 | cp2 = (OdePrim)p2; | 1300 | cp2 = (OdePrim)p2; |
1288 | obj2LocalID = cp2.m_localID; | 1301 | obj2LocalID = cp2.LocalID; |
1289 | if (p2events) | 1302 | if (p2events) |
1290 | cp2.AddCollisionEvent(0, contact); | 1303 | cp2.AddCollisionEvent(0, contact); |
1291 | } | 1304 | } |
@@ -1340,8 +1353,11 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1340 | { | 1353 | { |
1341 | foreach (OdePrim prm in _activegroups) | 1354 | foreach (OdePrim prm in _activegroups) |
1342 | { | 1355 | { |
1343 | if (d.BodyIsEnabled(prm.Body) && !prm.m_outbounds) | 1356 | if (!prm.m_outbounds) |
1344 | d.SpaceCollide2(StaticSpace, prm.collide_geom, IntPtr.Zero, nearCallback); | 1357 | { |
1358 | if (d.BodyIsEnabled(prm.Body)) | ||
1359 | d.SpaceCollide2(StaticSpace, prm.collide_geom, IntPtr.Zero, nearCallback); | ||
1360 | } | ||
1345 | } | 1361 | } |
1346 | } | 1362 | } |
1347 | catch (AccessViolationException) | 1363 | catch (AccessViolationException) |
@@ -1594,7 +1610,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1594 | //Console.WriteLine("RemovePrimThreadLocked " + prim.m_primName); | 1610 | //Console.WriteLine("RemovePrimThreadLocked " + prim.m_primName); |
1595 | lock (prim) | 1611 | lock (prim) |
1596 | { | 1612 | { |
1597 | RemoveCollisionEventReporting(prim); | 1613 | // RemoveCollisionEventReporting(prim); |
1598 | lock (_prims) | 1614 | lock (_prims) |
1599 | _prims.Remove(prim); | 1615 | _prims.Remove(prim); |
1600 | } | 1616 | } |
@@ -2002,6 +2018,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
2002 | case ActorTypes.Prim: | 2018 | case ActorTypes.Prim: |
2003 | OdePrim pobj = (OdePrim)obj; | 2019 | OdePrim pobj = (OdePrim)obj; |
2004 | if (pobj.Body == IntPtr.Zero || (d.BodyIsEnabled(pobj.Body) && !pobj.m_outbounds)) | 2020 | if (pobj.Body == IntPtr.Zero || (d.BodyIsEnabled(pobj.Body) && !pobj.m_outbounds)) |
2021 | if (!pobj.m_outbounds) | ||
2005 | { | 2022 | { |
2006 | pobj.AddCollisionFrameTime((int)(odetimestepMS)); | 2023 | pobj.AddCollisionFrameTime((int)(odetimestepMS)); |
2007 | pobj.SendCollisions(); | 2024 | pobj.SendCollisions(); |
@@ -2718,7 +2735,6 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
2718 | WaterMapHandler.Free(); | 2735 | WaterMapHandler.Free(); |
2719 | } | 2736 | } |
2720 | 2737 | ||
2721 | |||
2722 | if (ContactgeomsArray != IntPtr.Zero) | 2738 | if (ContactgeomsArray != IntPtr.Zero) |
2723 | Marshal.FreeHGlobal(ContactgeomsArray); | 2739 | Marshal.FreeHGlobal(ContactgeomsArray); |
2724 | if (GlobalContactsArray != IntPtr.Zero) | 2740 | if (GlobalContactsArray != IntPtr.Zero) |
@@ -2741,7 +2757,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
2741 | { | 2757 | { |
2742 | if (prm.CollisionScore > 0) | 2758 | if (prm.CollisionScore > 0) |
2743 | { | 2759 | { |
2744 | returncolliders.Add(prm.m_localID, prm.CollisionScore); | 2760 | returncolliders.Add(prm.LocalID, prm.CollisionScore); |
2745 | cnt++; | 2761 | cnt++; |
2746 | prm.CollisionScore = 0f; | 2762 | prm.CollisionScore = 0f; |
2747 | if (cnt > 25) | 2763 | if (cnt > 25) |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index a43a8bb..6ec3081 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -2450,8 +2450,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2450 | 2450 | ||
2451 | public LSL_Rotation llGetLocalRot() | 2451 | public LSL_Rotation llGetLocalRot() |
2452 | { | 2452 | { |
2453 | return GetPartLocalRot(m_host); | ||
2454 | } | ||
2455 | |||
2456 | private LSL_Rotation GetPartLocalRot(SceneObjectPart part) | ||
2457 | { | ||
2453 | m_host.AddScriptLPS(1); | 2458 | m_host.AddScriptLPS(1); |
2454 | Quaternion rot = m_host.RotationOffset; | 2459 | Quaternion rot = part.RotationOffset; |
2455 | return new LSL_Rotation(rot.X, rot.Y, rot.Z, rot.W); | 2460 | return new LSL_Rotation(rot.X, rot.Y, rot.Z, rot.W); |
2456 | } | 2461 | } |
2457 | 2462 | ||
@@ -3708,7 +3713,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3708 | 3713 | ||
3709 | protected void TargetOmega(SceneObjectPart part, LSL_Vector axis, double spinrate, double gain) | 3714 | protected void TargetOmega(SceneObjectPart part, LSL_Vector axis, double spinrate, double gain) |
3710 | { | 3715 | { |
3711 | spinrate *= gain; | ||
3712 | part.UpdateAngularVelocity(new Vector3((float)(axis.x * spinrate), (float)(axis.y * spinrate), (float)(axis.z * spinrate))); | 3716 | part.UpdateAngularVelocity(new Vector3((float)(axis.x * spinrate), (float)(axis.y * spinrate), (float)(axis.z * spinrate))); |
3713 | } | 3717 | } |
3714 | 3718 | ||
@@ -7761,7 +7765,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7761 | //This is a special version of SetPrimParams to deal with avatars which are sat on the linkset. | 7765 | //This is a special version of SetPrimParams to deal with avatars which are sat on the linkset. |
7762 | 7766 | ||
7763 | int idx = 0; | 7767 | int idx = 0; |
7764 | SceneObjectPart sitpart = World.GetSceneObjectPart(av.ParentID); // betting this will be used | ||
7765 | 7768 | ||
7766 | bool positionChanged = false; | 7769 | bool positionChanged = false; |
7767 | Vector3 finalPos = Vector3.Zero; | 7770 | Vector3 finalPos = Vector3.Zero; |
@@ -7776,78 +7779,62 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7776 | 7779 | ||
7777 | switch (code) | 7780 | switch (code) |
7778 | { | 7781 | { |
7779 | // a avatar is a child | ||
7780 | case (int)ScriptBaseClass.PRIM_POSITION: | 7782 | case (int)ScriptBaseClass.PRIM_POSITION: |
7781 | case (int)ScriptBaseClass.PRIM_POS_LOCAL: | 7783 | case (int)ScriptBaseClass.PRIM_POS_LOCAL: |
7782 | { | 7784 | { |
7783 | if (remain < 1) | 7785 | if (remain < 1) |
7784 | return; | 7786 | return; |
7787 | |||
7785 | LSL_Vector v; | 7788 | LSL_Vector v; |
7786 | v = rules.GetVector3Item(idx++); | 7789 | v = rules.GetVector3Item(idx++); |
7787 | 7790 | ||
7788 | if (sitpart == null) | 7791 | SceneObjectPart part = World.GetSceneObjectPart(av.ParentID); |
7792 | if (part == null) | ||
7789 | break; | 7793 | break; |
7790 | 7794 | ||
7791 | Vector3 pos = new Vector3((float)v.x, (float)v.y, (float)v.z); // requested absolute position | 7795 | LSL_Rotation localRot = ScriptBaseClass.ZERO_ROTATION; |
7792 | 7796 | LSL_Vector localPos = ScriptBaseClass.ZERO_VECTOR; | |
7793 | if (sitpart != sitpart.ParentGroup.RootPart) | 7797 | if (part.LinkNum > 1) |
7794 | { | 7798 | { |
7795 | pos -= sitpart.OffsetPosition; // remove sit part offset | 7799 | localRot = GetPartLocalRot(part); |
7796 | Quaternion rot = sitpart.RotationOffset; | 7800 | localPos = GetPartLocalPos(part); |
7797 | pos *= Quaternion.Conjugate(rot); // removed sit part rotation | ||
7798 | } | 7801 | } |
7799 | Vector3 sitOffset = (Zrot(av.Rotation)) * (av.Appearance.AvatarHeight * 0.02638f * 2.0f); | ||
7800 | pos += sitOffset; | ||
7801 | 7802 | ||
7802 | finalPos = pos; | 7803 | v -= localPos; |
7803 | positionChanged = true; | 7804 | v /= localRot; |
7804 | } | ||
7805 | break; | ||
7806 | 7805 | ||
7807 | case (int)ScriptBaseClass.PRIM_ROTATION: | 7806 | LSL_Vector sitOffset = (llRot2Up(new LSL_Rotation(av.Rotation.X, av.Rotation.Y, av.Rotation.Z, av.Rotation.W)) * av.Appearance.AvatarHeight * 0.02638f); |
7808 | { | ||
7809 | if (remain < 1) | ||
7810 | return; | ||
7811 | 7807 | ||
7812 | if (sitpart == null) | 7808 | v = v + 2 * sitOffset; |
7813 | break; | ||
7814 | 7809 | ||
7815 | LSL_Rotation r = rules.GetQuaternionItem(idx++); | 7810 | av.OffsetPosition = new Vector3((float)v.x, (float)v.y, (float)v.z); |
7816 | Quaternion rot = new Quaternion((float)r.x, (float)r.y, (float)r.z, (float)r.s); // requested world rotation | 7811 | av.SendAvatarDataToAllAgents(); |
7817 | 7812 | ||
7818 | // need to replicate SL bug | ||
7819 | SceneObjectGroup sitgrp = sitpart.ParentGroup; | ||
7820 | if (sitgrp != null && sitgrp.RootPart != sitpart) | ||
7821 | { | ||
7822 | rot = sitgrp.RootPart.RotationOffset * rot; | ||
7823 | } | ||
7824 | |||
7825 | Quaternion srot = sitpart.RotationOffset; | ||
7826 | rot = Quaternion.Conjugate(srot) * rot; // removed sit part offset rotation | ||
7827 | av.Rotation = rot; | ||
7828 | // av.SendAvatarDataToAllAgents(); | ||
7829 | av.SendTerseUpdateToAllClients(); | ||
7830 | } | 7813 | } |
7831 | break; | 7814 | break; |
7832 | 7815 | ||
7833 | case (int)ScriptBaseClass.PRIM_ROT_LOCAL: | 7816 | case (int)ScriptBaseClass.PRIM_ROT_LOCAL: |
7817 | case (int)ScriptBaseClass.PRIM_ROTATION: | ||
7834 | { | 7818 | { |
7835 | if (remain < 1) | 7819 | if (remain < 1) |
7836 | return; | 7820 | return; |
7837 | 7821 | ||
7838 | if (sitpart == null) | 7822 | LSL_Rotation r; |
7823 | r = rules.GetQuaternionItem(idx++); | ||
7824 | |||
7825 | SceneObjectPart part = World.GetSceneObjectPart(av.ParentID); | ||
7826 | if (part == null) | ||
7839 | break; | 7827 | break; |
7840 | 7828 | ||
7841 | LSL_Rotation r = rules.GetQuaternionItem(idx++); | 7829 | LSL_Rotation localRot = ScriptBaseClass.ZERO_ROTATION; |
7842 | Quaternion rot = new Quaternion((float)r.x, (float)r.y, (float)r.z, (float)r.s); // requested offset rotation | 7830 | LSL_Vector localPos = ScriptBaseClass.ZERO_VECTOR; |
7843 | if (sitpart != sitpart.ParentGroup.RootPart) | 7831 | |
7844 | { | 7832 | if (part.LinkNum > 1) |
7845 | Quaternion srot = sitpart.RotationOffset; | 7833 | localRot = GetPartLocalRot(part); |
7846 | rot = Quaternion.Conjugate(srot) * rot; // remove sit part offset rotation | 7834 | |
7847 | } | 7835 | r = r * llGetRootRotation() / localRot; |
7848 | av.Rotation = rot; | 7836 | av.Rotation = new Quaternion((float)r.x, (float)r.y, (float)r.z, (float)r.s); |
7849 | // av.SendAvatarDataToAllAgents(); | 7837 | av.SendAvatarDataToAllAgents(); |
7850 | av.SendTerseUpdateToAllClients(); | ||
7851 | } | 7838 | } |
7852 | break; | 7839 | break; |
7853 | 7840 | ||