diff options
author | Melanie | 2013-08-01 01:23:24 +0100 |
---|---|---|
committer | Melanie | 2013-08-01 01:23:24 +0100 |
commit | 21f5e670303ee978c747567e674e5ebe256ad2c7 (patch) | |
tree | 19c3740cbb8bf78d038e64b2fb66ea837cc8f724 /OpenSim/Region | |
parent | Merge branch 'master' into careminster (diff) | |
parent | Include missing reference that probably stops windows build from commit 12995... (diff) | |
download | opensim-SC-21f5e670303ee978c747567e674e5ebe256ad2c7.zip opensim-SC-21f5e670303ee978c747567e674e5ebe256ad2c7.tar.gz opensim-SC-21f5e670303ee978c747567e674e5ebe256ad2c7.tar.bz2 opensim-SC-21f5e670303ee978c747567e674e5ebe256ad2c7.tar.xz |
Merge branch 'master' into careminster
Conflicts:
OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs
Diffstat (limited to 'OpenSim/Region')
12 files changed, 290 insertions, 100 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs index c12b8d6..c8e1e83 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs | |||
@@ -82,6 +82,8 @@ namespace OpenSim.Region.ClientStack.Linden | |||
82 | 82 | ||
83 | private Dictionary<UUID,PollServiceTextureEventArgs> m_pollservices = new Dictionary<UUID,PollServiceTextureEventArgs>(); | 83 | private Dictionary<UUID,PollServiceTextureEventArgs> m_pollservices = new Dictionary<UUID,PollServiceTextureEventArgs>(); |
84 | 84 | ||
85 | private string m_URL; | ||
86 | |||
85 | #region ISharedRegionModule Members | 87 | #region ISharedRegionModule Members |
86 | 88 | ||
87 | public void Initialise(IConfigSource source) | 89 | public void Initialise(IConfigSource source) |
@@ -343,13 +345,13 @@ namespace OpenSim.Region.ClientStack.Linden | |||
343 | 345 | ||
344 | private void RegisterCaps(UUID agentID, Caps caps) | 346 | private void RegisterCaps(UUID agentID, Caps caps) |
345 | { | 347 | { |
346 | string capUrl = "/CAPS/" + UUID.Random() + "/"; | 348 | m_URL = "/CAPS/" + UUID.Random() + "/"; |
347 | 349 | ||
348 | // Register this as a poll service | 350 | // Register this as a poll service |
349 | PollServiceTextureEventArgs args = new PollServiceTextureEventArgs(agentID, m_scene); | 351 | PollServiceTextureEventArgs args = new PollServiceTextureEventArgs(agentID, m_scene); |
350 | 352 | ||
351 | args.Type = PollServiceEventArgs.EventType.Texture; | 353 | args.Type = PollServiceEventArgs.EventType.Texture; |
352 | MainServer.Instance.AddPollServiceHTTPHandler(capUrl, args); | 354 | MainServer.Instance.AddPollServiceHTTPHandler(m_URL, args); |
353 | 355 | ||
354 | string hostName = m_scene.RegionInfo.ExternalHostName; | 356 | string hostName = m_scene.RegionInfo.ExternalHostName; |
355 | uint port = (MainServer.Instance == null) ? 0 : MainServer.Instance.Port; | 357 | uint port = (MainServer.Instance == null) ? 0 : MainServer.Instance.Port; |
@@ -361,20 +363,23 @@ namespace OpenSim.Region.ClientStack.Linden | |||
361 | port = MainServer.Instance.SSLPort; | 363 | port = MainServer.Instance.SSLPort; |
362 | protocol = "https"; | 364 | protocol = "https"; |
363 | } | 365 | } |
364 | caps.RegisterHandler("GetTexture", String.Format("{0}://{1}:{2}{3}", protocol, hostName, port, capUrl)); | 366 | |
367 | IExternalCapsModule handler = m_scene.RequestModuleInterface<IExternalCapsModule>(); | ||
368 | if (handler != null) | ||
369 | handler.RegisterExternalUserCapsHandler(agentID, caps, "GetTexture", m_URL); | ||
370 | else | ||
371 | caps.RegisterHandler("GetTexture", String.Format("{0}://{1}:{2}{3}", protocol, hostName, port, m_URL)); | ||
365 | m_pollservices[agentID] = args; | 372 | m_pollservices[agentID] = args; |
366 | m_capsDict[agentID] = capUrl; | 373 | m_capsDict[agentID] = m_URL; |
367 | } | 374 | } |
368 | 375 | ||
369 | private void DeregisterCaps(UUID agentID, Caps caps) | 376 | private void DeregisterCaps(UUID agentID, Caps caps) |
370 | { | 377 | { |
371 | string capUrl; | ||
372 | PollServiceTextureEventArgs args; | 378 | PollServiceTextureEventArgs args; |
373 | if (m_capsDict.TryGetValue(agentID, out capUrl)) | 379 | |
374 | { | 380 | MainServer.Instance.RemoveHTTPHandler("", m_URL); |
375 | MainServer.Instance.RemoveHTTPHandler("", capUrl); | 381 | m_capsDict.Remove(agentID); |
376 | m_capsDict.Remove(agentID); | 382 | |
377 | } | ||
378 | if (m_pollservices.TryGetValue(agentID, out args)) | 383 | if (m_pollservices.TryGetValue(agentID, out args)) |
379 | { | 384 | { |
380 | m_pollservices.Remove(agentID); | 385 | m_pollservices.Remove(agentID); |
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/SimulatorFeaturesModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/SimulatorFeaturesModule.cs index 7d9f935..e4d8a20 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/SimulatorFeaturesModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/SimulatorFeaturesModule.cs | |||
@@ -68,7 +68,6 @@ namespace OpenSim.Region.ClientStack.Linden | |||
68 | /// </summary> | 68 | /// </summary> |
69 | private OSDMap m_features = new OSDMap(); | 69 | private OSDMap m_features = new OSDMap(); |
70 | 70 | ||
71 | private string m_MapImageServerURL = string.Empty; | ||
72 | private string m_SearchURL = string.Empty; | 71 | private string m_SearchURL = string.Empty; |
73 | private bool m_ExportSupported = false; | 72 | private bool m_ExportSupported = false; |
74 | 73 | ||
@@ -78,15 +77,7 @@ namespace OpenSim.Region.ClientStack.Linden | |||
78 | { | 77 | { |
79 | IConfig config = source.Configs["SimulatorFeatures"]; | 78 | IConfig config = source.Configs["SimulatorFeatures"]; |
80 | if (config != null) | 79 | if (config != null) |
81 | { | 80 | { |
82 | m_MapImageServerURL = config.GetString("MapImageServerURI", string.Empty); | ||
83 | if (m_MapImageServerURL != string.Empty) | ||
84 | { | ||
85 | m_MapImageServerURL = m_MapImageServerURL.Trim(); | ||
86 | if (!m_MapImageServerURL.EndsWith("/")) | ||
87 | m_MapImageServerURL = m_MapImageServerURL + "/"; | ||
88 | } | ||
89 | |||
90 | m_SearchURL = config.GetString("SearchServerURI", string.Empty); | 81 | m_SearchURL = config.GetString("SearchServerURI", string.Empty); |
91 | 82 | ||
92 | m_ExportSupported = config.GetBoolean("ExportSupported", m_ExportSupported); | 83 | m_ExportSupported = config.GetBoolean("ExportSupported", m_ExportSupported); |
@@ -149,15 +140,16 @@ namespace OpenSim.Region.ClientStack.Linden | |||
149 | m_features["PhysicsShapeTypes"] = typesMap; | 140 | m_features["PhysicsShapeTypes"] = typesMap; |
150 | 141 | ||
151 | // Extra information for viewers that want to use it | 142 | // Extra information for viewers that want to use it |
152 | OSDMap gridServicesMap = new OSDMap(); | 143 | // TODO: Take these out of here into their respective modules, like map-server-url |
153 | if (m_MapImageServerURL != string.Empty) | 144 | OSDMap extrasMap = new OSDMap(); |
154 | gridServicesMap["map-server-url"] = m_MapImageServerURL; | ||
155 | if (m_SearchURL != string.Empty) | 145 | if (m_SearchURL != string.Empty) |
156 | gridServicesMap["search"] = m_SearchURL; | 146 | extrasMap["search-server-url"] = m_SearchURL; |
157 | m_features["GridServices"] = gridServicesMap; | ||
158 | |||
159 | if (m_ExportSupported) | 147 | if (m_ExportSupported) |
160 | m_features["ExportSupported"] = true; | 148 | extrasMap["ExportSupported"] = true; |
149 | |||
150 | if (extrasMap.Count > 0) | ||
151 | m_features["OpenSimExtras"] = extrasMap; | ||
152 | |||
161 | } | 153 | } |
162 | } | 154 | } |
163 | 155 | ||
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index 544b54b..2a2c819 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs | |||
@@ -69,9 +69,22 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
69 | 69 | ||
70 | StatsManager.RegisterStat( | 70 | StatsManager.RegisterStat( |
71 | new Stat( | 71 | new Stat( |
72 | "ClientLogoutsDueToNoReceives", | ||
73 | "Number of times a client has been logged out because no packets were received before the timeout.", | ||
74 | "", | ||
75 | "", | ||
76 | "clientstack", | ||
77 | scene.Name, | ||
78 | StatType.Pull, | ||
79 | MeasuresOfInterest.None, | ||
80 | stat => stat.Value = m_udpServer.ClientLogoutsDueToNoReceives, | ||
81 | StatVerbosity.Debug)); | ||
82 | |||
83 | StatsManager.RegisterStat( | ||
84 | new Stat( | ||
72 | "IncomingUDPReceivesCount", | 85 | "IncomingUDPReceivesCount", |
73 | "Number of UDP receives performed", | 86 | "Number of UDP receives performed", |
74 | "Number of UDP receives performed", | 87 | "", |
75 | "", | 88 | "", |
76 | "clientstack", | 89 | "clientstack", |
77 | scene.Name, | 90 | scene.Name, |
@@ -84,7 +97,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
84 | new Stat( | 97 | new Stat( |
85 | "IncomingPacketsProcessedCount", | 98 | "IncomingPacketsProcessedCount", |
86 | "Number of inbound LL protocol packets processed", | 99 | "Number of inbound LL protocol packets processed", |
87 | "Number of inbound LL protocol packets processed", | 100 | "", |
88 | "", | 101 | "", |
89 | "clientstack", | 102 | "clientstack", |
90 | scene.Name, | 103 | scene.Name, |
@@ -97,7 +110,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
97 | new Stat( | 110 | new Stat( |
98 | "OutgoingUDPSendsCount", | 111 | "OutgoingUDPSendsCount", |
99 | "Number of UDP sends performed", | 112 | "Number of UDP sends performed", |
100 | "Number of UDP sends performed", | 113 | "", |
101 | "", | 114 | "", |
102 | "clientstack", | 115 | "clientstack", |
103 | scene.Name, | 116 | scene.Name, |
@@ -149,6 +162,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
149 | /// <summary>Maximum transmission unit, or UDP packet size, for the LLUDP protocol</summary> | 162 | /// <summary>Maximum transmission unit, or UDP packet size, for the LLUDP protocol</summary> |
150 | public const int MTU = 1400; | 163 | public const int MTU = 1400; |
151 | 164 | ||
165 | /// <summary>Number of forced client logouts due to no receipt of packets before timeout.</summary> | ||
166 | public int ClientLogoutsDueToNoReceives { get; private set; } | ||
167 | |||
152 | /// <summary> | 168 | /// <summary> |
153 | /// Default packet debug level given to new clients | 169 | /// Default packet debug level given to new clients |
154 | /// </summary> | 170 | /// </summary> |
@@ -1058,7 +1074,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1058 | // Fire this out on a different thread so that we don't hold up outgoing packet processing for | 1074 | // Fire this out on a different thread so that we don't hold up outgoing packet processing for |
1059 | // everybody else if this is being called due to an ack timeout. | 1075 | // everybody else if this is being called due to an ack timeout. |
1060 | // This is the same as processing as the async process of a logout request. | 1076 | // This is the same as processing as the async process of a logout request. |
1061 | Util.FireAndForget(o => DeactivateClientDueToTimeout(client)); | 1077 | Util.FireAndForget(o => DeactivateClientDueToTimeout(client, timeoutTicks)); |
1062 | 1078 | ||
1063 | return; | 1079 | return; |
1064 | } | 1080 | } |
@@ -1842,18 +1858,19 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1842 | /// regular client pings. | 1858 | /// regular client pings. |
1843 | /// </remarks> | 1859 | /// </remarks> |
1844 | /// <param name='client'></param> | 1860 | /// <param name='client'></param> |
1845 | private void DeactivateClientDueToTimeout(LLClientView client) | 1861 | /// <param name='timeoutTicks'></param> |
1862 | private void DeactivateClientDueToTimeout(LLClientView client, int timeoutTicks) | ||
1846 | { | 1863 | { |
1847 | lock (client.CloseSyncLock) | 1864 | lock (client.CloseSyncLock) |
1848 | { | 1865 | { |
1866 | ClientLogoutsDueToNoReceives++; | ||
1867 | |||
1849 | m_log.WarnFormat( | 1868 | m_log.WarnFormat( |
1850 | "[LLUDPSERVER]: Ack timeout, disconnecting {0} agent for {1} in {2}", | 1869 | "[LLUDPSERVER]: No packets received from {0} agent of {1} for {2}ms in {3}. Disconnecting.", |
1851 | client.SceneAgent.IsChildAgent ? "child" : "root", client.Name, m_scene.RegionInfo.RegionName); | 1870 | client.SceneAgent.IsChildAgent ? "child" : "root", client.Name, timeoutTicks, m_scene.Name); |
1852 | |||
1853 | StatsManager.SimExtraStats.AddAbnormalClientThreadTermination(); | ||
1854 | 1871 | ||
1855 | if (!client.SceneAgent.IsChildAgent) | 1872 | if (!client.SceneAgent.IsChildAgent) |
1856 | client.Kick("Simulator logged you out due to connection timeout"); | 1873 | client.Kick("Simulator logged you out due to connection timeout."); |
1857 | 1874 | ||
1858 | client.CloseWithoutChecks(true); | 1875 | client.CloseWithoutChecks(true); |
1859 | } | 1876 | } |
diff --git a/OpenSim/Region/CoreModules/Hypergrid/HGWorldMapModule.cs b/OpenSim/Region/CoreModules/Hypergrid/HGWorldMapModule.cs index 7b11658..f196973 100644 --- a/OpenSim/Region/CoreModules/Hypergrid/HGWorldMapModule.cs +++ b/OpenSim/Region/CoreModules/Hypergrid/HGWorldMapModule.cs | |||
@@ -31,6 +31,7 @@ using System.Reflection; | |||
31 | using log4net; | 31 | using log4net; |
32 | using Nini.Config; | 32 | using Nini.Config; |
33 | using OpenMetaverse; | 33 | using OpenMetaverse; |
34 | using OpenMetaverse.StructuredData; | ||
34 | using Mono.Addins; | 35 | using Mono.Addins; |
35 | using OpenSim.Framework; | 36 | using OpenSim.Framework; |
36 | using OpenSim.Region.CoreModules.World.WorldMap; | 37 | using OpenSim.Region.CoreModules.World.WorldMap; |
@@ -48,20 +49,63 @@ namespace OpenSim.Region.CoreModules.Hypergrid | |||
48 | // Remember the map area that each client has been exposed to in this region | 49 | // Remember the map area that each client has been exposed to in this region |
49 | private Dictionary<UUID, List<MapBlockData>> m_SeenMapBlocks = new Dictionary<UUID, List<MapBlockData>>(); | 50 | private Dictionary<UUID, List<MapBlockData>> m_SeenMapBlocks = new Dictionary<UUID, List<MapBlockData>>(); |
50 | 51 | ||
52 | private string m_MapImageServerURL = string.Empty; | ||
53 | |||
54 | private IUserManagement m_UserManagement; | ||
55 | |||
51 | #region INonSharedRegionModule Members | 56 | #region INonSharedRegionModule Members |
52 | 57 | ||
53 | public override void Initialise(IConfigSource config) | 58 | public override void Initialise(IConfigSource source) |
54 | { | 59 | { |
55 | if (Util.GetConfigVarFromSections<string>( | 60 | if (Util.GetConfigVarFromSections<string>( |
56 | config, "WorldMapModule", new string[] { "Map", "Startup" }, "WorldMap") == "HGWorldMap") | 61 | source, "WorldMapModule", new string[] { "Map", "Startup" }, "WorldMap") == "HGWorldMap") |
62 | { | ||
57 | m_Enabled = true; | 63 | m_Enabled = true; |
64 | |||
65 | m_MapImageServerURL = Util.GetConfigVarFromSections<string>(source, "MapTileURL", new string[] {"LoginService", "HGWorldMap", "SimulatorFeatures"}); | ||
66 | |||
67 | if (!string.IsNullOrEmpty(m_MapImageServerURL)) | ||
68 | { | ||
69 | m_MapImageServerURL = m_MapImageServerURL.Trim(); | ||
70 | if (!m_MapImageServerURL.EndsWith("/")) | ||
71 | m_MapImageServerURL = m_MapImageServerURL + "/"; | ||
72 | } | ||
73 | |||
74 | |||
75 | } | ||
58 | } | 76 | } |
59 | 77 | ||
60 | public override void AddRegion(Scene scene) | 78 | public override void AddRegion(Scene scene) |
61 | { | 79 | { |
80 | if (!m_Enabled) | ||
81 | return; | ||
82 | |||
62 | base.AddRegion(scene); | 83 | base.AddRegion(scene); |
63 | 84 | ||
64 | scene.EventManager.OnClientClosed += new EventManager.ClientClosed(EventManager_OnClientClosed); | 85 | scene.EventManager.OnClientClosed += EventManager_OnClientClosed; |
86 | } | ||
87 | |||
88 | public override void RegionLoaded(Scene scene) | ||
89 | { | ||
90 | if (!m_Enabled) | ||
91 | return; | ||
92 | |||
93 | base.RegionLoaded(scene); | ||
94 | ISimulatorFeaturesModule featuresModule = m_scene.RequestModuleInterface<ISimulatorFeaturesModule>(); | ||
95 | |||
96 | if (featuresModule != null) | ||
97 | featuresModule.OnSimulatorFeaturesRequest += OnSimulatorFeaturesRequest; | ||
98 | |||
99 | m_UserManagement = m_scene.RequestModuleInterface<IUserManagement>(); | ||
100 | |||
101 | } | ||
102 | |||
103 | public override void RemoveRegion(Scene scene) | ||
104 | { | ||
105 | if (!m_Enabled) | ||
106 | return; | ||
107 | |||
108 | scene.EventManager.OnClientClosed -= EventManager_OnClientClosed; | ||
65 | } | 109 | } |
66 | 110 | ||
67 | public override string Name | 111 | public override string Name |
@@ -115,6 +159,20 @@ namespace OpenSim.Region.CoreModules.Hypergrid | |||
115 | return mapBlocks; | 159 | return mapBlocks; |
116 | } | 160 | } |
117 | 161 | ||
162 | private void OnSimulatorFeaturesRequest(UUID agentID, ref OSDMap features) | ||
163 | { | ||
164 | if (m_UserManagement != null && !string.IsNullOrEmpty(m_MapImageServerURL) && !m_UserManagement.IsLocalGridUser(agentID)) | ||
165 | { | ||
166 | OSD extras = new OSDMap(); | ||
167 | if (features.ContainsKey("OpenSimExtras")) | ||
168 | extras = features["OpenSimExtras"]; | ||
169 | else | ||
170 | features["OpenSimExtras"] = extras; | ||
171 | |||
172 | ((OSDMap)extras)["map-server-url"] = m_MapImageServerURL; | ||
173 | |||
174 | } | ||
175 | } | ||
118 | } | 176 | } |
119 | 177 | ||
120 | class MapArea | 178 | class MapArea |
diff --git a/OpenSim/Region/Framework/Interfaces/IExternalCapsModule.cs b/OpenSim/Region/Framework/Interfaces/IExternalCapsModule.cs new file mode 100644 index 0000000..a730cfd --- /dev/null +++ b/OpenSim/Region/Framework/Interfaces/IExternalCapsModule.cs | |||
@@ -0,0 +1,48 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
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 | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using OpenMetaverse; | ||
30 | using OpenSim.Framework; | ||
31 | using Caps=OpenSim.Framework.Capabilities.Caps; | ||
32 | |||
33 | namespace OpenSim.Region.Framework.Interfaces | ||
34 | { | ||
35 | public interface IExternalCapsModule | ||
36 | { | ||
37 | /// <summary> | ||
38 | /// This function extends the simple URL configuration in the caps handlers | ||
39 | /// to facilitate more interesting computation when an external handler is | ||
40 | /// sent to the viewer. | ||
41 | /// </summary> | ||
42 | /// <param name="agentID">New user UUID</param> | ||
43 | /// <param name="caps">Internal caps registry, where the external handler will be registered</param> | ||
44 | /// <param name="capName">Name of the specific cap we are registering</param> | ||
45 | /// <param name="urlSkel">The skeleton URL provided in the caps configuration</param> | ||
46 | bool RegisterExternalUserCapsHandler(UUID agentID, Caps caps, String capName, String urlSkel); | ||
47 | } | ||
48 | } | ||
diff --git a/OpenSim/Region/OptionalModules/Scripting/ExtendedPhysics/ExtendedPhysics.cs b/OpenSim/Region/OptionalModules/Scripting/ExtendedPhysics/ExtendedPhysics.cs index 6009dc5..0cbc5f9 100755 --- a/OpenSim/Region/OptionalModules/Scripting/ExtendedPhysics/ExtendedPhysics.cs +++ b/OpenSim/Region/OptionalModules/Scripting/ExtendedPhysics/ExtendedPhysics.cs | |||
@@ -31,10 +31,10 @@ using System.Reflection; | |||
31 | using System.Text; | 31 | using System.Text; |
32 | 32 | ||
33 | using OpenSim.Framework; | 33 | using OpenSim.Framework; |
34 | using OpenSim.Region.CoreModules; | ||
34 | using OpenSim.Region.Framework; | 35 | using OpenSim.Region.Framework; |
35 | using OpenSim.Region.Framework.Interfaces; | 36 | using OpenSim.Region.Framework.Interfaces; |
36 | using OpenSim.Region.Framework.Scenes; | 37 | using OpenSim.Region.Framework.Scenes; |
37 | using OpenSim.Region.CoreModules; | ||
38 | 38 | ||
39 | using Mono.Addins; | 39 | using Mono.Addins; |
40 | using Nini.Config; | 40 | using Nini.Config; |
@@ -49,6 +49,10 @@ public class ExtendedPhysics : INonSharedRegionModule | |||
49 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 49 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
50 | private static string LogHeader = "[EXTENDED PHYSICS]"; | 50 | private static string LogHeader = "[EXTENDED PHYSICS]"; |
51 | 51 | ||
52 | // Since BulletSim is a plugin, this these values aren't defined easily in one place. | ||
53 | // This table must coorespond to an identical table in BSScene. | ||
54 | public const string PhysFunctSetLinksetType = "BulletSim.SetLinksetType"; | ||
55 | |||
52 | private IConfig Configuration { get; set; } | 56 | private IConfig Configuration { get; set; } |
53 | private bool Enabled { get; set; } | 57 | private bool Enabled { get; set; } |
54 | private Scene BaseScene { get; set; } | 58 | private Scene BaseScene { get; set; } |
@@ -143,13 +147,6 @@ public class ExtendedPhysics : INonSharedRegionModule | |||
143 | [ScriptConstant] | 147 | [ScriptConstant] |
144 | public static int PHYS_CENTER_OF_MASS = 1 << 0; | 148 | public static int PHYS_CENTER_OF_MASS = 1 << 0; |
145 | 149 | ||
146 | [ScriptConstant] | ||
147 | public static int PHYS_LINKSET_TYPE_CONSTRAINT = 1; | ||
148 | [ScriptConstant] | ||
149 | public static int PHYS_LINKSET_TYPE_COMPOUND = 2; | ||
150 | [ScriptConstant] | ||
151 | public static int PHYS_LINKSET_TYPE_MANUAL = 3; | ||
152 | |||
153 | [ScriptInvocation] | 150 | [ScriptInvocation] |
154 | public string physGetEngineType(UUID hostID, UUID scriptID) | 151 | public string physGetEngineType(UUID hostID, UUID scriptID) |
155 | { | 152 | { |
@@ -163,9 +160,50 @@ public class ExtendedPhysics : INonSharedRegionModule | |||
163 | return ret; | 160 | return ret; |
164 | } | 161 | } |
165 | 162 | ||
163 | [ScriptConstant] | ||
164 | public static int PHYS_LINKSET_TYPE_CONSTRAINT = 0; | ||
165 | [ScriptConstant] | ||
166 | public static int PHYS_LINKSET_TYPE_COMPOUND = 1; | ||
167 | [ScriptConstant] | ||
168 | public static int PHYS_LINKSET_TYPE_MANUAL = 2; | ||
169 | |||
166 | [ScriptInvocation] | 170 | [ScriptInvocation] |
167 | public void physSetLinksetType(UUID hostID, UUID scriptID, int linksetType) | 171 | public void physSetLinksetType(UUID hostID, UUID scriptID, int linksetType) |
168 | { | 172 | { |
173 | if (!Enabled) return; | ||
174 | |||
175 | // The part that is requesting the change. | ||
176 | SceneObjectPart requestingPart = BaseScene.GetSceneObjectPart(hostID); | ||
177 | |||
178 | if (requestingPart != null) | ||
179 | { | ||
180 | // The change is always made to the root of a linkset. | ||
181 | SceneObjectGroup containingGroup = requestingPart.ParentGroup; | ||
182 | SceneObjectPart rootPart = containingGroup.RootPart; | ||
183 | |||
184 | if (rootPart != null) | ||
185 | { | ||
186 | Physics.Manager.PhysicsActor rootPhysActor = rootPart.PhysActor; | ||
187 | if (rootPhysActor != null) | ||
188 | { | ||
189 | rootPhysActor.Extension(PhysFunctSetLinksetType, linksetType); | ||
190 | } | ||
191 | else | ||
192 | { | ||
193 | m_log.WarnFormat("{0} physSetLinksetType: root part does not have a physics actor. rootName={1}, hostID={2}", | ||
194 | LogHeader, rootPart.Name, hostID); | ||
195 | } | ||
196 | } | ||
197 | else | ||
198 | { | ||
199 | m_log.WarnFormat("{0} physSetLinksetType: root part does not exist. RequestingPartName={1}, hostID={2}", | ||
200 | LogHeader, requestingPart.Name, hostID); | ||
201 | } | ||
202 | } | ||
203 | else | ||
204 | { | ||
205 | m_log.WarnFormat("{0} physSetLinsetType: cannot find script object in scene. hostID={1}", LogHeader, hostID); | ||
206 | } | ||
169 | } | 207 | } |
170 | } | 208 | } |
171 | } | 209 | } |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs index 59e7f5f..58a417e 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs | |||
@@ -75,7 +75,7 @@ public sealed class BSCharacter : BSPhysObject | |||
75 | RawVelocity = OMV.Vector3.Zero; | 75 | RawVelocity = OMV.Vector3.Zero; |
76 | _buoyancy = ComputeBuoyancyFromFlying(isFlying); | 76 | _buoyancy = ComputeBuoyancyFromFlying(isFlying); |
77 | Friction = BSParam.AvatarStandingFriction; | 77 | Friction = BSParam.AvatarStandingFriction; |
78 | Density = BSParam.AvatarDensity / BSParam.DensityScaleFactor; | 78 | Density = BSParam.AvatarDensity; |
79 | 79 | ||
80 | // Old versions of ScenePresence passed only the height. If width and/or depth are zero, | 80 | // Old versions of ScenePresence passed only the height. If width and/or depth are zero, |
81 | // replace with the default values. | 81 | // replace with the default values. |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs b/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs index 82d7c44..f0d17d3 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs | |||
@@ -589,10 +589,10 @@ namespace OpenSim.Region.Physics.BulletSPlugin | |||
589 | m_vehicleMass = ControllingPrim.TotalMass; | 589 | m_vehicleMass = ControllingPrim.TotalMass; |
590 | 590 | ||
591 | // Friction affects are handled by this vehicle code | 591 | // Friction affects are handled by this vehicle code |
592 | m_physicsScene.PE.SetFriction(ControllingPrim.PhysBody, BSParam.VehicleFriction); | 592 | // m_physicsScene.PE.SetFriction(ControllingPrim.PhysBody, BSParam.VehicleFriction); |
593 | m_physicsScene.PE.SetRestitution(ControllingPrim.PhysBody, BSParam.VehicleRestitution); | 593 | // m_physicsScene.PE.SetRestitution(ControllingPrim.PhysBody, BSParam.VehicleRestitution); |
594 | // ControllingPrim.Linkset.SetPhysicalFriction(BSParam.VehicleFriction); | 594 | ControllingPrim.Linkset.SetPhysicalFriction(BSParam.VehicleFriction); |
595 | // ControllingPrim.Linkset.SetPhysicalRestitution(BSParam.VehicleRestitution); | 595 | ControllingPrim.Linkset.SetPhysicalRestitution(BSParam.VehicleRestitution); |
596 | 596 | ||
597 | // Moderate angular movement introduced by Bullet. | 597 | // Moderate angular movement introduced by Bullet. |
598 | // TODO: possibly set AngularFactor and LinearFactor for the type of vehicle. | 598 | // TODO: possibly set AngularFactor and LinearFactor for the type of vehicle. |
@@ -602,21 +602,21 @@ namespace OpenSim.Region.Physics.BulletSPlugin | |||
602 | m_physicsScene.PE.SetAngularFactorV(ControllingPrim.PhysBody, BSParam.VehicleAngularFactor); | 602 | m_physicsScene.PE.SetAngularFactorV(ControllingPrim.PhysBody, BSParam.VehicleAngularFactor); |
603 | 603 | ||
604 | // Vehicles report collision events so we know when it's on the ground | 604 | // Vehicles report collision events so we know when it's on the ground |
605 | m_physicsScene.PE.AddToCollisionFlags(ControllingPrim.PhysBody, CollisionFlags.BS_VEHICLE_COLLISIONS); | 605 | // m_physicsScene.PE.AddToCollisionFlags(ControllingPrim.PhysBody, CollisionFlags.BS_VEHICLE_COLLISIONS); |
606 | // ControllingPrim.Linkset.SetPhysicalCollisionFlags(CollisionFlags.BS_VEHICLE_COLLISIONS); | 606 | ControllingPrim.Linkset.AddToPhysicalCollisionFlags(CollisionFlags.BS_VEHICLE_COLLISIONS); |
607 | 607 | ||
608 | Vector3 inertia = m_physicsScene.PE.CalculateLocalInertia(ControllingPrim.PhysShape.physShapeInfo, m_vehicleMass); | 608 | // Vector3 inertia = m_physicsScene.PE.CalculateLocalInertia(ControllingPrim.PhysShape.physShapeInfo, m_vehicleMass); |
609 | ControllingPrim.Inertia = inertia * BSParam.VehicleInertiaFactor; | 609 | // ControllingPrim.Inertia = inertia * BSParam.VehicleInertiaFactor; |
610 | m_physicsScene.PE.SetMassProps(ControllingPrim.PhysBody, m_vehicleMass, ControllingPrim.Inertia); | 610 | // m_physicsScene.PE.SetMassProps(ControllingPrim.PhysBody, m_vehicleMass, ControllingPrim.Inertia); |
611 | m_physicsScene.PE.UpdateInertiaTensor(ControllingPrim.PhysBody); | 611 | // m_physicsScene.PE.UpdateInertiaTensor(ControllingPrim.PhysBody); |
612 | // ControllingPrim.Linkset.ComputeLocalInertia(BSParam.VehicleInertiaFactor); | 612 | ControllingPrim.Linkset.ComputeAndSetLocalInertia(BSParam.VehicleInertiaFactor, m_vehicleMass); |
613 | 613 | ||
614 | // Set the gravity for the vehicle depending on the buoyancy | 614 | // Set the gravity for the vehicle depending on the buoyancy |
615 | // TODO: what should be done if prim and vehicle buoyancy differ? | 615 | // TODO: what should be done if prim and vehicle buoyancy differ? |
616 | m_VehicleGravity = ControllingPrim.ComputeGravity(m_VehicleBuoyancy); | 616 | m_VehicleGravity = ControllingPrim.ComputeGravity(m_VehicleBuoyancy); |
617 | // The actual vehicle gravity is set to zero in Bullet so we can do all the application of same. | 617 | // The actual vehicle gravity is set to zero in Bullet so we can do all the application of same. |
618 | m_physicsScene.PE.SetGravity(ControllingPrim.PhysBody, Vector3.Zero); | 618 | // m_physicsScene.PE.SetGravity(ControllingPrim.PhysBody, Vector3.Zero); |
619 | // ControllingPrim.Linkset.SetPhysicalGravity(Vector3.Zero); | 619 | ControllingPrim.Linkset.SetPhysicalGravity(Vector3.Zero); |
620 | 620 | ||
621 | VDetailLog("{0},BSDynamics.SetPhysicalParameters,mass={1},inert={2},vehGrav={3},aDamp={4},frict={5},rest={6},lFact={7},aFact={8}", | 621 | VDetailLog("{0},BSDynamics.SetPhysicalParameters,mass={1},inert={2},vehGrav={3},aDamp={4},frict={5},rest={6},lFact={7},aFact={8}", |
622 | ControllingPrim.LocalID, m_vehicleMass, ControllingPrim.Inertia, m_VehicleGravity, | 622 | ControllingPrim.LocalID, m_vehicleMass, ControllingPrim.Inertia, m_VehicleGravity, |
@@ -1121,7 +1121,6 @@ namespace OpenSim.Region.Physics.BulletSPlugin | |||
1121 | { | 1121 | { |
1122 | m_VhoverTargetHeight = m_VhoverHeight; | 1122 | m_VhoverTargetHeight = m_VhoverHeight; |
1123 | } | 1123 | } |
1124 | |||
1125 | if ((m_flags & VehicleFlag.HOVER_UP_ONLY) != 0) | 1124 | if ((m_flags & VehicleFlag.HOVER_UP_ONLY) != 0) |
1126 | { | 1125 | { |
1127 | // If body is already heigher, use its height as target height | 1126 | // If body is already heigher, use its height as target height |
@@ -1170,7 +1169,6 @@ namespace OpenSim.Region.Physics.BulletSPlugin | |||
1170 | m_VhoverTimescale, m_VhoverHeight, m_VhoverTargetHeight, | 1169 | m_VhoverTimescale, m_VhoverHeight, m_VhoverTargetHeight, |
1171 | verticalError, verticalCorrection); | 1170 | verticalError, verticalCorrection); |
1172 | } | 1171 | } |
1173 | |||
1174 | } | 1172 | } |
1175 | } | 1173 | } |
1176 | 1174 | ||
@@ -1357,6 +1355,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin | |||
1357 | private void ComputeAngularTurning(float pTimestep) | 1355 | private void ComputeAngularTurning(float pTimestep) |
1358 | { | 1356 | { |
1359 | // The user wants this many radians per second angular change? | 1357 | // The user wants this many radians per second angular change? |
1358 | Vector3 origVehicleRotationalVelocity = VehicleRotationalVelocity; // DEBUG DEBUG | ||
1360 | Vector3 currentAngularV = VehicleRotationalVelocity * Quaternion.Inverse(VehicleOrientation); | 1359 | Vector3 currentAngularV = VehicleRotationalVelocity * Quaternion.Inverse(VehicleOrientation); |
1361 | Vector3 angularMotorContributionV = m_angularMotor.Step(pTimestep, currentAngularV); | 1360 | Vector3 angularMotorContributionV = m_angularMotor.Step(pTimestep, currentAngularV); |
1362 | 1361 | ||
@@ -1369,20 +1368,20 @@ namespace OpenSim.Region.Physics.BulletSPlugin | |||
1369 | // TODO: This is here because this is where ODE put it but documentation says it | 1368 | // TODO: This is here because this is where ODE put it but documentation says it |
1370 | // is a linear effect. Where should this check go? | 1369 | // is a linear effect. Where should this check go? |
1371 | //if ((m_flags & (VehicleFlag.NO_DEFLECTION_UP)) != 0) | 1370 | //if ((m_flags & (VehicleFlag.NO_DEFLECTION_UP)) != 0) |
1372 | // { | 1371 | // { |
1373 | // angularMotorContributionV.X = 0f; | 1372 | // angularMotorContributionV.X = 0f; |
1374 | // angularMotorContributionV.Y = 0f; | 1373 | // angularMotorContributionV.Y = 0f; |
1375 | // } | 1374 | // } |
1376 | 1375 | ||
1377 | // Reduce any velocity by friction. | 1376 | // Reduce any velocity by friction. |
1378 | Vector3 frictionFactorW = ComputeFrictionFactor(m_angularFrictionTimescale, pTimestep); | 1377 | Vector3 frictionFactorW = ComputeFrictionFactor(m_angularFrictionTimescale, pTimestep); |
1379 | angularMotorContributionV -= (currentAngularV * frictionFactorW); | 1378 | angularMotorContributionV -= (currentAngularV * frictionFactorW); |
1380 | 1379 | ||
1381 | VehicleRotationalVelocity += angularMotorContributionV * VehicleOrientation; | 1380 | Vector3 angularMotorContributionW = angularMotorContributionV * VehicleOrientation; |
1382 | 1381 | VehicleRotationalVelocity += angularMotorContributionW; | |
1383 | |||
1384 | 1382 | ||
1385 | VDetailLog("{0}, MoveAngular,angularTurning,angContribV={1}", ControllingPrim.LocalID, angularMotorContributionV); | 1383 | VDetailLog("{0}, MoveAngular,angularTurning,curAngVelV={1},origVehRotVel={2},vehRotVel={3},frictFact={4}, angContribV={5},angContribW={6}", |
1384 | ControllingPrim.LocalID, currentAngularV, origVehicleRotationalVelocity, VehicleRotationalVelocity, frictionFactorW, angularMotorContributionV, angularMotorContributionW); | ||
1386 | } | 1385 | } |
1387 | 1386 | ||
1388 | // From http://wiki.secondlife.com/wiki/Linden_Vehicle_Tutorial: | 1387 | // From http://wiki.secondlife.com/wiki/Linden_Vehicle_Tutorial: |
@@ -1409,7 +1408,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin | |||
1409 | 1408 | ||
1410 | // Flipping what was originally a timescale into a speed variable and then multiplying it by 2 | 1409 | // Flipping what was originally a timescale into a speed variable and then multiplying it by 2 |
1411 | // since only computing half the distance between the angles. | 1410 | // since only computing half the distance between the angles. |
1412 | float VerticalAttractionSpeed = (1 / m_verticalAttractionTimescale) * 2.0f; | 1411 | float verticalAttractionSpeed = (1 / m_verticalAttractionTimescale) * 2.0f; |
1413 | 1412 | ||
1414 | // Make a prediction of where the up axis will be when this is applied rather then where it is now as | 1413 | // Make a prediction of where the up axis will be when this is applied rather then where it is now as |
1415 | // this makes for a smoother adjustment and less fighting between the various forces. | 1414 | // this makes for a smoother adjustment and less fighting between the various forces. |
@@ -1419,12 +1418,13 @@ namespace OpenSim.Region.Physics.BulletSPlugin | |||
1419 | Vector3 torqueVector = Vector3.Cross(predictedUp, Vector3.UnitZ); | 1418 | Vector3 torqueVector = Vector3.Cross(predictedUp, Vector3.UnitZ); |
1420 | 1419 | ||
1421 | // Scale vector by our timescale since it is an acceleration it is r/s^2 or radians a timescale squared | 1420 | // Scale vector by our timescale since it is an acceleration it is r/s^2 or radians a timescale squared |
1422 | Vector3 vertContributionV = torqueVector * VerticalAttractionSpeed * VerticalAttractionSpeed; | 1421 | Vector3 vertContributionV = torqueVector * verticalAttractionSpeed * verticalAttractionSpeed; |
1423 | 1422 | ||
1424 | VehicleRotationalVelocity += vertContributionV; | 1423 | VehicleRotationalVelocity += vertContributionV; |
1425 | 1424 | ||
1426 | VDetailLog("{0}, MoveAngular,verticalAttraction,upAxis={1},PredictedUp={2},torqueVector={3},contrib={4}", | 1425 | VDetailLog("{0}, MoveAngular,verticalAttraction,vertAttrSpeed={1},upAxis={2},PredictedUp={3},torqueVector={4},contrib={5}", |
1427 | ControllingPrim.LocalID, | 1426 | ControllingPrim.LocalID, |
1427 | verticalAttractionSpeed, | ||
1428 | vehicleUpAxis, | 1428 | vehicleUpAxis, |
1429 | predictedUp, | 1429 | predictedUp, |
1430 | torqueVector, | 1430 | torqueVector, |
@@ -1437,37 +1437,38 @@ namespace OpenSim.Region.Physics.BulletSPlugin | |||
1437 | // http://stackoverflow.com/questions/14939657/computing-vector-from-quaternion-works-computing-quaternion-from-vector-does-no | 1437 | // http://stackoverflow.com/questions/14939657/computing-vector-from-quaternion-works-computing-quaternion-from-vector-does-no |
1438 | 1438 | ||
1439 | // Create a rotation that is only the vehicle's rotation around Z | 1439 | // Create a rotation that is only the vehicle's rotation around Z |
1440 | Vector3 currentEuler = Vector3.Zero; | 1440 | Vector3 currentEulerW = Vector3.Zero; |
1441 | VehicleOrientation.GetEulerAngles(out currentEuler.X, out currentEuler.Y, out currentEuler.Z); | 1441 | VehicleOrientation.GetEulerAngles(out currentEulerW.X, out currentEulerW.Y, out currentEulerW.Z); |
1442 | Quaternion justZOrientation = Quaternion.CreateFromAxisAngle(Vector3.UnitZ, currentEuler.Z); | 1442 | Quaternion justZOrientation = Quaternion.CreateFromAxisAngle(Vector3.UnitZ, currentEulerW.Z); |
1443 | 1443 | ||
1444 | // Create the axis that is perpendicular to the up vector and the rotated up vector. | 1444 | // Create the axis that is perpendicular to the up vector and the rotated up vector. |
1445 | Vector3 differenceAxis = Vector3.Cross(Vector3.UnitZ * justZOrientation, Vector3.UnitZ * VehicleOrientation); | 1445 | Vector3 differenceAxisW = Vector3.Cross(Vector3.UnitZ * justZOrientation, Vector3.UnitZ * VehicleOrientation); |
1446 | // Compute the angle between those to vectors. | 1446 | // Compute the angle between those to vectors. |
1447 | double differenceAngle = Math.Acos((double)Vector3.Dot(Vector3.UnitZ, Vector3.Normalize(Vector3.UnitZ * VehicleOrientation))); | 1447 | double differenceAngle = Math.Acos((double)Vector3.Dot(Vector3.UnitZ, Vector3.Normalize(Vector3.UnitZ * VehicleOrientation))); |
1448 | // 'differenceAngle' is the angle to rotate and 'differenceAxis' is the plane to rotate in to get the vehicle vertical | 1448 | // 'differenceAngle' is the angle to rotate and 'differenceAxis' is the plane to rotate in to get the vehicle vertical |
1449 | 1449 | ||
1450 | // Reduce the change by the time period it is to change in. Timestep is handled when velocity is applied. | 1450 | // Reduce the change by the time period it is to change in. Timestep is handled when velocity is applied. |
1451 | // TODO: add 'efficiency'. | 1451 | // TODO: add 'efficiency'. |
1452 | differenceAngle /= m_verticalAttractionTimescale; | 1452 | // differenceAngle /= m_verticalAttractionTimescale; |
1453 | 1453 | ||
1454 | // Create the quaterian representing the correction angle | 1454 | // Create the quaterian representing the correction angle |
1455 | Quaternion correctionRotation = Quaternion.CreateFromAxisAngle(differenceAxis, (float)differenceAngle); | 1455 | Quaternion correctionRotationW = Quaternion.CreateFromAxisAngle(differenceAxisW, (float)differenceAngle); |
1456 | 1456 | ||
1457 | // Turn that quaternion into Euler values to make it into velocities to apply. | 1457 | // Turn that quaternion into Euler values to make it into velocities to apply. |
1458 | Vector3 vertContributionV = Vector3.Zero; | 1458 | Vector3 vertContributionW = Vector3.Zero; |
1459 | correctionRotation.GetEulerAngles(out vertContributionV.X, out vertContributionV.Y, out vertContributionV.Z); | 1459 | correctionRotationW.GetEulerAngles(out vertContributionW.X, out vertContributionW.Y, out vertContributionW.Z); |
1460 | vertContributionV *= -1f; | 1460 | vertContributionW *= -1f; |
1461 | vertContributionW /= m_verticalAttractionTimescale; | ||
1461 | 1462 | ||
1462 | VehicleRotationalVelocity += vertContributionV; | 1463 | VehicleRotationalVelocity += vertContributionW; |
1463 | 1464 | ||
1464 | VDetailLog("{0}, MoveAngular,verticalAttraction,upAxis={1},diffAxis={2},diffAng={3},corrRot={4},contrib={5}", | 1465 | VDetailLog("{0}, MoveAngular,verticalAttraction,upAxis={1},diffAxis={2},diffAng={3},corrRot={4},contrib={5}", |
1465 | ControllingPrim.LocalID, | 1466 | ControllingPrim.LocalID, |
1466 | vehicleUpAxis, | 1467 | vehicleUpAxis, |
1467 | differenceAxis, | 1468 | differenceAxisW, |
1468 | differenceAngle, | 1469 | differenceAngle, |
1469 | correctionRotation, | 1470 | correctionRotationW, |
1470 | vertContributionV); | 1471 | vertContributionW); |
1471 | break; | 1472 | break; |
1472 | } | 1473 | } |
1473 | case 2: | 1474 | case 2: |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs b/OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs index 960c0b4..7f94666 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs | |||
@@ -309,16 +309,18 @@ public abstract class BSLinkset | |||
309 | } | 309 | } |
310 | ); | 310 | ); |
311 | } | 311 | } |
312 | public virtual void ComputeLocalInertia(OMV.Vector3 inertiaFactor) | 312 | public virtual void ComputeAndSetLocalInertia(OMV.Vector3 inertiaFactor, float linksetMass) |
313 | { | 313 | { |
314 | ForEachMember((member) => | 314 | ForEachMember((member) => |
315 | { | 315 | { |
316 | if (member.PhysBody.HasPhysicalBody) | 316 | if (member.PhysBody.HasPhysicalBody) |
317 | { | 317 | { |
318 | OMV.Vector3 inertia = m_physicsScene.PE.CalculateLocalInertia(member.PhysShape.physShapeInfo, member.Mass); | 318 | OMV.Vector3 inertia = m_physicsScene.PE.CalculateLocalInertia(member.PhysShape.physShapeInfo, linksetMass); |
319 | member.Inertia = inertia * inertiaFactor; | 319 | member.Inertia = inertia * inertiaFactor; |
320 | m_physicsScene.PE.SetMassProps(member.PhysBody, member.Mass, member.Inertia); | 320 | m_physicsScene.PE.SetMassProps(member.PhysBody, linksetMass, member.Inertia); |
321 | m_physicsScene.PE.UpdateInertiaTensor(member.PhysBody); | 321 | m_physicsScene.PE.UpdateInertiaTensor(member.PhysBody); |
322 | DetailLog("{0},BSLinkset.ComputeAndSetLocalInertia,m.mass={1}, inertia={2}", member.LocalID, linksetMass, member.Inertia); | ||
323 | |||
322 | } | 324 | } |
323 | return false; // 'false' says to continue looping | 325 | return false; // 'false' says to continue looping |
324 | } | 326 | } |
@@ -334,6 +336,16 @@ public abstract class BSLinkset | |||
334 | } | 336 | } |
335 | ); | 337 | ); |
336 | } | 338 | } |
339 | public virtual void AddToPhysicalCollisionFlags(CollisionFlags collFlags) | ||
340 | { | ||
341 | ForEachMember((member) => | ||
342 | { | ||
343 | if (member.PhysBody.HasPhysicalBody) | ||
344 | m_physicsScene.PE.AddToCollisionFlags(member.PhysBody, collFlags); | ||
345 | return false; // 'false' says to continue looping | ||
346 | } | ||
347 | ); | ||
348 | } | ||
337 | public virtual void RemoveFromPhysicalCollisionFlags(CollisionFlags collFlags) | 349 | public virtual void RemoveFromPhysicalCollisionFlags(CollisionFlags collFlags) |
338 | { | 350 | { |
339 | ForEachMember((member) => | 351 | ForEachMember((member) => |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs b/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs index 33ae5a5..6359046 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs | |||
@@ -61,11 +61,11 @@ public sealed class BSLinksetCompound : BSLinkset | |||
61 | if (LinksetRoot.PhysBody.HasPhysicalBody) | 61 | if (LinksetRoot.PhysBody.HasPhysicalBody) |
62 | m_physicsScene.PE.SetGravity(LinksetRoot.PhysBody, gravity); | 62 | m_physicsScene.PE.SetGravity(LinksetRoot.PhysBody, gravity); |
63 | } | 63 | } |
64 | public override void ComputeLocalInertia(OMV.Vector3 inertiaFactor) | 64 | public override void ComputeAndSetLocalInertia(OMV.Vector3 inertiaFactor, float linksetMass) |
65 | { | 65 | { |
66 | OMV.Vector3 inertia = m_physicsScene.PE.CalculateLocalInertia(LinksetRoot.PhysShape.physShapeInfo, LinksetRoot.Mass); | 66 | OMV.Vector3 inertia = m_physicsScene.PE.CalculateLocalInertia(LinksetRoot.PhysShape.physShapeInfo, linksetMass); |
67 | LinksetRoot.Inertia = inertia * inertiaFactor; | 67 | LinksetRoot.Inertia = inertia * inertiaFactor; |
68 | m_physicsScene.PE.SetMassProps(LinksetRoot.PhysBody, LinksetRoot.Mass, LinksetRoot.Inertia); | 68 | m_physicsScene.PE.SetMassProps(LinksetRoot.PhysBody, linksetMass, LinksetRoot.Inertia); |
69 | m_physicsScene.PE.UpdateInertiaTensor(LinksetRoot.PhysBody); | 69 | m_physicsScene.PE.UpdateInertiaTensor(LinksetRoot.PhysBody); |
70 | } | 70 | } |
71 | public override void SetPhysicalCollisionFlags(CollisionFlags collFlags) | 71 | public override void SetPhysicalCollisionFlags(CollisionFlags collFlags) |
@@ -73,6 +73,11 @@ public sealed class BSLinksetCompound : BSLinkset | |||
73 | if (LinksetRoot.PhysBody.HasPhysicalBody) | 73 | if (LinksetRoot.PhysBody.HasPhysicalBody) |
74 | m_physicsScene.PE.SetCollisionFlags(LinksetRoot.PhysBody, collFlags); | 74 | m_physicsScene.PE.SetCollisionFlags(LinksetRoot.PhysBody, collFlags); |
75 | } | 75 | } |
76 | public override void AddToPhysicalCollisionFlags(CollisionFlags collFlags) | ||
77 | { | ||
78 | if (LinksetRoot.PhysBody.HasPhysicalBody) | ||
79 | m_physicsScene.PE.AddToCollisionFlags(LinksetRoot.PhysBody, collFlags); | ||
80 | } | ||
76 | public override void RemoveFromPhysicalCollisionFlags(CollisionFlags collFlags) | 81 | public override void RemoveFromPhysicalCollisionFlags(CollisionFlags collFlags) |
77 | { | 82 | { |
78 | if (LinksetRoot.PhysBody.HasPhysicalBody) | 83 | if (LinksetRoot.PhysBody.HasPhysicalBody) |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs index 0bdb5f1..4520171 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs | |||
@@ -463,7 +463,7 @@ public static class BSParam | |||
463 | // Density is passed around as 100kg/m3. This scales that to 1kg/m3. | 463 | // Density is passed around as 100kg/m3. This scales that to 1kg/m3. |
464 | // Reduce by power of 100 because Bullet doesn't seem to handle objects with large mass very well | 464 | // Reduce by power of 100 because Bullet doesn't seem to handle objects with large mass very well |
465 | new ParameterDefn<float>("DensityScaleFactor", "Conversion for simulator/viewer density (100kg/m3) to physical density (1kg/m3)", | 465 | new ParameterDefn<float>("DensityScaleFactor", "Conversion for simulator/viewer density (100kg/m3) to physical density (1kg/m3)", |
466 | 0.0001f ), | 466 | 0.01f ), |
467 | 467 | ||
468 | new ParameterDefn<float>("PID_D", "Derivitive factor for motion smoothing", | 468 | new ParameterDefn<float>("PID_D", "Derivitive factor for motion smoothing", |
469 | 2200f ), | 469 | 2200f ), |
@@ -474,8 +474,9 @@ public static class BSParam | |||
474 | 0.2f, | 474 | 0.2f, |
475 | (s) => { return DefaultFriction; }, | 475 | (s) => { return DefaultFriction; }, |
476 | (s,v) => { DefaultFriction = v; s.UnmanagedParams[0].defaultFriction = v; } ), | 476 | (s,v) => { DefaultFriction = v; s.UnmanagedParams[0].defaultFriction = v; } ), |
477 | // For historical reasons, the viewer and simulator multiply the density by 100 | ||
477 | new ParameterDefn<float>("DefaultDensity", "Density for new objects" , | 478 | new ParameterDefn<float>("DefaultDensity", "Density for new objects" , |
478 | 10.000006836f, // Aluminum g/cm3 | 479 | 1000.0006836f, // Aluminum g/cm3 * 100 |
479 | (s) => { return DefaultDensity; }, | 480 | (s) => { return DefaultDensity; }, |
480 | (s,v) => { DefaultDensity = v; s.UnmanagedParams[0].defaultDensity = v; } ), | 481 | (s,v) => { DefaultDensity = v; s.UnmanagedParams[0].defaultDensity = v; } ), |
481 | new ParameterDefn<float>("DefaultRestitution", "Bouncyness of an object" , | 482 | new ParameterDefn<float>("DefaultRestitution", "Bouncyness of an object" , |
@@ -555,8 +556,9 @@ public static class BSParam | |||
555 | 0.95f ), | 556 | 0.95f ), |
556 | new ParameterDefn<float>("AvatarAlwaysRunFactor", "Speed multiplier if avatar is set to always run", | 557 | new ParameterDefn<float>("AvatarAlwaysRunFactor", "Speed multiplier if avatar is set to always run", |
557 | 1.3f ), | 558 | 1.3f ), |
558 | new ParameterDefn<float>("AvatarDensity", "Density of an avatar. Changed on avatar recreation.", | 559 | // For historical reasons, density is reported * 100 |
559 | 3.5f) , | 560 | new ParameterDefn<float>("AvatarDensity", "Density of an avatar. Changed on avatar recreation. Scaled times 100.", |
561 | 3500f) , // 3.5 * 100 | ||
560 | new ParameterDefn<float>("AvatarRestitution", "Bouncyness. Changed on avatar recreation.", | 562 | new ParameterDefn<float>("AvatarRestitution", "Bouncyness. Changed on avatar recreation.", |
561 | 0f ), | 563 | 0f ), |
562 | new ParameterDefn<float>("AvatarCapsuleWidth", "The distance between the sides of the avatar capsule", | 564 | new ParameterDefn<float>("AvatarCapsuleWidth", "The distance between the sides of the avatar capsule", |
@@ -608,9 +610,8 @@ public static class BSParam | |||
608 | 0.0f ), | 610 | 0.0f ), |
609 | new ParameterDefn<float>("VehicleRestitution", "Bouncyness factor for vehicles (0.0 - 1.0)", | 611 | new ParameterDefn<float>("VehicleRestitution", "Bouncyness factor for vehicles (0.0 - 1.0)", |
610 | 0.0f ), | 612 | 0.0f ), |
611 | // Turn off fudge with DensityScaleFactor = 0.0001. Value used to be 0.2f; | ||
612 | new ParameterDefn<float>("VehicleGroundGravityFudge", "Factor to multiply gravity if a ground vehicle is probably on the ground (0.0 - 1.0)", | 613 | new ParameterDefn<float>("VehicleGroundGravityFudge", "Factor to multiply gravity if a ground vehicle is probably on the ground (0.0 - 1.0)", |
613 | 1.0f ), | 614 | 0.2f ), |
614 | new ParameterDefn<float>("VehicleAngularBankingTimescaleFudge", "Factor to multiple angular banking timescale. Tune to increase realism.", | 615 | new ParameterDefn<float>("VehicleAngularBankingTimescaleFudge", "Factor to multiple angular banking timescale. Tune to increase realism.", |
615 | 60.0f ), | 616 | 60.0f ), |
616 | new ParameterDefn<bool>("VehicleEnableLinearDeflection", "Turn on/off vehicle linear deflection effect", | 617 | new ParameterDefn<bool>("VehicleEnableLinearDeflection", "Turn on/off vehicle linear deflection effect", |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs index d34b797..0704591 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs | |||
@@ -187,10 +187,23 @@ public abstract class BSPhysObject : PhysicsActor | |||
187 | MaterialAttributes matAttrib = BSMaterials.GetAttributes(Material, false); | 187 | MaterialAttributes matAttrib = BSMaterials.GetAttributes(Material, false); |
188 | Friction = matAttrib.friction; | 188 | Friction = matAttrib.friction; |
189 | Restitution = matAttrib.restitution; | 189 | Restitution = matAttrib.restitution; |
190 | Density = matAttrib.density / BSParam.DensityScaleFactor; | 190 | Density = matAttrib.density; |
191 | // DetailLog("{0},{1}.SetMaterial,Mat={2},frict={3},rest={4},den={5}", LocalID, TypeName, Material, Friction, Restitution, Density); | 191 | // DetailLog("{0},{1}.SetMaterial,Mat={2},frict={3},rest={4},den={5}", LocalID, TypeName, Material, Friction, Restitution, Density); |
192 | } | 192 | } |
193 | 193 | ||
194 | public override float Density | ||
195 | { | ||
196 | get | ||
197 | { | ||
198 | return base.Density; | ||
199 | } | ||
200 | set | ||
201 | { | ||
202 | DetailLog("{0},BSPhysObject.Density,set,den={1}", LocalID, value); | ||
203 | base.Density = value; | ||
204 | } | ||
205 | } | ||
206 | |||
194 | // Stop all physical motion. | 207 | // Stop all physical motion. |
195 | public abstract void ZeroMotion(bool inTaintTime); | 208 | public abstract void ZeroMotion(bool inTaintTime); |
196 | public abstract void ZeroAngularMotion(bool inTaintTime); | 209 | public abstract void ZeroAngularMotion(bool inTaintTime); |