diff options
20 files changed, 474 insertions, 101 deletions
diff --git a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs index 3149eaa..3bc557d 100644 --- a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs +++ b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs | |||
@@ -123,6 +123,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
123 | availableMethods["admin_region_query"] = XmlRpcRegionQueryMethod; | 123 | availableMethods["admin_region_query"] = XmlRpcRegionQueryMethod; |
124 | availableMethods["admin_shutdown"] = XmlRpcShutdownMethod; | 124 | availableMethods["admin_shutdown"] = XmlRpcShutdownMethod; |
125 | availableMethods["admin_broadcast"] = XmlRpcAlertMethod; | 125 | availableMethods["admin_broadcast"] = XmlRpcAlertMethod; |
126 | availableMethods["admin_dialog"] = XmlRpcDialogMethod; | ||
126 | availableMethods["admin_restart"] = XmlRpcRestartMethod; | 127 | availableMethods["admin_restart"] = XmlRpcRestartMethod; |
127 | availableMethods["admin_load_heightmap"] = XmlRpcLoadHeightmapMethod; | 128 | availableMethods["admin_load_heightmap"] = XmlRpcLoadHeightmapMethod; |
128 | // User management | 129 | // User management |
@@ -277,6 +278,53 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
277 | m_log.Info("[RADMIN]: Alert request complete"); | 278 | m_log.Info("[RADMIN]: Alert request complete"); |
278 | return response; | 279 | return response; |
279 | } | 280 | } |
281 | public XmlRpcResponse XmlRpcDialogMethod(XmlRpcRequest request, IPEndPoint remoteClient) | ||
282 | { | ||
283 | XmlRpcResponse response = new XmlRpcResponse(); | ||
284 | Hashtable responseData = new Hashtable(); | ||
285 | |||
286 | m_log.Info("[RADMIN]: Dialog request started"); | ||
287 | |||
288 | try | ||
289 | { | ||
290 | Hashtable requestData = (Hashtable)request.Params[0]; | ||
291 | |||
292 | checkStringParameters(request, new string[] { "password", "from", "message" }); | ||
293 | |||
294 | if (m_requiredPassword != String.Empty && | ||
295 | (!requestData.Contains("password") || (string)requestData["password"] != m_requiredPassword)) | ||
296 | throw new Exception("wrong password"); | ||
297 | |||
298 | string message = (string)requestData["message"]; | ||
299 | string fromuuid = (string)requestData["from"]; | ||
300 | m_log.InfoFormat("[RADMIN]: Broadcasting: {0}", message); | ||
301 | |||
302 | responseData["accepted"] = true; | ||
303 | responseData["success"] = true; | ||
304 | response.Value = responseData; | ||
305 | |||
306 | m_app.SceneManager.ForEachScene( | ||
307 | delegate(Scene scene) | ||
308 | { | ||
309 | IDialogModule dialogModule = scene.RequestModuleInterface<IDialogModule>(); | ||
310 | if (dialogModule != null) | ||
311 | dialogModule.SendNotificationToUsersInRegion(UUID.Zero, fromuuid, message); | ||
312 | }); | ||
313 | } | ||
314 | catch (Exception e) | ||
315 | { | ||
316 | m_log.ErrorFormat("[RADMIN]: Broadcasting: failed: {0}", e.Message); | ||
317 | m_log.DebugFormat("[RADMIN]: Broadcasting: failed: {0}", e.ToString()); | ||
318 | |||
319 | responseData["accepted"] = false; | ||
320 | responseData["success"] = false; | ||
321 | responseData["error"] = e.Message; | ||
322 | response.Value = responseData; | ||
323 | } | ||
324 | |||
325 | m_log.Info("[RADMIN]: Alert request complete"); | ||
326 | return response; | ||
327 | } | ||
280 | 328 | ||
281 | public XmlRpcResponse XmlRpcLoadHeightmapMethod(XmlRpcRequest request, IPEndPoint remoteClient) | 329 | public XmlRpcResponse XmlRpcLoadHeightmapMethod(XmlRpcRequest request, IPEndPoint remoteClient) |
282 | { | 330 | { |
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 7eb829e..49b9378 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | |||
@@ -785,6 +785,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
785 | public virtual void SendLayerData(float[] map) | 785 | public virtual void SendLayerData(float[] map) |
786 | { | 786 | { |
787 | Util.FireAndForget(DoSendLayerData, map); | 787 | Util.FireAndForget(DoSendLayerData, map); |
788 | |||
789 | // Send it sync, and async. It's not that much data | ||
790 | // and it improves user experience just so much! | ||
791 | DoSendLayerData(map); | ||
788 | } | 792 | } |
789 | 793 | ||
790 | /// <summary> | 794 | /// <summary> |
@@ -797,16 +801,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
797 | 801 | ||
798 | try | 802 | try |
799 | { | 803 | { |
800 | //for (int y = 0; y < 16; y++) | 804 | for (int y = 0; y < 16; y++) |
801 | //{ | 805 | { |
802 | // for (int x = 0; x < 16; x++) | 806 | for (int x = 0; x < 16; x+=4) |
803 | // { | 807 | { |
804 | // SendLayerData(x, y, map); | 808 | SendLayerPacket(x, y, map); |
805 | // } | 809 | } |
806 | //} | 810 | } |
807 | |||
808 | // Send LayerData in a spiral pattern. Fun! | ||
809 | SendLayerTopRight(map, 0, 0, 15, 15); | ||
810 | } | 811 | } |
811 | catch (Exception e) | 812 | catch (Exception e) |
812 | { | 813 | { |
@@ -814,51 +815,35 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
814 | } | 815 | } |
815 | } | 816 | } |
816 | 817 | ||
817 | private void SendLayerTopRight(float[] map, int x1, int y1, int x2, int y2) | ||
818 | { | ||
819 | // Row | ||
820 | for (int i = x1; i <= x2; i++) | ||
821 | SendLayerData(i, y1, map); | ||
822 | |||
823 | // Column | ||
824 | for (int j = y1 + 1; j <= y2; j++) | ||
825 | SendLayerData(x2, j, map); | ||
826 | |||
827 | if (x2 - x1 > 0) | ||
828 | SendLayerBottomLeft(map, x1, y1 + 1, x2 - 1, y2); | ||
829 | } | ||
830 | |||
831 | void SendLayerBottomLeft(float[] map, int x1, int y1, int x2, int y2) | ||
832 | { | ||
833 | // Row in reverse | ||
834 | for (int i = x2; i >= x1; i--) | ||
835 | SendLayerData(i, y2, map); | ||
836 | |||
837 | // Column in reverse | ||
838 | for (int j = y2 - 1; j >= y1; j--) | ||
839 | SendLayerData(x1, j, map); | ||
840 | |||
841 | if (x2 - x1 > 0) | ||
842 | SendLayerTopRight(map, x1 + 1, y1, x2, y2 - 1); | ||
843 | } | ||
844 | |||
845 | /// <summary> | 818 | /// <summary> |
846 | /// Sends a set of four patches (x, x+1, ..., x+3) to the client | 819 | /// Sends a set of four patches (x, x+1, ..., x+3) to the client |
847 | /// </summary> | 820 | /// </summary> |
848 | /// <param name="map">heightmap</param> | 821 | /// <param name="map">heightmap</param> |
849 | /// <param name="px">X coordinate for patches 0..12</param> | 822 | /// <param name="px">X coordinate for patches 0..12</param> |
850 | /// <param name="py">Y coordinate for patches 0..15</param> | 823 | /// <param name="py">Y coordinate for patches 0..15</param> |
851 | // private void SendLayerPacket(float[] map, int y, int x) | 824 | private void SendLayerPacket(int x, int y, float[] map) |
852 | // { | 825 | { |
853 | // int[] patches = new int[4]; | 826 | int[] patches = new int[4]; |
854 | // patches[0] = x + 0 + y * 16; | 827 | patches[0] = x + 0 + y * 16; |
855 | // patches[1] = x + 1 + y * 16; | 828 | patches[1] = x + 1 + y * 16; |
856 | // patches[2] = x + 2 + y * 16; | 829 | patches[2] = x + 2 + y * 16; |
857 | // patches[3] = x + 3 + y * 16; | 830 | patches[3] = x + 3 + y * 16; |
858 | 831 | ||
859 | // Packet layerpack = LLClientView.TerrainManager.CreateLandPacket(map, patches); | 832 | float[] heightmap = (map.Length == 65536) ? |
860 | // OutPacket(layerpack, ThrottleOutPacketType.Land); | 833 | map : |
861 | // } | 834 | LLHeightFieldMoronize(map); |
835 | |||
836 | try | ||
837 | { | ||
838 | Packet layerpack = TerrainCompressor.CreateLandPacket(heightmap, patches); | ||
839 | OutPacket(layerpack, ThrottleOutPacketType.Land); | ||
840 | } | ||
841 | catch | ||
842 | { | ||
843 | for (int px = x ; px < x + 4 ; px++) | ||
844 | SendLayerData(px, y, map); | ||
845 | } | ||
846 | } | ||
862 | 847 | ||
863 | /// <summary> | 848 | /// <summary> |
864 | /// Sends a specified patch to a client | 849 | /// Sends a specified patch to a client |
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs index c773c05..0b05ed9 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs | |||
@@ -399,6 +399,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
399 | #region Queue or Send | 399 | #region Queue or Send |
400 | 400 | ||
401 | OutgoingPacket outgoingPacket = new OutgoingPacket(udpClient, buffer, category); | 401 | OutgoingPacket outgoingPacket = new OutgoingPacket(udpClient, buffer, category); |
402 | outgoingPacket.Type = type; | ||
402 | 403 | ||
403 | if (!outgoingPacket.Client.EnqueueOutgoing(outgoingPacket)) | 404 | if (!outgoingPacket.Client.EnqueueOutgoing(outgoingPacket)) |
404 | SendPacketFinal(outgoingPacket); | 405 | SendPacketFinal(outgoingPacket); |
@@ -510,6 +511,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
510 | byte flags = buffer.Data[0]; | 511 | byte flags = buffer.Data[0]; |
511 | bool isResend = (flags & Helpers.MSG_RESENT) != 0; | 512 | bool isResend = (flags & Helpers.MSG_RESENT) != 0; |
512 | bool isReliable = (flags & Helpers.MSG_RELIABLE) != 0; | 513 | bool isReliable = (flags & Helpers.MSG_RELIABLE) != 0; |
514 | bool sendSynchronous = false; | ||
513 | LLUDPClient udpClient = outgoingPacket.Client; | 515 | LLUDPClient udpClient = outgoingPacket.Client; |
514 | 516 | ||
515 | if (!udpClient.IsConnected) | 517 | if (!udpClient.IsConnected) |
@@ -565,9 +567,27 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
565 | if (isReliable) | 567 | if (isReliable) |
566 | Interlocked.Add(ref udpClient.UnackedBytes, outgoingPacket.Buffer.DataLength); | 568 | Interlocked.Add(ref udpClient.UnackedBytes, outgoingPacket.Buffer.DataLength); |
567 | 569 | ||
568 | // Put the UDP payload on the wire | 570 | //Some packet types need to be sent synchonously. |
569 | AsyncBeginSend(buffer); | 571 | //Sorry, i know it's not optimal, but until the LL client |
572 | //manages packets correctly and re-orders them as required, this is necessary. | ||
573 | |||
574 | if (outgoingPacket.Type == PacketType.ImprovedTerseObjectUpdate | ||
575 | || outgoingPacket.Type == PacketType.ChatFromSimulator | ||
576 | || outgoingPacket.Type == PacketType.ObjectUpdate | ||
577 | || outgoingPacket.Type == PacketType.LayerData) | ||
578 | { | ||
579 | sendSynchronous = true; | ||
580 | } | ||
570 | 581 | ||
582 | // Put the UDP payload on the wire | ||
583 | if (sendSynchronous == true) | ||
584 | { | ||
585 | SyncBeginSend(buffer); | ||
586 | } | ||
587 | else | ||
588 | { | ||
589 | AsyncBeginSend(buffer); | ||
590 | } | ||
571 | // Keep track of when this packet was sent out (right now) | 591 | // Keep track of when this packet was sent out (right now) |
572 | outgoingPacket.TickCount = Environment.TickCount & Int32.MaxValue; | 592 | outgoingPacket.TickCount = Environment.TickCount & Int32.MaxValue; |
573 | } | 593 | } |
diff --git a/OpenSim/Region/ClientStack/LindenUDP/OpenSimUDPBase.cs b/OpenSim/Region/ClientStack/LindenUDP/OpenSimUDPBase.cs index d2779ba..63579ac 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/OpenSimUDPBase.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/OpenSimUDPBase.cs | |||
@@ -246,6 +246,24 @@ namespace OpenMetaverse | |||
246 | } | 246 | } |
247 | } | 247 | } |
248 | 248 | ||
249 | public void SyncBeginSend(UDPPacketBuffer buf) | ||
250 | { | ||
251 | if (!m_shutdownFlag) | ||
252 | { | ||
253 | try | ||
254 | { | ||
255 | m_udpSocket.SendTo( | ||
256 | buf.Data, | ||
257 | 0, | ||
258 | buf.DataLength, | ||
259 | SocketFlags.None, | ||
260 | buf.RemoteEndPoint); | ||
261 | } | ||
262 | catch (SocketException) { } | ||
263 | catch (ObjectDisposedException) { } | ||
264 | } | ||
265 | } | ||
266 | |||
249 | public void AsyncBeginSend(UDPPacketBuffer buf) | 267 | public void AsyncBeginSend(UDPPacketBuffer buf) |
250 | { | 268 | { |
251 | if (!m_shutdownFlag) | 269 | if (!m_shutdownFlag) |
diff --git a/OpenSim/Region/ClientStack/LindenUDP/OutgoingPacket.cs b/OpenSim/Region/ClientStack/LindenUDP/OutgoingPacket.cs index 1a1a1cb..7dc42d3 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/OutgoingPacket.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/OutgoingPacket.cs | |||
@@ -28,6 +28,7 @@ | |||
28 | using System; | 28 | using System; |
29 | using OpenSim.Framework; | 29 | using OpenSim.Framework; |
30 | using OpenMetaverse; | 30 | using OpenMetaverse; |
31 | using OpenMetaverse.Packets; | ||
31 | 32 | ||
32 | namespace OpenSim.Region.ClientStack.LindenUDP | 33 | namespace OpenSim.Region.ClientStack.LindenUDP |
33 | { | 34 | { |
@@ -52,7 +53,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
52 | public int TickCount; | 53 | public int TickCount; |
53 | /// <summary>Category this packet belongs to</summary> | 54 | /// <summary>Category this packet belongs to</summary> |
54 | public ThrottleOutPacketType Category; | 55 | public ThrottleOutPacketType Category; |
55 | 56 | /// <summary>The type of packet so its delivery method can be determined</summary> | |
57 | public PacketType Type; | ||
56 | /// <summary> | 58 | /// <summary> |
57 | /// Default constructor | 59 | /// Default constructor |
58 | /// </summary> | 60 | /// </summary> |
diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs index 1614b70..7f9e5af 100644 --- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs | |||
@@ -164,19 +164,22 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | |||
164 | List<GridInstantMessage>msglist = SynchronousRestObjectPoster.BeginPostObject<UUID, List<GridInstantMessage>>( | 164 | List<GridInstantMessage>msglist = SynchronousRestObjectPoster.BeginPostObject<UUID, List<GridInstantMessage>>( |
165 | "POST", m_RestURL+"/RetrieveMessages/", client.AgentId); | 165 | "POST", m_RestURL+"/RetrieveMessages/", client.AgentId); |
166 | 166 | ||
167 | foreach (GridInstantMessage im in msglist) | 167 | if (msglist != null) |
168 | { | 168 | { |
169 | // client.SendInstantMessage(im); | 169 | foreach (GridInstantMessage im in msglist) |
170 | 170 | { | |
171 | // Send through scene event manager so all modules get a chance | 171 | // client.SendInstantMessage(im); |
172 | // to look at this message before it gets delivered. | 172 | |
173 | // | 173 | // Send through scene event manager so all modules get a chance |
174 | // Needed for proper state management for stored group | 174 | // to look at this message before it gets delivered. |
175 | // invitations | 175 | // |
176 | // | 176 | // Needed for proper state management for stored group |
177 | Scene s = FindScene(client.AgentId); | 177 | // invitations |
178 | if (s != null) | 178 | // |
179 | s.EventManager.TriggerIncomingInstantMessage(im); | 179 | Scene s = FindScene(client.AgentId); |
180 | if (s != null) | ||
181 | s.EventManager.TriggerIncomingInstantMessage(im); | ||
182 | } | ||
180 | } | 183 | } |
181 | } | 184 | } |
182 | 185 | ||
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index bcc9b37..ea4f2c7 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |||
@@ -1734,6 +1734,45 @@ namespace OpenSim.Region.Framework.Scenes | |||
1734 | } | 1734 | } |
1735 | } | 1735 | } |
1736 | 1736 | ||
1737 | public void rotLookAt(Quaternion target, float strength, float damping) | ||
1738 | { | ||
1739 | SceneObjectPart rootpart = m_rootPart; | ||
1740 | if (rootpart != null) | ||
1741 | { | ||
1742 | if (IsAttachment) | ||
1743 | { | ||
1744 | /* | ||
1745 | ScenePresence avatar = m_scene.GetScenePresence(rootpart.AttachedAvatar); | ||
1746 | if (avatar != null) | ||
1747 | { | ||
1748 | Rotate the Av? | ||
1749 | } */ | ||
1750 | } | ||
1751 | else | ||
1752 | { | ||
1753 | if (rootpart.PhysActor != null) | ||
1754 | { | ||
1755 | rootpart.PhysActor.APIDTarget = new Quaternion(target.X, target.Y, target.Z, target.W); | ||
1756 | rootpart.PhysActor.APIDStrength = strength; | ||
1757 | rootpart.PhysActor.APIDDamping = damping; | ||
1758 | rootpart.PhysActor.APIDActive = true; | ||
1759 | } | ||
1760 | } | ||
1761 | } | ||
1762 | } | ||
1763 | public void stopLookAt() | ||
1764 | { | ||
1765 | SceneObjectPart rootpart = m_rootPart; | ||
1766 | if (rootpart != null) | ||
1767 | { | ||
1768 | if (rootpart.PhysActor != null) | ||
1769 | { | ||
1770 | rootpart.PhysActor.APIDActive = false; | ||
1771 | } | ||
1772 | } | ||
1773 | |||
1774 | } | ||
1775 | |||
1737 | /// <summary> | 1776 | /// <summary> |
1738 | /// Uses a PID to attempt to clamp the object on the Z axis at the given height over tau seconds. | 1777 | /// Uses a PID to attempt to clamp the object on the Z axis at the given height over tau seconds. |
1739 | /// </summary> | 1778 | /// </summary> |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 6f1b458..10b7d94 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | |||
@@ -1064,14 +1064,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1064 | } | 1064 | } |
1065 | } | 1065 | } |
1066 | 1066 | ||
1067 | /// <summary> | ||
1068 | /// Clear all pending updates of parts to clients | ||
1069 | /// </summary> | ||
1070 | private void ClearUpdateSchedule() | ||
1071 | { | ||
1072 | m_updateFlag = 0; | ||
1073 | } | ||
1074 | |||
1075 | private void SendObjectPropertiesToClient(UUID AgentID) | 1067 | private void SendObjectPropertiesToClient(UUID AgentID) |
1076 | { | 1068 | { |
1077 | ScenePresence[] avatars = m_parentGroup.Scene.GetScenePresences(); | 1069 | ScenePresence[] avatars = m_parentGroup.Scene.GetScenePresences(); |
@@ -2185,6 +2177,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
2185 | ParentGroup.HasGroupChanged = true; | 2177 | ParentGroup.HasGroupChanged = true; |
2186 | ScheduleFullUpdate(); | 2178 | ScheduleFullUpdate(); |
2187 | } | 2179 | } |
2180 | |||
2181 | public void RotLookAt(Quaternion target, float strength, float damping) | ||
2182 | { | ||
2183 | m_parentGroup.rotLookAt(target, strength, damping); | ||
2184 | } | ||
2188 | 2185 | ||
2189 | /// <summary> | 2186 | /// <summary> |
2190 | /// Schedules this prim for a full update | 2187 | /// Schedules this prim for a full update |
@@ -2389,8 +2386,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
2389 | { | 2386 | { |
2390 | const float ROTATION_TOLERANCE = 0.01f; | 2387 | const float ROTATION_TOLERANCE = 0.01f; |
2391 | const float VELOCITY_TOLERANCE = 0.001f; | 2388 | const float VELOCITY_TOLERANCE = 0.001f; |
2392 | const float POSITION_TOLERANCE = 0.05f; | 2389 | const float POSITION_TOLERANCE = 0.05f; // I don't like this, but I suppose it's necessary |
2393 | const int TIME_MS_TOLERANCE = 3000; | 2390 | const int TIME_MS_TOLERANCE = 200; //llSetPos has a 200ms delay. This should NOT be 3 seconds. |
2394 | 2391 | ||
2395 | if (m_updateFlag == 1) | 2392 | if (m_updateFlag == 1) |
2396 | { | 2393 | { |
@@ -2404,7 +2401,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2404 | Environment.TickCount - m_lastTerseSent > TIME_MS_TOLERANCE) | 2401 | Environment.TickCount - m_lastTerseSent > TIME_MS_TOLERANCE) |
2405 | { | 2402 | { |
2406 | AddTerseUpdateToAllAvatars(); | 2403 | AddTerseUpdateToAllAvatars(); |
2407 | ClearUpdateSchedule(); | 2404 | |
2408 | 2405 | ||
2409 | // This causes the Scene to 'poll' physical objects every couple of frames | 2406 | // This causes the Scene to 'poll' physical objects every couple of frames |
2410 | // bad, so it's been replaced by an event driven method. | 2407 | // bad, so it's been replaced by an event driven method. |
@@ -2422,13 +2419,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
2422 | m_lastAngularVelocity = AngularVelocity; | 2419 | m_lastAngularVelocity = AngularVelocity; |
2423 | m_lastTerseSent = Environment.TickCount; | 2420 | m_lastTerseSent = Environment.TickCount; |
2424 | } | 2421 | } |
2422 | //Moved this outside of the if clause so updates don't get blocked.. *sigh* | ||
2423 | m_updateFlag = 0; //Why were we calling a function to do this? Inefficient! *screams* | ||
2425 | } | 2424 | } |
2426 | else | 2425 | else |
2427 | { | 2426 | { |
2428 | if (m_updateFlag == 2) // is a new prim, just created/reloaded or has major changes | 2427 | if (m_updateFlag == 2) // is a new prim, just created/reloaded or has major changes |
2429 | { | 2428 | { |
2430 | AddFullUpdateToAllAvatars(); | 2429 | AddFullUpdateToAllAvatars(); |
2431 | ClearUpdateSchedule(); | 2430 | m_updateFlag = 0; //Same here |
2432 | } | 2431 | } |
2433 | } | 2432 | } |
2434 | ClearUpdateSchedule(); | 2433 | ClearUpdateSchedule(); |
@@ -2684,6 +2683,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
2684 | SetText(text); | 2683 | SetText(text); |
2685 | } | 2684 | } |
2686 | 2685 | ||
2686 | public void StopLookAt() | ||
2687 | { | ||
2688 | m_parentGroup.stopLookAt(); | ||
2689 | |||
2690 | m_parentGroup.ScheduleGroupForTerseUpdate(); | ||
2691 | } | ||
2692 | |||
2687 | public void StopMoveToTarget() | 2693 | public void StopMoveToTarget() |
2688 | { | 2694 | { |
2689 | m_parentGroup.stopMoveToTarget(); | 2695 | m_parentGroup.stopMoveToTarget(); |
diff --git a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsActor.cs b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsActor.cs index 8df997e..f411dd7 100644 --- a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsActor.cs +++ b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsActor.cs | |||
@@ -303,6 +303,26 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin | |||
303 | set { return; } | 303 | set { return; } |
304 | } | 304 | } |
305 | 305 | ||
306 | public override Quaternion APIDTarget | ||
307 | { | ||
308 | set { return; } | ||
309 | } | ||
310 | |||
311 | public override bool APIDActive | ||
312 | { | ||
313 | set { return; } | ||
314 | } | ||
315 | |||
316 | public override float APIDStrength | ||
317 | { | ||
318 | set { return; } | ||
319 | } | ||
320 | |||
321 | public override float APIDDamping | ||
322 | { | ||
323 | set { return; } | ||
324 | } | ||
325 | |||
306 | public override void SubscribeEvents(int ms) | 326 | public override void SubscribeEvents(int ms) |
307 | { | 327 | { |
308 | } | 328 | } |
diff --git a/OpenSim/Region/Physics/BulletDotNETPlugin/BulletDotNETCharacter.cs b/OpenSim/Region/Physics/BulletDotNETPlugin/BulletDotNETCharacter.cs index 5ed3b14..98681d6 100644 --- a/OpenSim/Region/Physics/BulletDotNETPlugin/BulletDotNETCharacter.cs +++ b/OpenSim/Region/Physics/BulletDotNETPlugin/BulletDotNETCharacter.cs | |||
@@ -619,6 +619,12 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin | |||
619 | { | 619 | { |
620 | set { return; } | 620 | set { return; } |
621 | } | 621 | } |
622 | |||
623 | public override Quaternion APIDTarget { set { return; } } | ||
624 | public override bool APIDActive { set { return; } } | ||
625 | public override float APIDStrength { set { return; } } | ||
626 | public override float APIDDamping { set { return; } } | ||
627 | |||
622 | 628 | ||
623 | /// <summary> | 629 | /// <summary> |
624 | /// Adds the force supplied to the Target Velocity | 630 | /// Adds the force supplied to the Target Velocity |
diff --git a/OpenSim/Region/Physics/BulletDotNETPlugin/BulletDotNETPrim.cs b/OpenSim/Region/Physics/BulletDotNETPlugin/BulletDotNETPrim.cs index 5b542db..d931f126 100644 --- a/OpenSim/Region/Physics/BulletDotNETPlugin/BulletDotNETPrim.cs +++ b/OpenSim/Region/Physics/BulletDotNETPlugin/BulletDotNETPrim.cs | |||
@@ -565,6 +565,11 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin | |||
565 | public override PIDHoverType PIDHoverType { set { m_PIDHoverType = value; } } | 565 | public override PIDHoverType PIDHoverType { set { m_PIDHoverType = value; } } |
566 | public override float PIDHoverTau { set { m_PIDHoverTau = value; } } | 566 | public override float PIDHoverTau { set { m_PIDHoverTau = value; } } |
567 | 567 | ||
568 | public override Quaternion APIDTarget { set { return; } } | ||
569 | public override bool APIDActive { set { return; } } | ||
570 | public override float APIDStrength { set { return; } } | ||
571 | public override float APIDDamping { set { return; } } | ||
572 | |||
568 | 573 | ||
569 | public override void AddForce(Vector3 force, bool pushforce) | 574 | public override void AddForce(Vector3 force, bool pushforce) |
570 | { | 575 | { |
diff --git a/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs b/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs index 1e94ee2..d5d146e 100644 --- a/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs +++ b/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs | |||
@@ -1238,6 +1238,26 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
1238 | public override PIDHoverType PIDHoverType { set { return; } } | 1238 | public override PIDHoverType PIDHoverType { set { return; } } |
1239 | public override float PIDHoverTau { set { return; } } | 1239 | public override float PIDHoverTau { set { return; } } |
1240 | 1240 | ||
1241 | public override OpenMetaverse.Quaternion APIDTarget | ||
1242 | { | ||
1243 | set { return; } | ||
1244 | } | ||
1245 | |||
1246 | public override bool APIDActive | ||
1247 | { | ||
1248 | set { return; } | ||
1249 | } | ||
1250 | |||
1251 | public override float APIDStrength | ||
1252 | { | ||
1253 | set { return; } | ||
1254 | } | ||
1255 | |||
1256 | public override float APIDDamping | ||
1257 | { | ||
1258 | set { return; } | ||
1259 | } | ||
1260 | |||
1241 | 1261 | ||
1242 | public override void SubscribeEvents(int ms) | 1262 | public override void SubscribeEvents(int ms) |
1243 | { | 1263 | { |
diff --git a/OpenSim/Region/Physics/Manager/PhysicsActor.cs b/OpenSim/Region/Physics/Manager/PhysicsActor.cs index f58129d..b82586f 100644 --- a/OpenSim/Region/Physics/Manager/PhysicsActor.cs +++ b/OpenSim/Region/Physics/Manager/PhysicsActor.cs | |||
@@ -243,7 +243,12 @@ namespace OpenSim.Region.Physics.Manager | |||
243 | public abstract PIDHoverType PIDHoverType { set;} | 243 | public abstract PIDHoverType PIDHoverType { set;} |
244 | public abstract float PIDHoverTau { set;} | 244 | public abstract float PIDHoverTau { set;} |
245 | 245 | ||
246 | 246 | // For RotLookAt | |
247 | public abstract Quaternion APIDTarget { set;} | ||
248 | public abstract bool APIDActive { set;} | ||
249 | public abstract float APIDStrength { set;} | ||
250 | public abstract float APIDDamping { set;} | ||
251 | |||
247 | public abstract void AddForce(Vector3 force, bool pushforce); | 252 | public abstract void AddForce(Vector3 force, bool pushforce); |
248 | public abstract void AddAngularForce(Vector3 force, bool pushforce); | 253 | public abstract void AddAngularForce(Vector3 force, bool pushforce); |
249 | public abstract void SetMomentum(Vector3 momentum); | 254 | public abstract void SetMomentum(Vector3 momentum); |
@@ -476,6 +481,12 @@ namespace OpenSim.Region.Physics.Manager | |||
476 | public override bool PIDHoverActive { set { return; } } | 481 | public override bool PIDHoverActive { set { return; } } |
477 | public override PIDHoverType PIDHoverType { set { return; } } | 482 | public override PIDHoverType PIDHoverType { set { return; } } |
478 | public override float PIDHoverTau { set { return; } } | 483 | public override float PIDHoverTau { set { return; } } |
484 | |||
485 | public override Quaternion APIDTarget { set { return; } } | ||
486 | public override bool APIDActive { set { return; } } | ||
487 | public override float APIDStrength { set { return; } } | ||
488 | public override float APIDDamping { set { return; } } | ||
489 | |||
479 | 490 | ||
480 | public override void SetMomentum(Vector3 momentum) | 491 | public override void SetMomentum(Vector3 momentum) |
481 | { | 492 | { |
diff --git a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs index 1bc4a25..905d3ba 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs | |||
@@ -1196,6 +1196,28 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1196 | public override bool PIDHoverActive { set { return; } } | 1196 | public override bool PIDHoverActive { set { return; } } |
1197 | public override PIDHoverType PIDHoverType { set { return; } } | 1197 | public override PIDHoverType PIDHoverType { set { return; } } |
1198 | public override float PIDHoverTau { set { return; } } | 1198 | public override float PIDHoverTau { set { return; } } |
1199 | |||
1200 | public override Quaternion APIDTarget | ||
1201 | { | ||
1202 | set { return; } | ||
1203 | } | ||
1204 | |||
1205 | public override bool APIDActive | ||
1206 | { | ||
1207 | set { return; } | ||
1208 | } | ||
1209 | |||
1210 | public override float APIDStrength | ||
1211 | { | ||
1212 | set { return; } | ||
1213 | } | ||
1214 | |||
1215 | public override float APIDDamping | ||
1216 | { | ||
1217 | set { return; } | ||
1218 | } | ||
1219 | |||
1220 | |||
1199 | 1221 | ||
1200 | public override void SubscribeEvents(int ms) | 1222 | public override void SubscribeEvents(int ms) |
1201 | { | 1223 | { |
diff --git a/OpenSim/Region/Physics/OdePlugin/ODEDynamics.cs b/OpenSim/Region/Physics/OdePlugin/ODEDynamics.cs index 39cdc0f..78b15be 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODEDynamics.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODEDynamics.cs | |||
@@ -23,6 +23,19 @@ | |||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | * | ||
27 | * Revised Aug, Sept 2009 by Kitto Flora. ODEDynamics.cs replaces | ||
28 | * ODEVehicleSettings.cs. It and ODEPrim.cs are re-organised: | ||
29 | * ODEPrim.cs contains methods dealing with Prim editing, Prim | ||
30 | * characteristics and Kinetic motion. | ||
31 | * ODEDynamics.cs contains methods dealing with Prim Physical motion | ||
32 | * (dynamics) and the associated settings. Old Linear and angular | ||
33 | * motors for dynamic motion have been replace with MoveLinear() | ||
34 | * and MoveAngular(); 'Physical' is used only to switch ODE dynamic | ||
35 | * simualtion on/off; VEHICAL_TYPE_NONE/VEHICAL_TYPE_<other> is to | ||
36 | * switch between 'VEHICLE' parameter use and general dynamics | ||
37 | * settings use. | ||
38 | * | ||
26 | */ | 39 | */ |
27 | 40 | ||
28 | /* Revised Aug, Sept 2009 by Kitto Flora. ODEDynamics.cs replaces | 41 | /* Revised Aug, Sept 2009 by Kitto Flora. ODEDynamics.cs replaces |
@@ -120,7 +133,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
120 | // private float m_VhoverEfficiency = 0f; | 133 | // private float m_VhoverEfficiency = 0f; |
121 | private float m_VhoverTimescale = 0f; | 134 | private float m_VhoverTimescale = 0f; |
122 | private float m_VhoverTargetHeight = -1.0f; // if <0 then no hover, else its the current target height | 135 | private float m_VhoverTargetHeight = -1.0f; // if <0 then no hover, else its the current target height |
123 | private float m_VehicleBuoyancy = 0f; //KF: m_VehicleBuoyancy is set by VEHICLE_BUOYANCY for a vehicle. | 136 | private float m_VehicleBuoyancy = 0f; // Set by VEHICLE_BUOYANCY, for a vehicle. |
124 | // Modifies gravity. Slider between -1 (double-gravity) and 1 (full anti-gravity) | 137 | // Modifies gravity. Slider between -1 (double-gravity) and 1 (full anti-gravity) |
125 | // KF: So far I have found no good method to combine a script-requested .Z velocity and gravity. | 138 | // KF: So far I have found no good method to combine a script-requested .Z velocity and gravity. |
126 | // Therefore only m_VehicleBuoyancy=1 (0g) will use the script-requested .Z velocity. | 139 | // Therefore only m_VehicleBuoyancy=1 (0g) will use the script-requested .Z velocity. |
@@ -479,7 +492,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
479 | Quaternion rotq = new Quaternion(rot.X, rot.Y, rot.Z, rot.W); // rotq = rotation of object | 492 | Quaternion rotq = new Quaternion(rot.X, rot.Y, rot.Z, rot.W); // rotq = rotation of object |
480 | m_dir *= rotq; // apply obj rotation to velocity vector | 493 | m_dir *= rotq; // apply obj rotation to velocity vector |
481 | 494 | ||
482 | // add Gravity andBuoyancy | 495 | // add Gravity and Buoyancy |
483 | // KF: So far I have found no good method to combine a script-requested | 496 | // KF: So far I have found no good method to combine a script-requested |
484 | // .Z velocity and gravity. Therefore only 0g will used script-requested | 497 | // .Z velocity and gravity. Therefore only 0g will used script-requested |
485 | // .Z velocity. >0g (m_VehicleBuoyancy < 1) will used modified gravity only. | 498 | // .Z velocity. >0g (m_VehicleBuoyancy < 1) will used modified gravity only. |
@@ -561,6 +574,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
561 | private Vector3 m_angularFrictionTimescale = Vector3.Zero; // body angular velocity decay rate | 574 | private Vector3 m_angularFrictionTimescale = Vector3.Zero; // body angular velocity decay rate |
562 | private Vector3 m_lastAngularVelocity = Vector3.Zero; // what was last applied to body | 575 | private Vector3 m_lastAngularVelocity = Vector3.Zero; // what was last applied to body |
563 | */ | 576 | */ |
577 | //if(frcount == 0) Console.WriteLine("MoveAngular "); | ||
564 | 578 | ||
565 | // Get what the body is doing, this includes 'external' influences | 579 | // Get what the body is doing, this includes 'external' influences |
566 | d.Vector3 angularVelocity = d.BodyGetAngularVel(Body); | 580 | d.Vector3 angularVelocity = d.BodyGetAngularVel(Body); |
@@ -636,7 +650,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
636 | // Deflection section tba | 650 | // Deflection section tba |
637 | 651 | ||
638 | // Sum velocities | 652 | // Sum velocities |
639 | m_lastAngularVelocity = m_angularMotorVelocity + vertattr; // + bank + deflection | 653 | m_lastAngularVelocity = m_angularMotorVelocity + vertattr; // tba: + bank + deflection |
640 | 654 | ||
641 | if (!m_lastAngularVelocity.ApproxEquals(Vector3.Zero, 0.01f)) | 655 | if (!m_lastAngularVelocity.ApproxEquals(Vector3.Zero, 0.01f)) |
642 | { | 656 | { |
diff --git a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs index 6f14f7b..c7e0848 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs | |||
@@ -21,6 +21,18 @@ | |||
21 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 21 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
24 | * | ||
25 | * Revised August 26 2009 by Kitto Flora. ODEDynamics.cs replaces | ||
26 | * ODEVehicleSettings.cs. It and ODEPrim.cs are re-organised: | ||
27 | * ODEPrim.cs contains methods dealing with Prim editing, Prim | ||
28 | * characteristics and Kinetic motion. | ||
29 | * ODEDynamics.cs contains methods dealing with Prim Physical motion | ||
30 | * (dynamics) and the associated settings. Old Linear and angular | ||
31 | * motors for dynamic motion have been replace with MoveLinear() | ||
32 | * and MoveAngular(); 'Physical' is used only to switch ODE dynamic | ||
33 | * simualtion on/off; VEHICAL_TYPE_NONE/VEHICAL_TYPE_<other> is to | ||
34 | * switch between 'VEHICLE' parameter use and general dynamics | ||
35 | * settings use. | ||
24 | */ | 36 | */ |
25 | 37 | ||
26 | /* | 38 | /* |
@@ -81,7 +93,12 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
81 | private float m_PIDTau; | 93 | private float m_PIDTau; |
82 | private float PID_D = 35f; | 94 | private float PID_D = 35f; |
83 | private float PID_G = 25f; | 95 | private float PID_G = 25f; |
84 | private bool m_usePID; | 96 | private bool m_usePID = false; |
97 | |||
98 | private Quaternion m_APIDTarget = new Quaternion(); | ||
99 | private float m_APIDStrength = 0.5f; | ||
100 | private float m_APIDDamping = 0.5f; | ||
101 | private bool m_useAPID = false; | ||
85 | 102 | ||
86 | // KF: These next 7 params apply to llSetHoverHeight(float height, integer water, float tau), | 103 | // KF: These next 7 params apply to llSetHoverHeight(float height, integer water, float tau), |
87 | // and are for non-VEHICLES only. | 104 | // and are for non-VEHICLES only. |
@@ -182,6 +199,9 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
182 | private ODEDynamics m_vehicle; | 199 | private ODEDynamics m_vehicle; |
183 | 200 | ||
184 | internal int m_material = (int)Material.Wood; | 201 | internal int m_material = (int)Material.Wood; |
202 | |||
203 | private int frcount = 0; // Used to limit dynamics debug output to | ||
204 | |||
185 | 205 | ||
186 | public OdePrim(String primName, OdeScene parent_scene, Vector3 pos, Vector3 size, | 206 | public OdePrim(String primName, OdeScene parent_scene, Vector3 pos, Vector3 size, |
187 | Quaternion rotation, IMesh mesh, PrimitiveBaseShape pbs, bool pisPhysical, CollisionLocker dode) | 207 | Quaternion rotation, IMesh mesh, PrimitiveBaseShape pbs, bool pisPhysical, CollisionLocker dode) |
@@ -1558,9 +1578,14 @@ Console.WriteLine(" JointCreateFixed"); | |||
1558 | float fy = 0; | 1578 | float fy = 0; |
1559 | float fz = 0; | 1579 | float fz = 0; |
1560 | 1580 | ||
1581 | frcount++; // used to limit debug comment output | ||
1582 | if (frcount > 100) | ||
1583 | frcount = 0; | ||
1561 | 1584 | ||
1562 | if (IsPhysical && (Body != IntPtr.Zero) && !m_isSelected && !childPrim) // KF: Only move root prims. | 1585 | if (IsPhysical && (Body != IntPtr.Zero) && !m_isSelected && !childPrim) // KF: Only move root prims. |
1563 | { | 1586 | { |
1587 | //if(frcount == 0) Console.WriteLine("Move " + m_primName + " VTyp " + m_vehicle.Type + | ||
1588 | // " usePID=" + m_usePID + " seHover=" + m_useHoverPID + " useAPID=" + m_useAPID); | ||
1564 | if (m_vehicle.Type != Vehicle.TYPE_NONE) | 1589 | if (m_vehicle.Type != Vehicle.TYPE_NONE) |
1565 | { | 1590 | { |
1566 | // 'VEHICLES' are dealt with in ODEDynamics.cs | 1591 | // 'VEHICLES' are dealt with in ODEDynamics.cs |
@@ -1568,7 +1593,6 @@ Console.WriteLine(" JointCreateFixed"); | |||
1568 | } | 1593 | } |
1569 | else | 1594 | else |
1570 | { | 1595 | { |
1571 | //Console.WriteLine("Move " + m_primName); | ||
1572 | if(!d.BodyIsEnabled (Body)) d.BodyEnable (Body); // KF add 161009 | 1596 | if(!d.BodyIsEnabled (Body)) d.BodyEnable (Body); // KF add 161009 |
1573 | // NON-'VEHICLES' are dealt with here | 1597 | // NON-'VEHICLES' are dealt with here |
1574 | if (d.BodyIsEnabled(Body) && !m_angularlock.ApproxEquals(Vector3.Zero, 0.003f)) | 1598 | if (d.BodyIsEnabled(Body) && !m_angularlock.ApproxEquals(Vector3.Zero, 0.003f)) |
@@ -1590,21 +1614,18 @@ Console.WriteLine(" JointCreateFixed"); | |||
1590 | //m_log.Info(m_collisionFlags.ToString()); | 1614 | //m_log.Info(m_collisionFlags.ToString()); |
1591 | 1615 | ||
1592 | 1616 | ||
1593 | //KF: m_buoyancy should be set by llSetBuoyancy() for non-vehicle. | 1617 | //KF: m_buoyancy is set by llSetBuoyancy() and is for non-vehicle. |
1594 | // would come from SceneObjectPart.cs, public void SetBuoyancy(float fvalue) , PhysActor.Buoyancy = fvalue; ?? | ||
1595 | // m_buoyancy: (unlimited value) <0=Falls fast; 0=1g; 1=0g; >1 = floats up | 1618 | // m_buoyancy: (unlimited value) <0=Falls fast; 0=1g; 1=0g; >1 = floats up |
1596 | // gravityz multiplier = 1 - m_buoyancy | 1619 | // NB Prims in ODE are no subject to global gravity |
1597 | fz = _parent_scene.gravityz * (1.0f - m_buoyancy) * m_mass; | 1620 | fz = _parent_scene.gravityz * (1.0f - m_buoyancy) * m_mass; // force = acceleration * mass |
1598 | 1621 | ||
1599 | if (m_usePID) | 1622 | if (m_usePID) |
1600 | { | 1623 | { |
1601 | //Console.WriteLine("PID " + m_primName); | 1624 | //if(frcount == 0) Console.WriteLine("PID " + m_primName); |
1602 | // KF - this is for object move? eg. llSetPos() ? | 1625 | // KF - this is for object MoveToTarget. |
1626 | |||
1603 | //if (!d.BodyIsEnabled(Body)) | 1627 | //if (!d.BodyIsEnabled(Body)) |
1604 | //d.BodySetForce(Body, 0f, 0f, 0f); | 1628 | //d.BodySetForce(Body, 0f, 0f, 0f); |
1605 | // If we're using the PID controller, then we have no gravity | ||
1606 | //fz = (-1 * _parent_scene.gravityz) * m_mass; //KF: ?? Prims have no global gravity,so simply... | ||
1607 | fz = 0f; | ||
1608 | 1629 | ||
1609 | // no lock; for now it's only called from within Simulate() | 1630 | // no lock; for now it's only called from within Simulate() |
1610 | 1631 | ||
@@ -1739,7 +1760,7 @@ Console.WriteLine(" JointCreateFixed"); | |||
1739 | d.BodySetPosition(Body, pos.X, pos.Y, m_targetHoverHeight); | 1760 | d.BodySetPosition(Body, pos.X, pos.Y, m_targetHoverHeight); |
1740 | d.BodySetLinearVel(Body, vel.X, vel.Y, 0); | 1761 | d.BodySetLinearVel(Body, vel.X, vel.Y, 0); |
1741 | d.BodyAddForce(Body, 0, 0, fz); | 1762 | d.BodyAddForce(Body, 0, 0, fz); |
1742 | return; | 1763 | //KF this prevents furthur motions return; |
1743 | } | 1764 | } |
1744 | else | 1765 | else |
1745 | { | 1766 | { |
@@ -1748,8 +1769,46 @@ Console.WriteLine(" JointCreateFixed"); | |||
1748 | // We're flying and colliding with something | 1769 | // We're flying and colliding with something |
1749 | fz = fz + ((_target_velocity.Z - vel.Z) * (PID_D) * m_mass); | 1770 | fz = fz + ((_target_velocity.Z - vel.Z) * (PID_D) * m_mass); |
1750 | } | 1771 | } |
1751 | } | 1772 | } // end m_useHoverPID && !m_usePID |
1752 | 1773 | ||
1774 | if (m_useAPID) | ||
1775 | { | ||
1776 | // RotLookAt, apparently overrides all other rotation sources. Inputs: | ||
1777 | // Quaternion m_APIDTarget | ||
1778 | // float m_APIDStrength // From SL experiments, this is the time to get there | ||
1779 | // float m_APIDDamping // From SL experiments, this is damping, 1.0 = damped, 0.1 = wobbly | ||
1780 | // Also in SL the mass of the object has no effect on time to get there. | ||
1781 | // Factors: | ||
1782 | //if(frcount == 0) Console.WriteLine("APID "); | ||
1783 | // get present body rotation | ||
1784 | float limit = 1.0f; | ||
1785 | float scaler = 50f; // adjusts damping time | ||
1786 | float RLAservo = 0f; | ||
1787 | |||
1788 | d.Quaternion rot = d.BodyGetQuaternion(Body); | ||
1789 | Quaternion rotq = new Quaternion(rot.X, rot.Y, rot.Z, rot.W); | ||
1790 | Quaternion rot_diff = Quaternion.Inverse(rotq) * m_APIDTarget; | ||
1791 | float diff_angle; | ||
1792 | Vector3 diff_axis; | ||
1793 | rot_diff.GetAxisAngle(out diff_axis, out diff_angle); | ||
1794 | diff_axis.Normalize(); | ||
1795 | if(diff_angle > 0.01f) // diff_angle is always +ve | ||
1796 | { | ||
1797 | // PhysicsVector rotforce = new PhysicsVector(diff_axis.X, diff_axis.Y, diff_axis.Z); | ||
1798 | Vector3 rotforce = new Vector3(diff_axis.X, diff_axis.Y, diff_axis.Z); | ||
1799 | rotforce = rotforce * rotq; | ||
1800 | if(diff_angle > limit) diff_angle = limit; // cap the rotate rate | ||
1801 | // RLAservo = timestep / m_APIDStrength * m_mass * scaler; | ||
1802 | // rotforce = rotforce * RLAservo * diff_angle ; | ||
1803 | // d.BodyAddRelTorque(Body, rotforce.X, rotforce.Y, rotforce.Z); | ||
1804 | RLAservo = timestep / m_APIDStrength * scaler; | ||
1805 | rotforce = rotforce * RLAservo * diff_angle ; | ||
1806 | d.BodySetAngularVel (Body, rotforce.X, rotforce.Y, rotforce.Z); | ||
1807 | //Console.WriteLine("axis= " + diff_axis + " angle= " + diff_angle + "servo= " + RLAservo); | ||
1808 | } | ||
1809 | //if(frcount == 0) Console.WriteLine("mass= " + m_mass + " servo= " + RLAservo + " angle= " + diff_angle); | ||
1810 | } // end m_useAPID | ||
1811 | |||
1753 | fx *= m_mass; | 1812 | fx *= m_mass; |
1754 | fy *= m_mass; | 1813 | fy *= m_mass; |
1755 | //fz *= m_mass; | 1814 | //fz *= m_mass; |
@@ -2793,6 +2852,12 @@ Console.WriteLine(" JointCreateFixed"); | |||
2793 | } | 2852 | } |
2794 | public override bool PIDActive { set { m_usePID = value; } } | 2853 | public override bool PIDActive { set { m_usePID = value; } } |
2795 | public override float PIDTau { set { m_PIDTau = value; } } | 2854 | public override float PIDTau { set { m_PIDTau = value; } } |
2855 | |||
2856 | // For RotLookAt | ||
2857 | public override Quaternion APIDTarget { set { m_APIDTarget = value; } } | ||
2858 | public override bool APIDActive { set { m_useAPID = value; } } | ||
2859 | public override float APIDStrength { set { m_APIDStrength = value; } } | ||
2860 | public override float APIDDamping { set { m_APIDDamping = value; } } | ||
2796 | 2861 | ||
2797 | public override float PIDHoverHeight { set { m_PIDHoverHeight = value; ; } } | 2862 | public override float PIDHoverHeight { set { m_PIDHoverHeight = value; ; } } |
2798 | public override bool PIDHoverActive { set { m_useHoverPID = value; } } | 2863 | public override bool PIDHoverActive { set { m_useHoverPID = value; } } |
diff --git a/OpenSim/Region/Physics/POSPlugin/POSCharacter.cs b/OpenSim/Region/Physics/POSPlugin/POSCharacter.cs index 26cd1dd..566b4e7 100644 --- a/OpenSim/Region/Physics/POSPlugin/POSCharacter.cs +++ b/OpenSim/Region/Physics/POSPlugin/POSCharacter.cs | |||
@@ -304,6 +304,27 @@ namespace OpenSim.Region.Physics.POSPlugin | |||
304 | { | 304 | { |
305 | set { return; } | 305 | set { return; } |
306 | } | 306 | } |
307 | |||
308 | public override Quaternion APIDTarget | ||
309 | { | ||
310 | set { return; } | ||
311 | } | ||
312 | |||
313 | public override bool APIDActive | ||
314 | { | ||
315 | set { return; } | ||
316 | } | ||
317 | |||
318 | public override float APIDStrength | ||
319 | { | ||
320 | set { return; } | ||
321 | } | ||
322 | |||
323 | public override float APIDDamping | ||
324 | { | ||
325 | set { return; } | ||
326 | } | ||
327 | |||
307 | 328 | ||
308 | public override void SubscribeEvents(int ms) | 329 | public override void SubscribeEvents(int ms) |
309 | { | 330 | { |
diff --git a/OpenSim/Region/Physics/POSPlugin/POSPrim.cs b/OpenSim/Region/Physics/POSPlugin/POSPrim.cs index 96c3e26..847b634 100644 --- a/OpenSim/Region/Physics/POSPlugin/POSPrim.cs +++ b/OpenSim/Region/Physics/POSPlugin/POSPrim.cs | |||
@@ -299,6 +299,26 @@ namespace OpenSim.Region.Physics.POSPlugin | |||
299 | { | 299 | { |
300 | set { return; } | 300 | set { return; } |
301 | } | 301 | } |
302 | public override Quaternion APIDTarget | ||
303 | { | ||
304 | set { return; } | ||
305 | } | ||
306 | |||
307 | public override bool APIDActive | ||
308 | { | ||
309 | set { return; } | ||
310 | } | ||
311 | |||
312 | public override float APIDStrength | ||
313 | { | ||
314 | set { return; } | ||
315 | } | ||
316 | |||
317 | public override float APIDDamping | ||
318 | { | ||
319 | set { return; } | ||
320 | } | ||
321 | |||
302 | 322 | ||
303 | public override void SubscribeEvents(int ms) | 323 | public override void SubscribeEvents(int ms) |
304 | { | 324 | { |
diff --git a/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs b/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs index 8bdb18d..24eb6b1 100644 --- a/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs +++ b/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs | |||
@@ -498,6 +498,28 @@ namespace OpenSim.Region.Physics.PhysXPlugin | |||
498 | public override bool PIDHoverActive { set { return; } } | 498 | public override bool PIDHoverActive { set { return; } } |
499 | public override PIDHoverType PIDHoverType { set { return; } } | 499 | public override PIDHoverType PIDHoverType { set { return; } } |
500 | public override float PIDHoverTau { set { return; } } | 500 | public override float PIDHoverTau { set { return; } } |
501 | |||
502 | public override Quaternion APIDTarget | ||
503 | { | ||
504 | set { return; } | ||
505 | } | ||
506 | |||
507 | public override bool APIDActive | ||
508 | { | ||
509 | set { return; } | ||
510 | } | ||
511 | |||
512 | public override float APIDStrength | ||
513 | { | ||
514 | set { return; } | ||
515 | } | ||
516 | |||
517 | public override float APIDDamping | ||
518 | { | ||
519 | set { return; } | ||
520 | } | ||
521 | |||
522 | |||
501 | 523 | ||
502 | public override void SubscribeEvents(int ms) | 524 | public override void SubscribeEvents(int ms) |
503 | { | 525 | { |
@@ -780,6 +802,28 @@ namespace OpenSim.Region.Physics.PhysXPlugin | |||
780 | public override bool PIDHoverActive { set { return; } } | 802 | public override bool PIDHoverActive { set { return; } } |
781 | public override PIDHoverType PIDHoverType { set { return; } } | 803 | public override PIDHoverType PIDHoverType { set { return; } } |
782 | public override float PIDHoverTau { set { return; } } | 804 | public override float PIDHoverTau { set { return; } } |
805 | |||
806 | public override Quaternion APIDTarget | ||
807 | { | ||
808 | set { return; } | ||
809 | } | ||
810 | |||
811 | public override bool APIDActive | ||
812 | { | ||
813 | set { return; } | ||
814 | } | ||
815 | |||
816 | public override float APIDStrength | ||
817 | { | ||
818 | set { return; } | ||
819 | } | ||
820 | |||
821 | public override float APIDDamping | ||
822 | { | ||
823 | set { return; } | ||
824 | } | ||
825 | |||
826 | |||
783 | 827 | ||
784 | public override void SubscribeEvents(int ms) | 828 | public override void SubscribeEvents(int ms) |
785 | { | 829 | { |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 8eebf02..5fb2775 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -2699,11 +2699,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2699 | // Orient the object to the angle calculated | 2699 | // Orient the object to the angle calculated |
2700 | llSetRot(rot); | 2700 | llSetRot(rot); |
2701 | } | 2701 | } |
2702 | |||
2703 | public void llRotLookAt(LSL_Rotation target, double strength, double damping) | ||
2704 | { | ||
2705 | m_host.AddScriptLPS(1); | ||
2706 | // NotImplemented("llRotLookAt"); | ||
2707 | m_host.RotLookAt(Rot2Quaternion(target), (float)strength, (float)damping); | ||
2708 | |||
2709 | } | ||
2710 | |||
2702 | 2711 | ||
2703 | public void llStopLookAt() | 2712 | public void llStopLookAt() |
2704 | { | 2713 | { |
2705 | m_host.AddScriptLPS(1); | 2714 | m_host.AddScriptLPS(1); |
2706 | NotImplemented("llStopLookAt"); | 2715 | // NotImplemented("llStopLookAt"); |
2716 | m_host.StopLookAt(); | ||
2707 | } | 2717 | } |
2708 | 2718 | ||
2709 | public void llSetTimerEvent(double sec) | 2719 | public void llSetTimerEvent(double sec) |
@@ -3047,12 +3057,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3047 | m_host.AddScriptLPS(1); | 3057 | m_host.AddScriptLPS(1); |
3048 | } | 3058 | } |
3049 | 3059 | ||
3050 | public void llRotLookAt(LSL_Rotation target, double strength, double damping) | ||
3051 | { | ||
3052 | m_host.AddScriptLPS(1); | ||
3053 | NotImplemented("llRotLookAt"); | ||
3054 | } | ||
3055 | |||
3056 | public LSL_Integer llStringLength(string str) | 3060 | public LSL_Integer llStringLength(string str) |
3057 | { | 3061 | { |
3058 | m_host.AddScriptLPS(1); | 3062 | m_host.AddScriptLPS(1); |