aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2013-07-08 22:07:27 +0100
committerJustin Clark-Casey (justincc)2013-07-08 22:07:27 +0100
commitc3db5959441dbd1e04cdd32e92bda9eb5bf2853b (patch)
treea7b262be4f9f0dc0c7c5464ce5d657351c53a63e
parentAdd "show caps stats by user" and "show caps stats by cap" console commands t... (diff)
parentPlaced a throttle on UserManagementModule for name lookups. Singularity appar... (diff)
downloadopensim-SC_OLD-c3db5959441dbd1e04cdd32e92bda9eb5bf2853b.zip
opensim-SC_OLD-c3db5959441dbd1e04cdd32e92bda9eb5bf2853b.tar.gz
opensim-SC_OLD-c3db5959441dbd1e04cdd32e92bda9eb5bf2853b.tar.bz2
opensim-SC_OLD-c3db5959441dbd1e04cdd32e92bda9eb5bf2853b.tar.xz
Merge branch 'master' of ssh://opensimulator.org/var/git/opensim
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs32
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs4
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveLoadPathTests.cs12
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveSaveTests.cs2
-rw-r--r--OpenSim/Region/CoreModules/Framework/Library/LibraryModule.cs4
-rw-r--r--OpenSim/Region/CoreModules/Framework/UserManagement/HGUserManagementModule.cs2
-rw-r--r--OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs71
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs27
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs4
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs78
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs45
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs103
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSMotors.cs15
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSParam.cs3
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs7
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs95
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSPrimDisplaced.cs115
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSPrimLinkable.cs40
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSScene.cs1
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt75
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs26
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs2
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs10
-rw-r--r--OpenSim/Server/Handlers/Simulation/AgentHandlers.cs2
-rw-r--r--OpenSim/Services/Connectors/SimianGrid/SimianPresenceServiceConnector.cs3
-rw-r--r--OpenSim/Services/UserAccountService/GridUserService.cs2
-rw-r--r--bin/OpenSimDefaults.ini56
27 files changed, 477 insertions, 359 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs
index 98285e9..31c42d8 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs
@@ -67,10 +67,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
67 /// </summary> 67 /// </summary>
68 protected bool m_merge; 68 protected bool m_merge;
69 69
70 /// <value> 70 protected IInventoryService m_InventoryService;
71 /// We only use this to request modules 71 protected IAssetService m_AssetService;
72 /// </value> 72 protected IUserAccountService m_UserAccountService;
73 protected Scene m_scene;
74 73
75 /// <value> 74 /// <value>
76 /// The stream from which the inventory archive will be loaded. 75 /// The stream from which the inventory archive will be loaded.
@@ -118,9 +117,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
118 protected Dictionary<UUID, UUID> m_creatorIdForAssetId = new Dictionary<UUID, UUID>(); 117 protected Dictionary<UUID, UUID> m_creatorIdForAssetId = new Dictionary<UUID, UUID>();
119 118
120 public InventoryArchiveReadRequest( 119 public InventoryArchiveReadRequest(
121 Scene scene, UserAccount userInfo, string invPath, string loadPath, bool merge) 120 IInventoryService inv, IAssetService assets, IUserAccountService uacc, UserAccount userInfo, string invPath, string loadPath, bool merge)
122 : this( 121 : this(
123 scene, 122 inv,
123 assets,
124 uacc,
124 userInfo, 125 userInfo,
125 invPath, 126 invPath,
126 new GZipStream(ArchiveHelpers.GetStream(loadPath), CompressionMode.Decompress), 127 new GZipStream(ArchiveHelpers.GetStream(loadPath), CompressionMode.Decompress),
@@ -129,9 +130,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
129 } 130 }
130 131
131 public InventoryArchiveReadRequest( 132 public InventoryArchiveReadRequest(
132 Scene scene, UserAccount userInfo, string invPath, Stream loadStream, bool merge) 133 IInventoryService inv, IAssetService assets, IUserAccountService uacc, UserAccount userInfo, string invPath, Stream loadStream, bool merge)
133 { 134 {
134 m_scene = scene; 135 m_InventoryService = inv;
136 m_AssetService = assets;
137 m_UserAccountService = uacc;
135 m_merge = merge; 138 m_merge = merge;
136 m_userInfo = userInfo; 139 m_userInfo = userInfo;
137 m_invPath = invPath; 140 m_invPath = invPath;
@@ -162,7 +165,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
162 165
163 List<InventoryFolderBase> folderCandidates 166 List<InventoryFolderBase> folderCandidates
164 = InventoryArchiveUtils.FindFoldersByPath( 167 = InventoryArchiveUtils.FindFoldersByPath(
165 m_scene.InventoryService, m_userInfo.PrincipalID, m_invPath); 168 m_InventoryService, m_userInfo.PrincipalID, m_invPath);
166 169
167 if (folderCandidates.Count == 0) 170 if (folderCandidates.Count == 0)
168 { 171 {
@@ -297,7 +300,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
297 string plainPath = ArchiveConstants.ExtractPlainPathFromIarPath(archivePath); 300 string plainPath = ArchiveConstants.ExtractPlainPathFromIarPath(archivePath);
298 List<InventoryFolderBase> folderCandidates 301 List<InventoryFolderBase> folderCandidates
299 = InventoryArchiveUtils.FindFoldersByPath( 302 = InventoryArchiveUtils.FindFoldersByPath(
300 m_scene.InventoryService, m_userInfo.PrincipalID, plainPath); 303 m_InventoryService, m_userInfo.PrincipalID, plainPath);
301 304
302 if (folderCandidates.Count != 0) 305 if (folderCandidates.Count != 0)
303 { 306 {
@@ -380,7 +383,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
380 = new InventoryFolderBase( 383 = new InventoryFolderBase(
381 newFolderId, newFolderName, m_userInfo.PrincipalID, 384 newFolderId, newFolderName, m_userInfo.PrincipalID,
382 (short)AssetType.Unknown, destFolder.ID, 1); 385 (short)AssetType.Unknown, destFolder.ID, 1);
383 m_scene.InventoryService.AddFolder(destFolder); 386 m_InventoryService.AddFolder(destFolder);
384 387
385 // Record that we have now created this folder 388 // Record that we have now created this folder
386 iarPathExisting += rawDirsToCreate[i] + "/"; 389 iarPathExisting += rawDirsToCreate[i] + "/";
@@ -406,7 +409,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
406 // Don't use the item ID that's in the file 409 // Don't use the item ID that's in the file
407 item.ID = UUID.Random(); 410 item.ID = UUID.Random();
408 411
409 UUID ospResolvedId = OspResolver.ResolveOspa(item.CreatorId, m_scene.UserAccountService); 412 UUID ospResolvedId = OspResolver.ResolveOspa(item.CreatorId, m_UserAccountService);
410 if (UUID.Zero != ospResolvedId) // The user exists in this grid 413 if (UUID.Zero != ospResolvedId) // The user exists in this grid
411 { 414 {
412// m_log.DebugFormat("[INVENTORY ARCHIVER]: Found creator {0} via OSPA resolution", ospResolvedId); 415// m_log.DebugFormat("[INVENTORY ARCHIVER]: Found creator {0} via OSPA resolution", ospResolvedId);
@@ -436,7 +439,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
436 // relying on native tar tools. 439 // relying on native tar tools.
437 m_creatorIdForAssetId[item.AssetID] = item.CreatorIdAsUuid; 440 m_creatorIdForAssetId[item.AssetID] = item.CreatorIdAsUuid;
438 441
439 m_scene.AddInventoryItem(item); 442 if (!m_InventoryService.AddItem(item))
443 m_log.WarnFormat("[INVENTORY ARCHIVER]: Unable to save item {0} in folder {1}", item.Name, item.Folder);
440 444
441 return item; 445 return item;
442 } 446 }
@@ -533,7 +537,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
533 AssetBase asset = new AssetBase(assetId, "From IAR", assetType, UUID.Zero.ToString()); 537 AssetBase asset = new AssetBase(assetId, "From IAR", assetType, UUID.Zero.ToString());
534 asset.Data = data; 538 asset.Data = data;
535 539
536 m_scene.AssetService.Store(asset); 540 m_AssetService.Store(asset);
537 541
538 return true; 542 return true;
539 } 543 }
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs
index 849449b..797097f 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs
@@ -294,7 +294,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
294 294
295 try 295 try
296 { 296 {
297 request = new InventoryArchiveReadRequest(m_aScene, userInfo, invPath, loadStream, merge); 297 request = new InventoryArchiveReadRequest(m_aScene.InventoryService, m_aScene.AssetService, m_aScene.UserAccountService, userInfo, invPath, loadStream, merge);
298 } 298 }
299 catch (EntryPointNotFoundException e) 299 catch (EntryPointNotFoundException e)
300 { 300 {
@@ -342,7 +342,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
342 342
343 try 343 try
344 { 344 {
345 request = new InventoryArchiveReadRequest(m_aScene, userInfo, invPath, loadPath, merge); 345 request = new InventoryArchiveReadRequest(m_aScene.InventoryService, m_aScene.AssetService, m_aScene.UserAccountService, userInfo, invPath, loadPath, merge);
346 } 346 }
347 catch (EntryPointNotFoundException e) 347 catch (EntryPointNotFoundException e)
348 { 348 {
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveLoadPathTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveLoadPathTests.cs
index 95f562e..08f199a 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveLoadPathTests.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveLoadPathTests.cs
@@ -229,7 +229,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
229 229
230 { 230 {
231 // Test replication of path1 231 // Test replication of path1
232 new InventoryArchiveReadRequest(scene, ua1, null, (Stream)null, false) 232 new InventoryArchiveReadRequest(scene.InventoryService, scene.AssetService, scene.UserAccountService, ua1, null, (Stream)null, false)
233 .ReplicateArchivePathToUserInventory( 233 .ReplicateArchivePathToUserInventory(
234 iarPath1, scene.InventoryService.GetRootFolder(ua1.PrincipalID), 234 iarPath1, scene.InventoryService.GetRootFolder(ua1.PrincipalID),
235 foldersCreated, nodesLoaded); 235 foldersCreated, nodesLoaded);
@@ -246,7 +246,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
246 246
247 { 247 {
248 // Test replication of path2 248 // Test replication of path2
249 new InventoryArchiveReadRequest(scene, ua1, null, (Stream)null, false) 249 new InventoryArchiveReadRequest(scene.InventoryService, scene.AssetService, scene.UserAccountService, ua1, null, (Stream)null, false)
250 .ReplicateArchivePathToUserInventory( 250 .ReplicateArchivePathToUserInventory(
251 iarPath2, scene.InventoryService.GetRootFolder(ua1.PrincipalID), 251 iarPath2, scene.InventoryService.GetRootFolder(ua1.PrincipalID),
252 foldersCreated, nodesLoaded); 252 foldersCreated, nodesLoaded);
@@ -291,8 +291,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
291 string folder2ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder2Name, UUID.Random()); 291 string folder2ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder2Name, UUID.Random());
292 292
293 string itemArchivePath = string.Join("", new string[] { folder1ArchiveName, folder2ArchiveName }); 293 string itemArchivePath = string.Join("", new string[] { folder1ArchiveName, folder2ArchiveName });
294 294
295 new InventoryArchiveReadRequest(scene, ua1, null, (Stream)null, false) 295 new InventoryArchiveReadRequest(scene.InventoryService, scene.AssetService, scene.UserAccountService, ua1, null, (Stream)null, false)
296 .ReplicateArchivePathToUserInventory( 296 .ReplicateArchivePathToUserInventory(
297 itemArchivePath, scene.InventoryService.GetRootFolder(ua1.PrincipalID), 297 itemArchivePath, scene.InventoryService.GetRootFolder(ua1.PrincipalID),
298 new Dictionary<string, InventoryFolderBase>(), new HashSet<InventoryNodeBase>()); 298 new Dictionary<string, InventoryFolderBase>(), new HashSet<InventoryNodeBase>());
@@ -342,8 +342,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
342 string folder2ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder2Name, UUID.Random()); 342 string folder2ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder2Name, UUID.Random());
343 343
344 string itemArchivePath = string.Join("", new string[] { folder1ArchiveName, folder2ArchiveName }); 344 string itemArchivePath = string.Join("", new string[] { folder1ArchiveName, folder2ArchiveName });
345 345
346 new InventoryArchiveReadRequest(scene, ua1, folder1ExistingName, (Stream)null, true) 346 new InventoryArchiveReadRequest(scene.InventoryService, scene.AssetService, scene.UserAccountService, ua1, folder1ExistingName, (Stream)null, true)
347 .ReplicateArchivePathToUserInventory( 347 .ReplicateArchivePathToUserInventory(
348 itemArchivePath, scene.InventoryService.GetRootFolder(ua1.PrincipalID), 348 itemArchivePath, scene.InventoryService.GetRootFolder(ua1.PrincipalID),
349 new Dictionary<string, InventoryFolderBase>(), new HashSet<InventoryNodeBase>()); 349 new Dictionary<string, InventoryFolderBase>(), new HashSet<InventoryNodeBase>());
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveSaveTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveSaveTests.cs
index 5e7e24c..b85739e 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveSaveTests.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveSaveTests.cs
@@ -86,7 +86,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
86 Assert.That(filePath, Is.EqualTo(ArchiveConstants.CONTROL_FILE_PATH)); 86 Assert.That(filePath, Is.EqualTo(ArchiveConstants.CONTROL_FILE_PATH));
87 87
88 InventoryArchiveReadRequest iarr 88 InventoryArchiveReadRequest iarr
89 = new InventoryArchiveReadRequest(null, null, null, (Stream)null, false); 89 = new InventoryArchiveReadRequest(null, null, null, null, null, (Stream)null, false);
90 iarr.LoadControlFile(filePath, data); 90 iarr.LoadControlFile(filePath, data);
91 91
92 Assert.That(iarr.ControlFileLoaded, Is.True); 92 Assert.That(iarr.ControlFileLoaded, Is.True);
diff --git a/OpenSim/Region/CoreModules/Framework/Library/LibraryModule.cs b/OpenSim/Region/CoreModules/Framework/Library/LibraryModule.cs
index d07cff4..69d7e16 100644
--- a/OpenSim/Region/CoreModules/Framework/Library/LibraryModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/Library/LibraryModule.cs
@@ -176,7 +176,7 @@ namespace OpenSim.Region.CoreModules.Framework.Library
176 m_log.InfoFormat("[LIBRARY MODULE]: Loading library archive {0} ({1})...", iarFileName, simpleName); 176 m_log.InfoFormat("[LIBRARY MODULE]: Loading library archive {0} ({1})...", iarFileName, simpleName);
177 simpleName = GetInventoryPathFromName(simpleName); 177 simpleName = GetInventoryPathFromName(simpleName);
178 178
179 InventoryArchiveReadRequest archread = new InventoryArchiveReadRequest(m_MockScene, uinfo, simpleName, iarFileName, false); 179 InventoryArchiveReadRequest archread = new InventoryArchiveReadRequest(m_MockScene.InventoryService, m_MockScene.AssetService, m_MockScene.UserAccountService, uinfo, simpleName, iarFileName, false);
180 try 180 try
181 { 181 {
182 HashSet<InventoryNodeBase> nodes = archread.Execute(); 182 HashSet<InventoryNodeBase> nodes = archread.Execute();
@@ -185,7 +185,7 @@ namespace OpenSim.Region.CoreModules.Framework.Library
185 // didn't find the subfolder with the given name; place it on the top 185 // didn't find the subfolder with the given name; place it on the top
186 m_log.InfoFormat("[LIBRARY MODULE]: Didn't find {0} in library. Placing archive on the top level", simpleName); 186 m_log.InfoFormat("[LIBRARY MODULE]: Didn't find {0} in library. Placing archive on the top level", simpleName);
187 archread.Close(); 187 archread.Close();
188 archread = new InventoryArchiveReadRequest(m_MockScene, uinfo, "/", iarFileName, false); 188 archread = new InventoryArchiveReadRequest(m_MockScene.InventoryService, m_MockScene.AssetService, m_MockScene.UserAccountService, uinfo, "/", iarFileName, false);
189 archread.Execute(); 189 archread.Execute();
190 } 190 }
191 191
diff --git a/OpenSim/Region/CoreModules/Framework/UserManagement/HGUserManagementModule.cs b/OpenSim/Region/CoreModules/Framework/UserManagement/HGUserManagementModule.cs
index ad3cf15..245c808 100644
--- a/OpenSim/Region/CoreModules/Framework/UserManagement/HGUserManagementModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/UserManagement/HGUserManagementModule.cs
@@ -58,7 +58,7 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
58 if (umanmod == Name) 58 if (umanmod == Name)
59 { 59 {
60 m_Enabled = true; 60 m_Enabled = true;
61 RegisterConsoleCmds(); 61 Init();
62 m_log.DebugFormat("[USER MANAGEMENT MODULE]: {0} is enabled", Name); 62 m_log.DebugFormat("[USER MANAGEMENT MODULE]: {0} is enabled", Name);
63 } 63 }
64 } 64 }
diff --git a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs
index a7cbc8f..a528093 100644
--- a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs
@@ -28,9 +28,11 @@ using System;
28using System.Collections.Generic; 28using System.Collections.Generic;
29using System.IO; 29using System.IO;
30using System.Reflection; 30using System.Reflection;
31using System.Threading;
31 32
32using OpenSim.Framework; 33using OpenSim.Framework;
33using OpenSim.Framework.Console; 34using OpenSim.Framework.Console;
35using OpenSim.Framework.Monitoring;
34using OpenSim.Region.ClientStack.LindenUDP; 36using OpenSim.Region.ClientStack.LindenUDP;
35using OpenSim.Region.Framework; 37using OpenSim.Region.Framework;
36using OpenSim.Region.Framework.Interfaces; 38using OpenSim.Region.Framework.Interfaces;
@@ -57,6 +59,10 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
57 // The cache 59 // The cache
58 protected Dictionary<UUID, UserData> m_UserCache = new Dictionary<UUID, UserData>(); 60 protected Dictionary<UUID, UserData> m_UserCache = new Dictionary<UUID, UserData>();
59 61
62 // Throttle the name requests
63 private OpenSim.Framework.BlockingQueue<NameRequest> m_RequestQueue = new OpenSim.Framework.BlockingQueue<NameRequest>();
64
65
60 #region ISharedRegionModule 66 #region ISharedRegionModule
61 67
62 public void Initialise(IConfigSource config) 68 public void Initialise(IConfigSource config)
@@ -65,7 +71,7 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
65 if (umanmod == Name) 71 if (umanmod == Name)
66 { 72 {
67 m_Enabled = true; 73 m_Enabled = true;
68 RegisterConsoleCmds(); 74 Init();
69 m_log.DebugFormat("[USER MANAGEMENT MODULE]: {0} is enabled", Name); 75 m_log.DebugFormat("[USER MANAGEMENT MODULE]: {0} is enabled", Name);
70 } 76 }
71 } 77 }
@@ -160,16 +166,9 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
160 } 166 }
161 else 167 else
162 { 168 {
163 string[] names; 169 NameRequest request = new NameRequest(remote_client, uuid);
164 bool foundRealName = TryGetUserNames(uuid, out names); 170 m_RequestQueue.Enqueue(request);
165 171
166 if (names.Length == 2)
167 {
168 if (!foundRealName)
169 m_log.DebugFormat("[USER MANAGEMENT MODULE]: Sending {0} {1} for {2} to {3} since no bound name found", names[0], names[1], uuid, remote_client.Name);
170
171 remote_client.SendNameReply(uuid, names[0], names[1]);
172 }
173 } 172 }
174 } 173 }
175 174
@@ -514,9 +513,8 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
514 return; 513 return;
515 } 514 }
516 515
517 //try update unknown users 516 //try update unknown users, but don't update anyone else
518 //and creator's home URL's 517 if (oldUser.FirstName == "Unknown" && !creatorData.Contains("Unknown"))
519 if ((oldUser.FirstName == "Unknown" && !creatorData.Contains("Unknown")) || (oldUser.HomeURL != null && !creatorData.StartsWith(oldUser.HomeURL)))
520 { 518 {
521 lock (m_UserCache) 519 lock (m_UserCache)
522 m_UserCache.Remove(id); 520 m_UserCache.Remove(id);
@@ -597,6 +595,18 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
597 595
598 #endregion IUserManagement 596 #endregion IUserManagement
599 597
598 protected void Init()
599 {
600 RegisterConsoleCmds();
601 Watchdog.StartThread(
602 ProcessQueue,
603 "NameRequestThread",
604 ThreadPriority.BelowNormal,
605 true,
606 false);
607
608 }
609
600 protected void RegisterConsoleCmds() 610 protected void RegisterConsoleCmds()
601 { 611 {
602 MainConsole.Instance.Commands.AddCommand("Users", true, 612 MainConsole.Instance.Commands.AddCommand("Users", true,
@@ -663,5 +673,40 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
663 673
664 MainConsole.Instance.Output(cdt.ToString()); 674 MainConsole.Instance.Output(cdt.ToString());
665 } 675 }
676
677 private void ProcessQueue()
678 {
679 while (true)
680 {
681 Watchdog.UpdateThread();
682
683 NameRequest request = m_RequestQueue.Dequeue();
684 string[] names;
685 bool foundRealName = TryGetUserNames(request.uuid, out names);
686
687 if (names.Length == 2)
688 {
689 if (!foundRealName)
690 m_log.DebugFormat("[USER MANAGEMENT MODULE]: Sending {0} {1} for {2} to {3} since no bound name found", names[0], names[1], request.uuid, request.client.Name);
691
692 request.client.SendNameReply(request.uuid, names[0], names[1]);
693 }
694
695 }
696 }
697
698 }
699
700 class NameRequest
701 {
702 public IClientAPI client;
703 public UUID uuid;
704
705 public NameRequest(IClientAPI c, UUID n)
706 {
707 client = c;
708 uuid = n;
709 }
666 } 710 }
711
667} \ No newline at end of file 712} \ No newline at end of file
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs
index 70ba944..7f78076 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs
@@ -195,19 +195,20 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
195 { 195 {
196 InventoryCollection invCol = m_RemoteConnector.GetFolderContent(userID, folderID); 196 InventoryCollection invCol = m_RemoteConnector.GetFolderContent(userID, folderID);
197 197
198 if (invCol != null && UserManager != null) 198 // Commenting this for now, because it's causing more grief than good
199 { 199 //if (invCol != null && UserManager != null)
200 // Protect ourselves against the caller subsequently modifying the items list 200 //{
201 List<InventoryItemBase> items = new List<InventoryItemBase>(invCol.Items); 201 // // Protect ourselves against the caller subsequently modifying the items list
202 202 // List<InventoryItemBase> items = new List<InventoryItemBase>(invCol.Items);
203 if (items != null && items.Count > 0) 203
204 Util.FireAndForget(delegate 204 // if (items != null && items.Count > 0)
205 { 205 // //Util.FireAndForget(delegate
206 foreach (InventoryItemBase item in items) 206 // //{
207 if (!string.IsNullOrEmpty(item.CreatorData)) 207 // foreach (InventoryItemBase item in items)
208 UserManager.AddUser(item.CreatorIdAsUuid, item.CreatorData); 208 // if (!string.IsNullOrEmpty(item.CreatorData))
209 }); 209 // UserManager.AddUser(item.CreatorIdAsUuid, item.CreatorData);
210 } 210 // //});
211 //}
211 212
212 return invCol; 213 return invCol;
213 } 214 }
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 482d958..f287a34 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -505,7 +505,11 @@ namespace OpenSim.Region.Framework.Scenes
505 CreatorID = uuid; 505 CreatorID = uuid;
506 } 506 }
507 if (parts.Length >= 2) 507 if (parts.Length >= 2)
508 {
508 CreatorData = parts[1]; 509 CreatorData = parts[1];
510 if (!CreatorData.EndsWith("/"))
511 CreatorData += "/";
512 }
509 if (parts.Length >= 3) 513 if (parts.Length >= 3)
510 name = parts[2]; 514 name = parts[2];
511 515
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs
index 5ef6992..c9e3ca0 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs
@@ -43,12 +43,10 @@ public sealed class BSCharacter : BSPhysObject
43 private OMV.Vector3 _size; 43 private OMV.Vector3 _size;
44 private bool _grabbed; 44 private bool _grabbed;
45 private bool _selected; 45 private bool _selected;
46 private OMV.Vector3 _position;
47 private float _mass; 46 private float _mass;
48 private float _avatarVolume; 47 private float _avatarVolume;
49 private float _collisionScore; 48 private float _collisionScore;
50 private OMV.Vector3 _acceleration; 49 private OMV.Vector3 _acceleration;
51 private OMV.Quaternion _orientation;
52 private int _physicsActorType; 50 private int _physicsActorType;
53 private bool _isPhysical; 51 private bool _isPhysical;
54 private bool _flying; 52 private bool _flying;
@@ -70,10 +68,10 @@ public sealed class BSCharacter : BSPhysObject
70 : base(parent_scene, localID, avName, "BSCharacter") 68 : base(parent_scene, localID, avName, "BSCharacter")
71 { 69 {
72 _physicsActorType = (int)ActorTypes.Agent; 70 _physicsActorType = (int)ActorTypes.Agent;
73 _position = pos; 71 RawPosition = pos;
74 72
75 _flying = isFlying; 73 _flying = isFlying;
76 _orientation = OMV.Quaternion.Identity; 74 RawOrientation = OMV.Quaternion.Identity;
77 RawVelocity = OMV.Vector3.Zero; 75 RawVelocity = OMV.Vector3.Zero;
78 _buoyancy = ComputeBuoyancyFromFlying(isFlying); 76 _buoyancy = ComputeBuoyancyFromFlying(isFlying);
79 Friction = BSParam.AvatarStandingFriction; 77 Friction = BSParam.AvatarStandingFriction;
@@ -133,7 +131,7 @@ public sealed class BSCharacter : BSPhysObject
133 PhysScene.PE.RemoveObjectFromWorld(PhysScene.World, PhysBody); 131 PhysScene.PE.RemoveObjectFromWorld(PhysScene.World, PhysBody);
134 132
135 ZeroMotion(true); 133 ZeroMotion(true);
136 ForcePosition = _position; 134 ForcePosition = RawPosition;
137 135
138 // Set the velocity 136 // Set the velocity
139 if (m_moveActor != null) 137 if (m_moveActor != null)
@@ -272,38 +270,33 @@ public sealed class BSCharacter : BSPhysObject
272 270
273 public override void LockAngularMotion(OMV.Vector3 axis) { return; } 271 public override void LockAngularMotion(OMV.Vector3 axis) { return; }
274 272
275 public override OMV.Vector3 RawPosition
276 {
277 get { return _position; }
278 set { _position = value; }
279 }
280 public override OMV.Vector3 Position { 273 public override OMV.Vector3 Position {
281 get { 274 get {
282 // Don't refetch the position because this function is called a zillion times 275 // Don't refetch the position because this function is called a zillion times
283 // _position = PhysicsScene.PE.GetObjectPosition(Scene.World, LocalID); 276 // RawPosition = PhysicsScene.PE.GetObjectPosition(Scene.World, LocalID);
284 return _position; 277 return RawPosition;
285 } 278 }
286 set { 279 set {
287 _position = value; 280 RawPosition = value;
288 281
289 PhysScene.TaintedObject("BSCharacter.setPosition", delegate() 282 PhysScene.TaintedObject("BSCharacter.setPosition", delegate()
290 { 283 {
291 DetailLog("{0},BSCharacter.SetPosition,taint,pos={1},orient={2}", LocalID, _position, _orientation); 284 DetailLog("{0},BSCharacter.SetPosition,taint,pos={1},orient={2}", LocalID, RawPosition, RawOrientation);
292 PositionSanityCheck(); 285 PositionSanityCheck();
293 ForcePosition = _position; 286 ForcePosition = RawPosition;
294 }); 287 });
295 } 288 }
296 } 289 }
297 public override OMV.Vector3 ForcePosition { 290 public override OMV.Vector3 ForcePosition {
298 get { 291 get {
299 _position = PhysScene.PE.GetPosition(PhysBody); 292 RawPosition = PhysScene.PE.GetPosition(PhysBody);
300 return _position; 293 return RawPosition;
301 } 294 }
302 set { 295 set {
303 _position = value; 296 RawPosition = value;
304 if (PhysBody.HasPhysicalBody) 297 if (PhysBody.HasPhysicalBody)
305 { 298 {
306 PhysScene.PE.SetTranslation(PhysBody, _position, _orientation); 299 PhysScene.PE.SetTranslation(PhysBody, RawPosition, RawOrientation);
307 } 300 }
308 } 301 }
309 } 302 }
@@ -331,16 +324,16 @@ public sealed class BSCharacter : BSPhysObject
331 float terrainHeight = PhysScene.TerrainManager.GetTerrainHeightAtXYZ(RawPosition); 324 float terrainHeight = PhysScene.TerrainManager.GetTerrainHeightAtXYZ(RawPosition);
332 if (Position.Z < terrainHeight) 325 if (Position.Z < terrainHeight)
333 { 326 {
334 DetailLog("{0},BSCharacter.PositionSanityCheck,adjustForUnderGround,pos={1},terrain={2}", LocalID, _position, terrainHeight); 327 DetailLog("{0},BSCharacter.PositionSanityCheck,adjustForUnderGround,pos={1},terrain={2}", LocalID, RawPosition, terrainHeight);
335 _position.Z = terrainHeight + BSParam.AvatarBelowGroundUpCorrectionMeters; 328 RawPosition = new OMV.Vector3(RawPosition.X, RawPosition.Y, terrainHeight + BSParam.AvatarBelowGroundUpCorrectionMeters);
336 ret = true; 329 ret = true;
337 } 330 }
338 if ((CurrentCollisionFlags & CollisionFlags.BS_FLOATS_ON_WATER) != 0) 331 if ((CurrentCollisionFlags & CollisionFlags.BS_FLOATS_ON_WATER) != 0)
339 { 332 {
340 float waterHeight = PhysScene.TerrainManager.GetWaterLevelAtXYZ(_position); 333 float waterHeight = PhysScene.TerrainManager.GetWaterLevelAtXYZ(RawPosition);
341 if (Position.Z < waterHeight) 334 if (Position.Z < waterHeight)
342 { 335 {
343 _position.Z = waterHeight; 336 RawPosition = new OMV.Vector3(RawPosition.X, RawPosition.Y, waterHeight);
344 ret = true; 337 ret = true;
345 } 338 }
346 } 339 }
@@ -360,8 +353,8 @@ public sealed class BSCharacter : BSPhysObject
360 // just assign to "Position" because of potential call loops. 353 // just assign to "Position" because of potential call loops.
361 PhysScene.TaintedObject(inTaintTime, "BSCharacter.PositionSanityCheck", delegate() 354 PhysScene.TaintedObject(inTaintTime, "BSCharacter.PositionSanityCheck", delegate()
362 { 355 {
363 DetailLog("{0},BSCharacter.PositionSanityCheck,taint,pos={1},orient={2}", LocalID, _position, _orientation); 356 DetailLog("{0},BSCharacter.PositionSanityCheck,taint,pos={1},orient={2}", LocalID, RawPosition, RawOrientation);
364 ForcePosition = _position; 357 ForcePosition = RawPosition;
365 }); 358 });
366 ret = true; 359 ret = true;
367 } 360 }
@@ -466,19 +459,14 @@ public sealed class BSCharacter : BSPhysObject
466 get { return _acceleration; } 459 get { return _acceleration; }
467 set { _acceleration = value; } 460 set { _acceleration = value; }
468 } 461 }
469 public override OMV.Quaternion RawOrientation
470 {
471 get { return _orientation; }
472 set { _orientation = value; }
473 }
474 public override OMV.Quaternion Orientation { 462 public override OMV.Quaternion Orientation {
475 get { return _orientation; } 463 get { return RawOrientation; }
476 set { 464 set {
477 // Orientation is set zillions of times when an avatar is walking. It's like 465 // Orientation is set zillions of times when an avatar is walking. It's like
478 // the viewer doesn't trust us. 466 // the viewer doesn't trust us.
479 if (_orientation != value) 467 if (RawOrientation != value)
480 { 468 {
481 _orientation = value; 469 RawOrientation = value;
482 PhysScene.TaintedObject("BSCharacter.setOrientation", delegate() 470 PhysScene.TaintedObject("BSCharacter.setOrientation", delegate()
483 { 471 {
484 // Bullet assumes we know what we are doing when forcing orientation 472 // Bullet assumes we know what we are doing when forcing orientation
@@ -486,10 +474,10 @@ public sealed class BSCharacter : BSPhysObject
486 // This forces rotation to be only around the Z axis and doesn't change any of the other axis. 474 // This forces rotation to be only around the Z axis and doesn't change any of the other axis.
487 // This keeps us from flipping the capsule over which the veiwer does not understand. 475 // This keeps us from flipping the capsule over which the veiwer does not understand.
488 float oRoll, oPitch, oYaw; 476 float oRoll, oPitch, oYaw;
489 _orientation.GetEulerAngles(out oRoll, out oPitch, out oYaw); 477 RawOrientation.GetEulerAngles(out oRoll, out oPitch, out oYaw);
490 OMV.Quaternion trimmedOrientation = OMV.Quaternion.CreateFromEulers(0f, 0f, oYaw); 478 OMV.Quaternion trimmedOrientation = OMV.Quaternion.CreateFromEulers(0f, 0f, oYaw);
491 // DetailLog("{0},BSCharacter.setOrientation,taint,val={1},valDir={2},conv={3},convDir={4}", 479 // DetailLog("{0},BSCharacter.setOrientation,taint,val={1},valDir={2},conv={3},convDir={4}",
492 // LocalID, _orientation, OMV.Vector3.UnitX * _orientation, 480 // LocalID, RawOrientation, OMV.Vector3.UnitX * RawOrientation,
493 // trimmedOrientation, OMV.Vector3.UnitX * trimmedOrientation); 481 // trimmedOrientation, OMV.Vector3.UnitX * trimmedOrientation);
494 ForceOrientation = trimmedOrientation; 482 ForceOrientation = trimmedOrientation;
495 }); 483 });
@@ -501,16 +489,16 @@ public sealed class BSCharacter : BSPhysObject
501 { 489 {
502 get 490 get
503 { 491 {
504 _orientation = PhysScene.PE.GetOrientation(PhysBody); 492 RawOrientation = PhysScene.PE.GetOrientation(PhysBody);
505 return _orientation; 493 return RawOrientation;
506 } 494 }
507 set 495 set
508 { 496 {
509 _orientation = value; 497 RawOrientation = value;
510 if (PhysBody.HasPhysicalBody) 498 if (PhysBody.HasPhysicalBody)
511 { 499 {
512 // _position = PhysicsScene.PE.GetPosition(BSBody); 500 // RawPosition = PhysicsScene.PE.GetPosition(BSBody);
513 PhysScene.PE.SetTranslation(PhysBody, _position, _orientation); 501 PhysScene.PE.SetTranslation(PhysBody, RawPosition, RawOrientation);
514 } 502 }
515 } 503 }
516 } 504 }
@@ -723,9 +711,9 @@ public sealed class BSCharacter : BSPhysObject
723 { 711 {
724 // Don't change position if standing on a stationary object. 712 // Don't change position if standing on a stationary object.
725 if (!IsStationary) 713 if (!IsStationary)
726 _position = entprop.Position; 714 RawPosition = entprop.Position;
727 715
728 _orientation = entprop.Rotation; 716 RawOrientation = entprop.Rotation;
729 717
730 // Smooth velocity. OpenSimulator is VERY sensitive to changes in velocity of the avatar 718 // Smooth velocity. OpenSimulator is VERY sensitive to changes in velocity of the avatar
731 // and will send agent updates to the clients if velocity changes by more than 719 // and will send agent updates to the clients if velocity changes by more than
@@ -740,8 +728,8 @@ public sealed class BSCharacter : BSPhysObject
740 // Do some sanity checking for the avatar. Make sure it's above ground and inbounds. 728 // Do some sanity checking for the avatar. Make sure it's above ground and inbounds.
741 if (PositionSanityCheck(true)) 729 if (PositionSanityCheck(true))
742 { 730 {
743 DetailLog("{0},BSCharacter.UpdateProperties,updatePosForSanity,pos={1}", LocalID, _position); 731 DetailLog("{0},BSCharacter.UpdateProperties,updatePosForSanity,pos={1}", LocalID, RawPosition);
744 entprop.Position = _position; 732 entprop.Position = RawPosition;
745 } 733 }
746 734
747 // remember the current and last set values 735 // remember the current and last set values
@@ -755,7 +743,7 @@ public sealed class BSCharacter : BSPhysObject
755 // base.RequestPhysicsterseUpdate(); 743 // base.RequestPhysicsterseUpdate();
756 744
757 DetailLog("{0},BSCharacter.UpdateProperties,call,pos={1},orient={2},vel={3},accel={4},rotVel={5}", 745 DetailLog("{0},BSCharacter.UpdateProperties,call,pos={1},orient={2},vel={3},accel={4},rotVel={5}",
758 LocalID, _position, _orientation, RawVelocity, _acceleration, _rotationalVelocity); 746 LocalID, RawPosition, RawOrientation, RawVelocity, _acceleration, _rotationalVelocity);
759 } 747 }
760} 748}
761} 749}
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs b/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs
index aa247dd..82fe267 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs
@@ -144,7 +144,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
144 public void SetupVehicleDebugging() 144 public void SetupVehicleDebugging()
145 { 145 {
146 enableAngularVerticalAttraction = true; 146 enableAngularVerticalAttraction = true;
147 enableAngularDeflection = false; 147 enableAngularDeflection = true;
148 enableAngularBanking = true; 148 enableAngularBanking = true;
149 if (BSParam.VehicleDebuggingEnable) 149 if (BSParam.VehicleDebuggingEnable)
150 { 150 {
@@ -173,7 +173,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
173 switch (pParam) 173 switch (pParam)
174 { 174 {
175 case Vehicle.ANGULAR_DEFLECTION_EFFICIENCY: 175 case Vehicle.ANGULAR_DEFLECTION_EFFICIENCY:
176 m_angularDeflectionEfficiency = Math.Max(pValue, 0.01f); 176 m_angularDeflectionEfficiency = ClampInRange(0f, pValue, 1f);
177 break; 177 break;
178 case Vehicle.ANGULAR_DEFLECTION_TIMESCALE: 178 case Vehicle.ANGULAR_DEFLECTION_TIMESCALE:
179 m_angularDeflectionTimescale = Math.Max(pValue, 0.01f); 179 m_angularDeflectionTimescale = Math.Max(pValue, 0.01f);
@@ -774,7 +774,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
774 774
775 // Since the computation of terrain height can be a little involved, this routine 775 // Since the computation of terrain height can be a little involved, this routine
776 // is used to fetch the height only once for each vehicle simulation step. 776 // is used to fetch the height only once for each vehicle simulation step.
777 Vector3 lastRememberedHeightPos; 777 Vector3 lastRememberedHeightPos = new Vector3(-1, -1, -1);
778 private float GetTerrainHeight(Vector3 pos) 778 private float GetTerrainHeight(Vector3 pos)
779 { 779 {
780 if ((m_knownHas & m_knownChangedTerrainHeight) == 0 || pos != lastRememberedHeightPos) 780 if ((m_knownHas & m_knownChangedTerrainHeight) == 0 || pos != lastRememberedHeightPos)
@@ -788,14 +788,16 @@ namespace OpenSim.Region.Physics.BulletSPlugin
788 788
789 // Since the computation of water level can be a little involved, this routine 789 // Since the computation of water level can be a little involved, this routine
790 // is used ot fetch the level only once for each vehicle simulation step. 790 // is used ot fetch the level only once for each vehicle simulation step.
791 Vector3 lastRememberedWaterHeightPos = new Vector3(-1, -1, -1);
791 private float GetWaterLevel(Vector3 pos) 792 private float GetWaterLevel(Vector3 pos)
792 { 793 {
793 if ((m_knownHas & m_knownChangedWaterLevel) == 0) 794 if ((m_knownHas & m_knownChangedWaterLevel) == 0 || pos != lastRememberedWaterHeightPos)
794 { 795 {
796 lastRememberedWaterHeightPos = pos;
795 m_knownWaterLevel = ControllingPrim.PhysScene.TerrainManager.GetWaterLevelAtXYZ(pos); 797 m_knownWaterLevel = ControllingPrim.PhysScene.TerrainManager.GetWaterLevelAtXYZ(pos);
796 m_knownHas |= m_knownChangedWaterLevel; 798 m_knownHas |= m_knownChangedWaterLevel;
797 } 799 }
798 return (float)m_knownWaterLevel; 800 return m_knownWaterLevel;
799 } 801 }
800 802
801 private Vector3 VehiclePosition 803 private Vector3 VehiclePosition
@@ -991,11 +993,17 @@ namespace OpenSim.Region.Physics.BulletSPlugin
991 { 993 {
992 Vector3 vel = VehicleVelocity; 994 Vector3 vel = VehicleVelocity;
993 if ((m_flags & (VehicleFlag.NO_X)) != 0) 995 if ((m_flags & (VehicleFlag.NO_X)) != 0)
996 {
994 vel.X = 0; 997 vel.X = 0;
998 }
995 if ((m_flags & (VehicleFlag.NO_Y)) != 0) 999 if ((m_flags & (VehicleFlag.NO_Y)) != 0)
1000 {
996 vel.Y = 0; 1001 vel.Y = 0;
1002 }
997 if ((m_flags & (VehicleFlag.NO_Z)) != 0) 1003 if ((m_flags & (VehicleFlag.NO_Z)) != 0)
1004 {
998 vel.Z = 0; 1005 vel.Z = 0;
1006 }
999 VehicleVelocity = vel; 1007 VehicleVelocity = vel;
1000 } 1008 }
1001 1009
@@ -1504,11 +1512,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
1504 // in that direction. 1512 // in that direction.
1505 // TODO: implement reference frame. 1513 // TODO: implement reference frame.
1506 public void ComputeAngularDeflection() 1514 public void ComputeAngularDeflection()
1507 { 1515 {
1508 // Since angularMotorUp and angularDeflection are computed independently, they will calculate
1509 // approximately the same X or Y correction. When added together (when contributions are combined)
1510 // this creates an over-correction and then wabbling as the target is overshot.
1511 // TODO: rethink how the different correction computations inter-relate.
1512 1516
1513 if (enableAngularDeflection && m_angularDeflectionEfficiency != 0 && VehicleForwardSpeed > 0.2) 1517 if (enableAngularDeflection && m_angularDeflectionEfficiency != 0 && VehicleForwardSpeed > 0.2)
1514 { 1518 {
@@ -1523,10 +1527,14 @@ namespace OpenSim.Region.Physics.BulletSPlugin
1523 1527
1524 // The direction the vehicle is pointing 1528 // The direction the vehicle is pointing
1525 Vector3 pointingDirection = Vector3.UnitX * VehicleOrientation; 1529 Vector3 pointingDirection = Vector3.UnitX * VehicleOrientation;
1526 pointingDirection.Normalize(); 1530 //Predict where the Vehicle will be pointing after AngularVelocity change is applied. This will keep
1531 // from overshooting and allow this correction to merge with the Vertical Attraction peacefully.
1532 Vector3 predictedPointingDirection = pointingDirection * Quaternion.CreateFromAxisAngle(VehicleRotationalVelocity, 0f);
1533 predictedPointingDirection.Normalize();
1527 1534
1528 // The difference between what is and what should be. 1535 // The difference between what is and what should be.
1529 Vector3 deflectionError = movingDirection - pointingDirection; 1536 // Vector3 deflectionError = movingDirection - predictedPointingDirection;
1537 Vector3 deflectionError = Vector3.Cross(movingDirection, predictedPointingDirection);
1530 1538
1531 // Don't try to correct very large errors (not our job) 1539 // Don't try to correct very large errors (not our job)
1532 // if (Math.Abs(deflectionError.X) > PIOverFour) deflectionError.X = PIOverTwo * Math.Sign(deflectionError.X); 1540 // if (Math.Abs(deflectionError.X) > PIOverFour) deflectionError.X = PIOverTwo * Math.Sign(deflectionError.X);
@@ -1539,15 +1547,16 @@ namespace OpenSim.Region.Physics.BulletSPlugin
1539 // ret = m_angularDeflectionCorrectionMotor(1f, deflectionError); 1547 // ret = m_angularDeflectionCorrectionMotor(1f, deflectionError);
1540 1548
1541 // Scale the correction by recovery timescale and efficiency 1549 // Scale the correction by recovery timescale and efficiency
1542 deflectContributionV = (-deflectionError) * m_angularDeflectionEfficiency; 1550 // Not modeling a spring so clamp the scale to no more then the arc
1543 deflectContributionV /= m_angularDeflectionTimescale; 1551 deflectContributionV = (-deflectionError) * ClampInRange(0, m_angularDeflectionEfficiency/m_angularDeflectionTimescale,1f);
1544 1552 //deflectContributionV /= m_angularDeflectionTimescale;
1545 VehicleRotationalVelocity += deflectContributionV * VehicleOrientation;
1546 1553
1554 // VehicleRotationalVelocity += deflectContributionV * VehicleOrientation;
1555 VehicleRotationalVelocity += deflectContributionV;
1547 VDetailLog("{0}, MoveAngular,Deflection,movingDir={1},pointingDir={2},deflectError={3},ret={4}", 1556 VDetailLog("{0}, MoveAngular,Deflection,movingDir={1},pointingDir={2},deflectError={3},ret={4}",
1548 ControllingPrim.LocalID, movingDirection, pointingDirection, deflectionError, deflectContributionV); 1557 ControllingPrim.LocalID, movingDirection, pointingDirection, deflectionError, deflectContributionV);
1549 VDetailLog("{0}, MoveAngular,Deflection,fwdSpd={1},defEff={2},defTS={3}", 1558 VDetailLog("{0}, MoveAngular,Deflection,fwdSpd={1},defEff={2},defTS={3},PredictedPointingDir={4}",
1550 ControllingPrim.LocalID, VehicleForwardSpeed, m_angularDeflectionEfficiency, m_angularDeflectionTimescale); 1559 ControllingPrim.LocalID, VehicleForwardSpeed, m_angularDeflectionEfficiency, m_angularDeflectionTimescale, predictedPointingDirection);
1551 } 1560 }
1552 } 1561 }
1553 1562
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs b/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs
index 308cf13..1d94142 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs
@@ -35,62 +35,6 @@ using OMV = OpenMetaverse;
35namespace OpenSim.Region.Physics.BulletSPlugin 35namespace OpenSim.Region.Physics.BulletSPlugin
36{ 36{
37 37
38 /*
39// When a child is linked, the relationship position of the child to the parent
40// is remembered so the child's world position can be recomputed when it is
41// removed from the linkset.
42sealed class BSLinksetCompoundInfo : BSLinksetInfo
43{
44 public int Index;
45 public OMV.Vector3 OffsetFromRoot;
46 public OMV.Vector3 OffsetFromCenterOfMass;
47 public OMV.Quaternion OffsetRot;
48 public BSLinksetCompoundInfo(int indx, OMV.Vector3 p, OMV.Quaternion r)
49 {
50 Index = indx;
51 OffsetFromRoot = p;
52 OffsetFromCenterOfMass = p;
53 OffsetRot = r;
54 }
55 // 'centerDisplacement' is the distance from the root the the center-of-mass (Bullet 'zero' of the shape)
56 public BSLinksetCompoundInfo(int indx, BSPrimLinkable root, BSPrimLinkable child, OMV.Vector3 centerDisplacement)
57 {
58 // Each child position and rotation is given relative to the center-of-mass.
59 OMV.Quaternion invRootOrientation = OMV.Quaternion.Inverse(root.RawOrientation);
60 OMV.Vector3 displacementFromRoot = (child.RawPosition - root.RawPosition) * invRootOrientation;
61 OMV.Vector3 displacementFromCOM = displacementFromRoot - centerDisplacement;
62 OMV.Quaternion displacementRot = child.RawOrientation * invRootOrientation;
63
64 // Save relative position for recomputing child's world position after moving linkset.
65 Index = indx;
66 OffsetFromRoot = displacementFromRoot;
67 OffsetFromCenterOfMass = displacementFromCOM;
68 OffsetRot = displacementRot;
69 }
70 public override void Clear()
71 {
72 Index = 0;
73 OffsetFromRoot = OMV.Vector3.Zero;
74 OffsetFromCenterOfMass = OMV.Vector3.Zero;
75 OffsetRot = OMV.Quaternion.Identity;
76 }
77 public override string ToString()
78 {
79 StringBuilder buff = new StringBuilder();
80 buff.Append("<i=");
81 buff.Append(Index.ToString());
82 buff.Append(",p=");
83 buff.Append(OffsetFromRoot.ToString());
84 buff.Append(",m=");
85 buff.Append(OffsetFromCenterOfMass.ToString());
86 buff.Append(",r=");
87 buff.Append(OffsetRot.ToString());
88 buff.Append(">");
89 return buff.ToString();
90 }
91};
92 */
93
94public sealed class BSLinksetCompound : BSLinkset 38public sealed class BSLinksetCompound : BSLinkset
95{ 39{
96 private static string LogHeader = "[BULLETSIM LINKSET COMPOUND]"; 40 private static string LogHeader = "[BULLETSIM LINKSET COMPOUND]";
@@ -151,7 +95,9 @@ public sealed class BSLinksetCompound : BSLinkset
151 public override bool MakeStatic(BSPrimLinkable child) 95 public override bool MakeStatic(BSPrimLinkable child)
152 { 96 {
153 bool ret = false; 97 bool ret = false;
98
154 DetailLog("{0},BSLinksetCompound.MakeStatic,call,IsRoot={1}", child.LocalID, IsRoot(child)); 99 DetailLog("{0},BSLinksetCompound.MakeStatic,call,IsRoot={1}", child.LocalID, IsRoot(child));
100 child.ClearDisplacement();
155 if (IsRoot(child)) 101 if (IsRoot(child))
156 { 102 {
157 // Schedule a rebuild to verify that the root shape is set to the real shape. 103 // Schedule a rebuild to verify that the root shape is set to the real shape.
@@ -315,7 +261,6 @@ public sealed class BSLinksetCompound : BSLinkset
315 // Note that this works for rebuilding just the root after a linkset is taken apart. 261 // Note that this works for rebuilding just the root after a linkset is taken apart.
316 // Called at taint time!! 262 // Called at taint time!!
317 private bool UseBulletSimRootOffsetHack = false; // Attempt to have Bullet track the coords of root compound shape 263 private bool UseBulletSimRootOffsetHack = false; // Attempt to have Bullet track the coords of root compound shape
318 private bool disableCOM = true; // For basic linkset debugging, turn off the center-of-mass setting
319 private void RecomputeLinksetCompound() 264 private void RecomputeLinksetCompound()
320 { 265 {
321 try 266 try
@@ -326,55 +271,70 @@ public sealed class BSLinksetCompound : BSLinkset
326 // to what they should be as if the root was not in a linkset. 271 // to what they should be as if the root was not in a linkset.
327 // Not that bad since we only get into this routine if there are children in the linkset and 272 // Not that bad since we only get into this routine if there are children in the linkset and
328 // something has been updated/changed. 273 // something has been updated/changed.
274 // Have to do the rebuild before checking for physical because this might be a linkset
275 // being destructed and going non-physical.
329 LinksetRoot.ForceBodyShapeRebuild(true); 276 LinksetRoot.ForceBodyShapeRebuild(true);
330 277
331 // There is no reason to build all this physical stuff for a non-physical linkset. 278 // There is no reason to build all this physical stuff for a non-physical linkset.
332 if (!LinksetRoot.IsPhysicallyActive) 279 if (!LinksetRoot.IsPhysicallyActive)
333 { 280 {
334 // Clean up any old linkset shape and make sure the root shape is set to the root object.
335 DetailLog("{0},BSLinksetCompound.RecomputeLinksetCompound,notPhysical", LinksetRoot.LocalID); 281 DetailLog("{0},BSLinksetCompound.RecomputeLinksetCompound,notPhysical", LinksetRoot.LocalID);
336
337 return; // Note the 'finally' clause at the botton which will get executed. 282 return; // Note the 'finally' clause at the botton which will get executed.
338 } 283 }
339 284
340 // Get a new compound shape to build the linkset shape in. 285 // Get a new compound shape to build the linkset shape in.
341 BSShape linksetShape = BSShapeCompound.GetReference(m_physicsScene); 286 BSShape linksetShape = BSShapeCompound.GetReference(m_physicsScene);
342 287
343 // The center of mass for the linkset is the geometric center of the group.
344 // Compute a displacement for each component so it is relative to the center-of-mass. 288 // Compute a displacement for each component so it is relative to the center-of-mass.
345 // Bullet presumes an object's origin (relative <0,0,0>) is its center-of-mass 289 // Bullet presumes an object's origin (relative <0,0,0>) is its center-of-mass
346 OMV.Vector3 centerOfMassW = ComputeLinksetCenterOfMass(); 290 OMV.Vector3 centerOfMassW = ComputeLinksetCenterOfMass();
347 291
348 OMV.Quaternion invRootOrientation = OMV.Quaternion.Normalize(OMV.Quaternion.Inverse(LinksetRoot.RawOrientation)); 292 OMV.Quaternion invRootOrientation = OMV.Quaternion.Normalize(OMV.Quaternion.Inverse(LinksetRoot.RawOrientation));
293 OMV.Vector3 origRootPosition = LinksetRoot.RawPosition;
349 294
350 // 'centerDisplacement' is the value to subtract from children to give physical offset position 295 // 'centerDisplacementV' is the vehicle relative distance from the simulator root position to the center-of-mass
351 OMV.Vector3 centerDisplacementV = (centerOfMassW - LinksetRoot.RawPosition) * invRootOrientation; 296 OMV.Vector3 centerDisplacementV = (centerOfMassW - LinksetRoot.RawPosition) * invRootOrientation;
352 if (UseBulletSimRootOffsetHack || disableCOM) 297 if (UseBulletSimRootOffsetHack || !BSParam.LinksetOffsetCenterOfMass)
353 { 298 {
299 // Zero everything if center-of-mass displacement is not being done.
354 centerDisplacementV = OMV.Vector3.Zero; 300 centerDisplacementV = OMV.Vector3.Zero;
355 LinksetRoot.ClearDisplacement(); 301 LinksetRoot.ClearDisplacement();
356 } 302 }
357 else 303 else
358 { 304 {
359 LinksetRoot.SetEffectiveCenterOfMassDisplacement(centerDisplacementV); 305 // The actual center-of-mass could have been set by the user.
306 centerDisplacementV = LinksetRoot.SetEffectiveCenterOfMassDisplacement(centerDisplacementV);
360 } 307 }
308
361 DetailLog("{0},BSLinksetCompound.RecomputeLinksetCompound,COM,rootPos={1},com={2},comDisp={3}", 309 DetailLog("{0},BSLinksetCompound.RecomputeLinksetCompound,COM,rootPos={1},com={2},comDisp={3}",
362 LinksetRoot.LocalID, LinksetRoot.RawPosition, centerOfMassW, centerDisplacementV); 310 LinksetRoot.LocalID, origRootPosition, centerOfMassW, centerDisplacementV);
363 311
364 // Add the shapes of all the components of the linkset 312 // Add the shapes of all the components of the linkset
365 int memberIndex = 1; 313 int memberIndex = 1;
366 ForEachMember(delegate(BSPrimLinkable cPrim) 314 ForEachMember(delegate(BSPrimLinkable cPrim)
367 { 315 {
368 // Root shape is always index zero. 316 if (IsRoot(cPrim))
369 cPrim.LinksetChildIndex = IsRoot(cPrim) ? 0 : memberIndex; 317 {
318 // Root shape is always index zero.
319 cPrim.LinksetChildIndex = 0;
320 }
321 else
322 {
323 cPrim.LinksetChildIndex = memberIndex;
324 memberIndex++;
325 }
370 326
371 // Get a reference to the shape of the child and add that shape to the linkset compound shape 327 // Get a reference to the shape of the child for adding of that shape to the linkset compound shape
372 BSShape childShape = cPrim.PhysShape.GetReference(m_physicsScene, cPrim); 328 BSShape childShape = cPrim.PhysShape.GetReference(m_physicsScene, cPrim);
373 OMV.Vector3 offsetPos = (cPrim.RawPosition - LinksetRoot.RawPosition) * invRootOrientation - centerDisplacementV; 329
330 // Offset the child shape from the center-of-mass and rotate it to vehicle relative.
331 OMV.Vector3 offsetPos = (cPrim.RawPosition - origRootPosition) * invRootOrientation - centerDisplacementV;
374 OMV.Quaternion offsetRot = OMV.Quaternion.Normalize(cPrim.RawOrientation) * invRootOrientation; 332 OMV.Quaternion offsetRot = OMV.Quaternion.Normalize(cPrim.RawOrientation) * invRootOrientation;
333
334 // Add the child shape to the compound shape being built
375 m_physicsScene.PE.AddChildShapeToCompoundShape(linksetShape.physShapeInfo, childShape.physShapeInfo, offsetPos, offsetRot); 335 m_physicsScene.PE.AddChildShapeToCompoundShape(linksetShape.physShapeInfo, childShape.physShapeInfo, offsetPos, offsetRot);
376 DetailLog("{0},BSLinksetCompound.RecomputeLinksetCompound,addChild,indx={1},cShape={2},offPos={3},offRot={4}", 336 DetailLog("{0},BSLinksetCompound.RecomputeLinksetCompound,addChild,indx={1},cShape={2},offPos={3},offRot={4}",
377 LinksetRoot.LocalID, memberIndex, childShape, offsetPos, offsetRot); 337 LinksetRoot.LocalID, cPrim.LinksetChildIndex, childShape, offsetPos, offsetRot);
378 338
379 // Since we are borrowing the shape of the child, disable the origional child body 339 // Since we are borrowing the shape of the child, disable the origional child body
380 if (!IsRoot(cPrim)) 340 if (!IsRoot(cPrim))
@@ -386,8 +346,6 @@ public sealed class BSLinksetCompound : BSLinkset
386 cPrim.PhysBody.collisionType = CollisionType.LinksetChild; 346 cPrim.PhysBody.collisionType = CollisionType.LinksetChild;
387 } 347 }
388 348
389 memberIndex++;
390
391 return false; // 'false' says to move onto the next child in the list 349 return false; // 'false' says to move onto the next child in the list
392 }); 350 });
393 351
@@ -409,8 +367,9 @@ public sealed class BSLinksetCompound : BSLinkset
409 { 367 {
410 // Enable the physical position updator to return the position and rotation of the root shape. 368 // Enable the physical position updator to return the position and rotation of the root shape.
411 // This enables a feature in the C++ code to return the world coordinates of the first shape in the 369 // This enables a feature in the C++ code to return the world coordinates of the first shape in the
412 // compound shape. This eleviates the need to offset the returned physical position by the 370 // compound shape. This aleviates the need to offset the returned physical position by the
413 // center-of-mass offset. 371 // center-of-mass offset.
372 // TODO: either debug this feature or remove it.
414 m_physicsScene.PE.AddToCollisionFlags(LinksetRoot.PhysBody, CollisionFlags.BS_RETURN_ROOT_COMPOUND_SHAPE); 373 m_physicsScene.PE.AddToCollisionFlags(LinksetRoot.PhysBody, CollisionFlags.BS_RETURN_ROOT_COMPOUND_SHAPE);
415 } 374 }
416 } 375 }
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSMotors.cs b/OpenSim/Region/Physics/BulletSPlugin/BSMotors.cs
index 1214703..7693195 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSMotors.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSMotors.cs
@@ -188,6 +188,8 @@ public class BSVMotor : BSMotor
188 CurrentValue = current; 188 CurrentValue = current;
189 return Step(timeStep); 189 return Step(timeStep);
190 } 190 }
191 // Given and error, computer a correction for this step.
192 // Simple scaling of the error by the timestep.
191 public virtual Vector3 StepError(float timeStep, Vector3 error) 193 public virtual Vector3 StepError(float timeStep, Vector3 error)
192 { 194 {
193 if (!Enabled) return Vector3.Zero; 195 if (!Enabled) return Vector3.Zero;
@@ -221,7 +223,7 @@ public class BSVMotor : BSMotor
221 CurrentValue, TargetValue); 223 CurrentValue, TargetValue);
222 224
223 LastError = BSMotor.InfiniteVector; 225 LastError = BSMotor.InfiniteVector;
224 while (maxOutput-- > 0 && !LastError.ApproxEquals(Vector3.Zero, ErrorZeroThreshold)) 226 while (maxOutput-- > 0 && !ErrorIsZero())
225 { 227 {
226 Vector3 lastStep = Step(timeStep); 228 Vector3 lastStep = Step(timeStep);
227 MDetailLog("{0},BSVMotor.Test,{1},cur={2},tgt={3},lastError={4},lastStep={5}", 229 MDetailLog("{0},BSVMotor.Test,{1},cur={2},tgt={3},lastError={4},lastStep={5}",
@@ -375,7 +377,6 @@ public class BSPIDVMotor : BSVMotor
375 // The factors are vectors for the three dimensions. This is the proportional of each 377 // The factors are vectors for the three dimensions. This is the proportional of each
376 // that is applied. This could be multiplied through the actual factors but it 378 // that is applied. This could be multiplied through the actual factors but it
377 // is sometimes easier to manipulate the factors and their mix separately. 379 // is sometimes easier to manipulate the factors and their mix separately.
378 // to
379 public Vector3 FactorMix; 380 public Vector3 FactorMix;
380 381
381 // Arbritrary factor range. 382 // Arbritrary factor range.
@@ -413,14 +414,14 @@ public class BSPIDVMotor : BSVMotor
413 // If efficiency is high (1f), use a factor value that moves the error value to zero with little overshoot. 414 // If efficiency is high (1f), use a factor value that moves the error value to zero with little overshoot.
414 // If efficiency is low (0f), use a factor value that overcorrects. 415 // If efficiency is low (0f), use a factor value that overcorrects.
415 // TODO: might want to vary contribution of different factor depending on efficiency. 416 // TODO: might want to vary contribution of different factor depending on efficiency.
416 float factor = ((1f - this.Efficiency) * EfficiencyHigh + EfficiencyLow) / 3f; 417 // float factor = ((1f - this.Efficiency) * EfficiencyHigh + EfficiencyLow) / 3f;
417 // float factor = (1f - this.Efficiency) * EfficiencyHigh + EfficiencyLow; 418 float factor = (1f - this.Efficiency) * EfficiencyHigh + EfficiencyLow;
418 419
419 proportionFactor = new Vector3(factor, factor, factor); 420 proportionFactor = new Vector3(factor, factor, factor);
420 integralFactor = new Vector3(factor, factor, factor); 421 integralFactor = new Vector3(factor, factor, factor);
421 derivFactor = new Vector3(factor, factor, factor); 422 derivFactor = new Vector3(factor, factor, factor);
422 423
423 MDetailLog("{0},BSPIDVMotor.setEfficiency,eff={1},factor={2}", BSScene.DetailLogZero, Efficiency, factor); 424 MDetailLog("{0}, BSPIDVMotor.setEfficiency,eff={1},factor={2}", BSScene.DetailLogZero, Efficiency, factor);
424 } 425 }
425 } 426 }
426 427
@@ -441,8 +442,8 @@ public class BSPIDVMotor : BSVMotor
441 + derivitive / TimeScale * derivFactor * FactorMix.Z 442 + derivitive / TimeScale * derivFactor * FactorMix.Z
442 ; 443 ;
443 444
444 MDetailLog("{0}, BSPIDVMotor.step,ts={1},err={2},runnInt={3},deriv={4},ret={5}", 445 MDetailLog("{0}, BSPIDVMotor.step,ts={1},err={2},lerr={3},runnInt={4},deriv={5},ret={6}",
445 BSScene.DetailLogZero, timeStep, error, RunningIntegration, derivitive, ret); 446 BSScene.DetailLogZero, timeStep, error, LastError, RunningIntegration, derivitive, ret);
446 447
447 return ret; 448 return ret;
448 } 449 }
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs
index d17c8e7..0f84bf7 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs
@@ -176,6 +176,7 @@ public static class BSParam
176 176
177 // Linkset implementation parameters 177 // Linkset implementation parameters
178 public static float LinksetImplementation { get; private set; } 178 public static float LinksetImplementation { get; private set; }
179 public static bool LinksetOffsetCenterOfMass { get; private set; }
179 public static bool LinkConstraintUseFrameOffset { get; private set; } 180 public static bool LinkConstraintUseFrameOffset { get; private set; }
180 public static bool LinkConstraintEnableTransMotor { get; private set; } 181 public static bool LinkConstraintEnableTransMotor { get; private set; }
181 public static float LinkConstraintTransMotorMaxVel { get; private set; } 182 public static float LinkConstraintTransMotorMaxVel { get; private set; }
@@ -684,6 +685,8 @@ public static class BSParam
684 685
685 new ParameterDefn<float>("LinksetImplementation", "Type of linkset implementation (0=Constraint, 1=Compound, 2=Manual)", 686 new ParameterDefn<float>("LinksetImplementation", "Type of linkset implementation (0=Constraint, 1=Compound, 2=Manual)",
686 (float)BSLinkset.LinksetImplementation.Compound ), 687 (float)BSLinkset.LinksetImplementation.Compound ),
688 new ParameterDefn<bool>("LinksetOffsetCenterOfMass", "If 'true', compute linkset center-of-mass and offset linkset position to account for same",
689 false ),
687 new ParameterDefn<bool>("LinkConstraintUseFrameOffset", "For linksets built with constraints, enable frame offsetFor linksets built with constraints, enable frame offset.", 690 new ParameterDefn<bool>("LinkConstraintUseFrameOffset", "For linksets built with constraints, enable frame offsetFor linksets built with constraints, enable frame offset.",
688 false ), 691 false ),
689 new ParameterDefn<bool>("LinkConstraintEnableTransMotor", "Whether to enable translational motor on linkset constraints", 692 new ParameterDefn<bool>("LinkConstraintEnableTransMotor", "Whether to enable translational motor on linkset constraints",
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs
index a0d5c42..a41eaf8 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs
@@ -90,6 +90,8 @@ public abstract class BSPhysObject : PhysicsActor
90 PhysBody = new BulletBody(localID); 90 PhysBody = new BulletBody(localID);
91 PhysShape = new BSShapeNull(); 91 PhysShape = new BSShapeNull();
92 92
93 UserSetCenterOfMassDisplacement = null;
94
93 PrimAssetState = PrimAssetCondition.Unknown; 95 PrimAssetState = PrimAssetCondition.Unknown;
94 96
95 // Default material type. Also sets Friction, Restitution and Density. 97 // Default material type. Also sets Friction, Restitution and Density.
@@ -180,6 +182,7 @@ public abstract class BSPhysObject : PhysicsActor
180 Material = (MaterialAttributes.Material)material; 182 Material = (MaterialAttributes.Material)material;
181 183
182 // Setting the material sets the material attributes also. 184 // Setting the material sets the material attributes also.
185 // TODO: decide if this is necessary -- the simulator does this.
183 MaterialAttributes matAttrib = BSMaterials.GetAttributes(Material, false); 186 MaterialAttributes matAttrib = BSMaterials.GetAttributes(Material, false);
184 Friction = matAttrib.friction; 187 Friction = matAttrib.friction;
185 Restitution = matAttrib.restitution; 188 Restitution = matAttrib.restitution;
@@ -194,10 +197,10 @@ public abstract class BSPhysObject : PhysicsActor
194 // Update the physical location and motion of the object. Called with data from Bullet. 197 // Update the physical location and motion of the object. Called with data from Bullet.
195 public abstract void UpdateProperties(EntityProperties entprop); 198 public abstract void UpdateProperties(EntityProperties entprop);
196 199
197 public abstract OMV.Vector3 RawPosition { get; set; } 200 public virtual OMV.Vector3 RawPosition { get; set; }
198 public abstract OMV.Vector3 ForcePosition { get; set; } 201 public abstract OMV.Vector3 ForcePosition { get; set; }
199 202
200 public abstract OMV.Quaternion RawOrientation { get; set; } 203 public virtual OMV.Quaternion RawOrientation { get; set; }
201 public abstract OMV.Quaternion ForceOrientation { get; set; } 204 public abstract OMV.Quaternion ForceOrientation { get; set; }
202 205
203 public OMV.Vector3 RawVelocity { get; set; } 206 public OMV.Vector3 RawVelocity { get; set; }
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
index b2947c6..d43448e 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
@@ -51,12 +51,8 @@ public class BSPrim : BSPhysObject
51 private bool _isSelected; 51 private bool _isSelected;
52 private bool _isVolumeDetect; 52 private bool _isVolumeDetect;
53 53
54 // _position is what the simulator thinks the positions of the prim is.
55 private OMV.Vector3 _position;
56
57 private float _mass; // the mass of this object 54 private float _mass; // the mass of this object
58 private OMV.Vector3 _acceleration; 55 private OMV.Vector3 _acceleration;
59 private OMV.Quaternion _orientation;
60 private int _physicsActorType; 56 private int _physicsActorType;
61 private bool _isPhysical; 57 private bool _isPhysical;
62 private bool _flying; 58 private bool _flying;
@@ -88,10 +84,10 @@ public class BSPrim : BSPhysObject
88 { 84 {
89 // m_log.DebugFormat("{0}: BSPrim creation of {1}, id={2}", LogHeader, primName, localID); 85 // m_log.DebugFormat("{0}: BSPrim creation of {1}, id={2}", LogHeader, primName, localID);
90 _physicsActorType = (int)ActorTypes.Prim; 86 _physicsActorType = (int)ActorTypes.Prim;
91 _position = pos; 87 RawPosition = pos;
92 _size = size; 88 _size = size;
93 Scale = size; // prims are the size the user wants them to be (different for BSCharactes). 89 Scale = size; // prims are the size the user wants them to be (different for BSCharactes).
94 _orientation = rotation; 90 RawOrientation = rotation;
95 _buoyancy = 0f; 91 _buoyancy = 0f;
96 RawVelocity = OMV.Vector3.Zero; 92 RawVelocity = OMV.Vector3.Zero;
97 _rotationalVelocity = OMV.Vector3.Zero; 93 _rotationalVelocity = OMV.Vector3.Zero;
@@ -270,46 +266,42 @@ public class BSPrim : BSPhysObject
270 return; 266 return;
271 } 267 }
272 268
273 public override OMV.Vector3 RawPosition
274 {
275 get { return _position; }
276 set { _position = value; }
277 }
278 public override OMV.Vector3 Position { 269 public override OMV.Vector3 Position {
279 get { 270 get {
280 // don't do the GetObjectPosition for root elements because this function is called a zillion times. 271 // don't do the GetObjectPosition for root elements because this function is called a zillion times.
281 // _position = ForcePosition; 272 // RawPosition = ForcePosition;
282 return _position; 273 return RawPosition;
283 } 274 }
284 set { 275 set {
285 // If the position must be forced into the physics engine, use ForcePosition. 276 // If the position must be forced into the physics engine, use ForcePosition.
286 // All positions are given in world positions. 277 // All positions are given in world positions.
287 if (_position == value) 278 if (RawPosition == value)
288 { 279 {
289 DetailLog("{0},BSPrim.setPosition,call,positionNotChanging,pos={1},orient={2}", LocalID, _position, _orientation); 280 DetailLog("{0},BSPrim.setPosition,call,positionNotChanging,pos={1},orient={2}", LocalID, RawPosition, RawOrientation);
290 return; 281 return;
291 } 282 }
292 _position = value; 283 RawPosition = value;
293 PositionSanityCheck(false); 284 PositionSanityCheck(false);
294 285
295 PhysScene.TaintedObject("BSPrim.setPosition", delegate() 286 PhysScene.TaintedObject("BSPrim.setPosition", delegate()
296 { 287 {
297 DetailLog("{0},BSPrim.SetPosition,taint,pos={1},orient={2}", LocalID, _position, _orientation); 288 DetailLog("{0},BSPrim.SetPosition,taint,pos={1},orient={2}", LocalID, RawPosition, RawOrientation);
298 ForcePosition = _position; 289 ForcePosition = RawPosition;
299 }); 290 });
300 } 291 }
301 } 292 }
302 293
294 // NOTE: overloaded by BSPrimDisplaced to handle offset for center-of-gravity.
303 public override OMV.Vector3 ForcePosition { 295 public override OMV.Vector3 ForcePosition {
304 get { 296 get {
305 _position = PhysScene.PE.GetPosition(PhysBody); 297 RawPosition = PhysScene.PE.GetPosition(PhysBody);
306 return _position; 298 return RawPosition;
307 } 299 }
308 set { 300 set {
309 _position = value; 301 RawPosition = value;
310 if (PhysBody.HasPhysicalBody) 302 if (PhysBody.HasPhysicalBody)
311 { 303 {
312 PhysScene.PE.SetTranslation(PhysBody, _position, _orientation); 304 PhysScene.PE.SetTranslation(PhysBody, RawPosition, RawOrientation);
313 ActivateIfPhysical(false); 305 ActivateIfPhysical(false);
314 } 306 }
315 } 307 }
@@ -343,10 +335,10 @@ public class BSPrim : BSPhysObject
343 float targetHeight = terrainHeight + (Size.Z / 2f); 335 float targetHeight = terrainHeight + (Size.Z / 2f);
344 // If the object is below ground it just has to be moved up because pushing will 336 // If the object is below ground it just has to be moved up because pushing will
345 // not get it through the terrain 337 // not get it through the terrain
346 _position.Z = targetHeight; 338 RawPosition = new OMV.Vector3(RawPosition.X, RawPosition.Y, targetHeight);
347 if (inTaintTime) 339 if (inTaintTime)
348 { 340 {
349 ForcePosition = _position; 341 ForcePosition = RawPosition;
350 } 342 }
351 // If we are throwing the object around, zero its other forces 343 // If we are throwing the object around, zero its other forces
352 ZeroMotion(inTaintTime); 344 ZeroMotion(inTaintTime);
@@ -355,7 +347,7 @@ public class BSPrim : BSPhysObject
355 347
356 if ((CurrentCollisionFlags & CollisionFlags.BS_FLOATS_ON_WATER) != 0) 348 if ((CurrentCollisionFlags & CollisionFlags.BS_FLOATS_ON_WATER) != 0)
357 { 349 {
358 float waterHeight = PhysScene.TerrainManager.GetWaterLevelAtXYZ(_position); 350 float waterHeight = PhysScene.TerrainManager.GetWaterLevelAtXYZ(RawPosition);
359 // TODO: a floating motor so object will bob in the water 351 // TODO: a floating motor so object will bob in the water
360 if (Math.Abs(RawPosition.Z - waterHeight) > 0.1f) 352 if (Math.Abs(RawPosition.Z - waterHeight) > 0.1f)
361 { 353 {
@@ -364,7 +356,7 @@ public class BSPrim : BSPhysObject
364 356
365 // Apply upforce and overcome gravity. 357 // Apply upforce and overcome gravity.
366 OMV.Vector3 correctionForce = upForce - PhysScene.DefaultGravity; 358 OMV.Vector3 correctionForce = upForce - PhysScene.DefaultGravity;
367 DetailLog("{0},BSPrim.PositionSanityCheck,applyForce,pos={1},upForce={2},correctionForce={3}", LocalID, _position, upForce, correctionForce); 359 DetailLog("{0},BSPrim.PositionSanityCheck,applyForce,pos={1},upForce={2},correctionForce={3}", LocalID, RawPosition, upForce, correctionForce);
368 AddForce(correctionForce, false, inTaintTime); 360 AddForce(correctionForce, false, inTaintTime);
369 ret = true; 361 ret = true;
370 } 362 }
@@ -383,11 +375,11 @@ public class BSPrim : BSPhysObject
383 uint wayOutThere = Constants.RegionSize * Constants.RegionSize; 375 uint wayOutThere = Constants.RegionSize * Constants.RegionSize;
384 // There have been instances of objects getting thrown way out of bounds and crashing 376 // There have been instances of objects getting thrown way out of bounds and crashing
385 // the border crossing code. 377 // the border crossing code.
386 if ( _position.X < -Constants.RegionSize || _position.X > wayOutThere 378 if ( RawPosition.X < -Constants.RegionSize || RawPosition.X > wayOutThere
387 || _position.Y < -Constants.RegionSize || _position.Y > wayOutThere 379 || RawPosition.Y < -Constants.RegionSize || RawPosition.Y > wayOutThere
388 || _position.Z < -Constants.RegionSize || _position.Z > wayOutThere) 380 || RawPosition.Z < -Constants.RegionSize || RawPosition.Z > wayOutThere)
389 { 381 {
390 _position = new OMV.Vector3(10, 10, 50); 382 RawPosition = new OMV.Vector3(10, 10, 50);
391 ZeroMotion(inTaintTime); 383 ZeroMotion(inTaintTime);
392 ret = true; 384 ret = true;
393 } 385 }
@@ -713,23 +705,19 @@ public class BSPrim : BSPhysObject
713 get { return _acceleration; } 705 get { return _acceleration; }
714 set { _acceleration = value; } 706 set { _acceleration = value; }
715 } 707 }
716 public override OMV.Quaternion RawOrientation 708
717 {
718 get { return _orientation; }
719 set { _orientation = value; }
720 }
721 public override OMV.Quaternion Orientation { 709 public override OMV.Quaternion Orientation {
722 get { 710 get {
723 return _orientation; 711 return RawOrientation;
724 } 712 }
725 set { 713 set {
726 if (_orientation == value) 714 if (RawOrientation == value)
727 return; 715 return;
728 _orientation = value; 716 RawOrientation = value;
729 717
730 PhysScene.TaintedObject("BSPrim.setOrientation", delegate() 718 PhysScene.TaintedObject("BSPrim.setOrientation", delegate()
731 { 719 {
732 ForceOrientation = _orientation; 720 ForceOrientation = RawOrientation;
733 }); 721 });
734 } 722 }
735 } 723 }
@@ -738,14 +726,14 @@ public class BSPrim : BSPhysObject
738 { 726 {
739 get 727 get
740 { 728 {
741 _orientation = PhysScene.PE.GetOrientation(PhysBody); 729 RawOrientation = PhysScene.PE.GetOrientation(PhysBody);
742 return _orientation; 730 return RawOrientation;
743 } 731 }
744 set 732 set
745 { 733 {
746 _orientation = value; 734 RawOrientation = value;
747 if (PhysBody.HasPhysicalBody) 735 if (PhysBody.HasPhysicalBody)
748 PhysScene.PE.SetTranslation(PhysBody, _position, _orientation); 736 PhysScene.PE.SetTranslation(PhysBody, RawPosition, RawOrientation);
749 } 737 }
750 } 738 }
751 public override int PhysicsActorType { 739 public override int PhysicsActorType {
@@ -802,6 +790,7 @@ public class BSPrim : BSPhysObject
802 // isSolid: other objects bounce off of this object 790 // isSolid: other objects bounce off of this object
803 // isVolumeDetect: other objects pass through but can generate collisions 791 // isVolumeDetect: other objects pass through but can generate collisions
804 // collisionEvents: whether this object returns collision events 792 // collisionEvents: whether this object returns collision events
793 // NOTE: overloaded by BSPrimLinkable to also update linkset physical parameters.
805 public virtual void UpdatePhysicalParameters() 794 public virtual void UpdatePhysicalParameters()
806 { 795 {
807 if (!PhysBody.HasPhysicalBody) 796 if (!PhysBody.HasPhysicalBody)
@@ -888,7 +877,7 @@ public class BSPrim : BSPhysObject
888 // PhysicsScene.PE.ClearAllForces(BSBody); 877 // PhysicsScene.PE.ClearAllForces(BSBody);
889 878
890 // For good measure, make sure the transform is set through to the motion state 879 // For good measure, make sure the transform is set through to the motion state
891 ForcePosition = _position; 880 ForcePosition = RawPosition;
892 ForceVelocity = RawVelocity; 881 ForceVelocity = RawVelocity;
893 ForceRotationalVelocity = _rotationalVelocity; 882 ForceRotationalVelocity = _rotationalVelocity;
894 883
@@ -1125,7 +1114,9 @@ public class BSPrim : BSPhysObject
1125 OMV.Vector3 addForce = force; 1114 OMV.Vector3 addForce = force;
1126 PhysScene.TaintedObject(inTaintTime, "BSPrim.AddForce", delegate() 1115 PhysScene.TaintedObject(inTaintTime, "BSPrim.AddForce", delegate()
1127 { 1116 {
1128 // Bullet adds this central force to the total force for this tick 1117 // Bullet adds this central force to the total force for this tick.
1118 // Deep down in Bullet:
1119 // linearVelocity += totalForce / mass * timeStep;
1129 DetailLog("{0},BSPrim.addForce,taint,force={1}", LocalID, addForce); 1120 DetailLog("{0},BSPrim.addForce,taint,force={1}", LocalID, addForce);
1130 if (PhysBody.HasPhysicalBody) 1121 if (PhysBody.HasPhysicalBody)
1131 { 1122 {
@@ -1493,6 +1484,8 @@ public class BSPrim : BSPhysObject
1493 1484
1494 returnMass = Util.Clamp(returnMass, BSParam.MinimumObjectMass, BSParam.MaximumObjectMass); 1485 returnMass = Util.Clamp(returnMass, BSParam.MinimumObjectMass, BSParam.MaximumObjectMass);
1495 // DetailLog("{0},BSPrim.CalculateMass,den={1},vol={2},mass={3}", LocalID, Density, volume, returnMass); 1486 // DetailLog("{0},BSPrim.CalculateMass,den={1},vol={2},mass={3}", LocalID, Density, volume, returnMass);
1487 DetailLog("{0},BSPrim.CalculateMass,den={1},vol={2},mass={3},pathB={4},pathE={5},profB={6},profE={7},siz={8}",
1488 LocalID, Density, volume, returnMass, pathBegin, pathEnd, profileBegin, profileEnd, _size);
1496 1489
1497 return returnMass; 1490 return returnMass;
1498 }// end CalculateMass 1491 }// end CalculateMass
@@ -1528,6 +1521,8 @@ public class BSPrim : BSPhysObject
1528 1521
1529 // The physics engine says that properties have updated. Update same and inform 1522 // The physics engine says that properties have updated. Update same and inform
1530 // the world that things have changed. 1523 // the world that things have changed.
1524 // NOTE: BSPrim.UpdateProperties is overloaded by BSPrimLinkable which modifies updates from root and children prims.
1525 // NOTE: BSPrim.UpdateProperties is overloaded by BSPrimDisplaced which handles mapping physical position to simulator position.
1531 public override void UpdateProperties(EntityProperties entprop) 1526 public override void UpdateProperties(EntityProperties entprop)
1532 { 1527 {
1533 // Let anyone (like the actors) modify the updated properties before they are pushed into the object and the simulator. 1528 // Let anyone (like the actors) modify the updated properties before they are pushed into the object and the simulator.
@@ -1536,8 +1531,8 @@ public class BSPrim : BSPhysObject
1536 // DetailLog("{0},BSPrim.UpdateProperties,entry,entprop={1}", LocalID, entprop); // DEBUG DEBUG 1531 // DetailLog("{0},BSPrim.UpdateProperties,entry,entprop={1}", LocalID, entprop); // DEBUG DEBUG
1537 1532
1538 // Assign directly to the local variables so the normal set actions do not happen 1533 // Assign directly to the local variables so the normal set actions do not happen
1539 _position = entprop.Position; 1534 RawPosition = entprop.Position;
1540 _orientation = entprop.Rotation; 1535 RawOrientation = entprop.Rotation;
1541 // DEBUG DEBUG DEBUG -- smooth velocity changes a bit. The simulator seems to be 1536 // DEBUG DEBUG DEBUG -- smooth velocity changes a bit. The simulator seems to be
1542 // very sensitive to velocity changes. 1537 // very sensitive to velocity changes.
1543 if (entprop.Velocity == OMV.Vector3.Zero || !entprop.Velocity.ApproxEquals(RawVelocity, BSParam.UpdateVelocityChangeThreshold)) 1538 if (entprop.Velocity == OMV.Vector3.Zero || !entprop.Velocity.ApproxEquals(RawVelocity, BSParam.UpdateVelocityChangeThreshold))
@@ -1550,21 +1545,19 @@ public class BSPrim : BSPhysObject
1550 // The sanity check can change the velocity and/or position. 1545 // The sanity check can change the velocity and/or position.
1551 if (PositionSanityCheck(true /* inTaintTime */ )) 1546 if (PositionSanityCheck(true /* inTaintTime */ ))
1552 { 1547 {
1553 entprop.Position = _position; 1548 entprop.Position = RawPosition;
1554 entprop.Velocity = RawVelocity; 1549 entprop.Velocity = RawVelocity;
1555 entprop.RotationalVelocity = _rotationalVelocity; 1550 entprop.RotationalVelocity = _rotationalVelocity;
1556 entprop.Acceleration = _acceleration; 1551 entprop.Acceleration = _acceleration;
1557 } 1552 }
1558 1553
1559 OMV.Vector3 direction = OMV.Vector3.UnitX * _orientation; // DEBUG DEBUG DEBUG 1554 OMV.Vector3 direction = OMV.Vector3.UnitX * RawOrientation; // DEBUG DEBUG DEBUG
1560 DetailLog("{0},BSPrim.UpdateProperties,call,entProp={1},dir={2}", LocalID, entprop, direction); 1555 DetailLog("{0},BSPrim.UpdateProperties,call,entProp={1},dir={2}", LocalID, entprop, direction);
1561 1556
1562 // remember the current and last set values 1557 // remember the current and last set values
1563 LastEntityProperties = CurrentEntityProperties; 1558 LastEntityProperties = CurrentEntityProperties;
1564 CurrentEntityProperties = entprop; 1559 CurrentEntityProperties = entprop;
1565 1560
1566 // Note that BSPrim can be overloaded by BSPrimLinkable which controls updates from root and children prims.
1567
1568 PhysScene.PostUpdate(this); 1561 PhysScene.PostUpdate(this);
1569 } 1562 }
1570} 1563}
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrimDisplaced.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPrimDisplaced.cs
index f5ee671..2eb1440 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSPrimDisplaced.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSPrimDisplaced.cs
@@ -23,11 +23,6 @@
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 * The quotations from http://wiki.secondlife.com/wiki/Linden_Vehicle_Tutorial
28 * are Copyright (c) 2009 Linden Research, Inc and are used under their license
29 * of Creative Commons Attribution-Share Alike 3.0
30 * (http://creativecommons.org/licenses/by-sa/3.0/).
31 */ 26 */
32 27
33using System; 28using System;
@@ -44,14 +39,14 @@ namespace OpenSim.Region.Physics.BulletSPlugin
44{ 39{
45public class BSPrimDisplaced : BSPrim 40public class BSPrimDisplaced : BSPrim
46{ 41{
47 // The purpose of this module is to do any mapping between what the simulator thinks 42 // The purpose of this subclass is to do any mapping between what the simulator thinks
48 // the prim position and orientation is and what the physical position/orientation. 43 // the prim position and orientation is and what the physical position/orientation.
49 // This difference happens because Bullet assumes the center-of-mass is the <0,0,0> 44 // This difference happens because Bullet assumes the center-of-mass is the <0,0,0>
50 // of the prim/linkset. The simulator tracks the location of the prim/linkset by 45 // of the prim/linkset. The simulator, on the other hand, tracks the location of
51 // the location of the root prim. So, if center-of-mass is anywhere but the origin 46 // the prim/linkset by the location of the root prim. So, if center-of-mass is anywhere
52 // of the root prim, the physical origin is displaced from the simulator origin. 47 // but the origin of the root prim, the physical origin is displaced from the simulator origin.
53 // 48 //
54 // This routine works by capturing the Force* setting of position/orientation/... and 49 // This routine works by capturing ForcePosition and
55 // adjusting the simulator values (being set) into the physical values. 50 // adjusting the simulator values (being set) into the physical values.
56 // The conversion is also done in the opposite direction (physical origin -> simulator origin). 51 // The conversion is also done in the opposite direction (physical origin -> simulator origin).
57 // 52 //
@@ -59,8 +54,8 @@ public class BSPrimDisplaced : BSPrim
59 // are converted into simulator origin values before being passed to the base 54 // are converted into simulator origin values before being passed to the base
60 // class. 55 // class.
61 56
57 // PositionDisplacement is the vehicle relative distance from the root prim position to the center-of-mass.
62 public virtual OMV.Vector3 PositionDisplacement { get; set; } 58 public virtual OMV.Vector3 PositionDisplacement { get; set; }
63 public virtual OMV.Quaternion OrientationDisplacement { get; set; }
64 59
65 public BSPrimDisplaced(uint localID, String primName, BSScene parent_scene, OMV.Vector3 pos, OMV.Vector3 size, 60 public BSPrimDisplaced(uint localID, String primName, BSScene parent_scene, OMV.Vector3 pos, OMV.Vector3 size,
66 OMV.Quaternion rotation, PrimitiveBaseShape pbs, bool pisPhysical) 61 OMV.Quaternion rotation, PrimitiveBaseShape pbs, bool pisPhysical)
@@ -69,50 +64,82 @@ public class BSPrimDisplaced : BSPrim
69 ClearDisplacement(); 64 ClearDisplacement();
70 } 65 }
71 66
67 // Clears any center-of-mass displacement introduced by linksets, etc.
68 // Does not clear the displacement set by the user.
72 public void ClearDisplacement() 69 public void ClearDisplacement()
73 { 70 {
74 PositionDisplacement = OMV.Vector3.Zero; 71 if (UserSetCenterOfMassDisplacement.HasValue)
75 OrientationDisplacement = OMV.Quaternion.Identity; 72 PositionDisplacement = (OMV.Vector3)UserSetCenterOfMassDisplacement;
73 else
74 PositionDisplacement = OMV.Vector3.Zero;
76 } 75 }
77 76
78 // Set this sets and computes the displacement from the passed prim to the center-of-mass. 77 // Set this sets and computes the displacement from the passed prim to the center-of-mass.
79 // A user set value for center-of-mass overrides whatever might be passed in here. 78 // A user set value for center-of-mass overrides whatever might be passed in here.
80 // The displacement is in local coordinates (relative to root prim in linkset oriented coordinates). 79 // The displacement is in local coordinates (relative to root prim in linkset oriented coordinates).
81 public virtual void SetEffectiveCenterOfMassDisplacement(Vector3 centerOfMassDisplacement) 80 // Returns the relative offset from the root position to the center-of-mass.
81 // Called at taint time.
82 public virtual Vector3 SetEffectiveCenterOfMassDisplacement(Vector3 centerOfMassDisplacement)
82 { 83 {
84 PhysScene.AssertInTaintTime("BSPrimDisplaced.SetEffectiveCenterOfMassDisplacement");
83 Vector3 comDisp; 85 Vector3 comDisp;
84 if (UserSetCenterOfMassDisplacement.HasValue) 86 if (UserSetCenterOfMassDisplacement.HasValue)
85 comDisp = (OMV.Vector3)UserSetCenterOfMassDisplacement; 87 comDisp = (OMV.Vector3)UserSetCenterOfMassDisplacement;
86 else 88 else
87 comDisp = centerOfMassDisplacement; 89 comDisp = centerOfMassDisplacement;
88 90
91 // Eliminate any jitter caused be very slight differences in masses and positions
92 if (comDisp.ApproxEquals(Vector3.Zero, 0.01f) )
93 comDisp = Vector3.Zero;
94
89 DetailLog("{0},BSPrimDisplaced.SetEffectiveCenterOfMassDisplacement,userSet={1},comDisp={2}", 95 DetailLog("{0},BSPrimDisplaced.SetEffectiveCenterOfMassDisplacement,userSet={1},comDisp={2}",
90 LocalID, UserSetCenterOfMassDisplacement.HasValue, comDisp); 96 LocalID, UserSetCenterOfMassDisplacement.HasValue, comDisp);
91 if (comDisp == Vector3.Zero) 97 if ( !comDisp.ApproxEquals(PositionDisplacement, 0.01f) )
92 { 98 {
93 // If there is no diplacement. Things get reset. 99 // Displacement setting is changing.
94 PositionDisplacement = OMV.Vector3.Zero; 100 // The relationship between the physical object and simulated object must be aligned.
95 OrientationDisplacement = OMV.Quaternion.Identity;
96 }
97 else
98 {
99 // Remember the displacement from root as well as the origional rotation of the
100 // new center-of-mass.
101 PositionDisplacement = comDisp; 101 PositionDisplacement = comDisp;
102 OrientationDisplacement = OMV.Quaternion.Identity; 102 this.ForcePosition = RawPosition;
103 } 103 }
104
105 return PositionDisplacement;
104 } 106 }
105 107
108 // 'ForcePosition' is the one way to set the physical position of the body in the physics engine.
109 // Displace the simulator idea of position (center of root prim) to the physical position.
106 public override Vector3 ForcePosition 110 public override Vector3 ForcePosition
107 { 111 {
108 get { return base.ForcePosition; } 112 get {
113 OMV.Vector3 physPosition = PhysScene.PE.GetPosition(PhysBody);
114 if (PositionDisplacement != OMV.Vector3.Zero)
115 {
116 // If there is some displacement, return the physical position (center-of-mass)
117 // location minus the displacement to give the center of the root prim.
118 OMV.Vector3 displacement = PositionDisplacement * ForceOrientation;
119 DetailLog("{0},BSPrimDisplaced.ForcePosition,get,physPos={1},disp={2},simPos={3}",
120 LocalID, physPosition, displacement, physPosition - displacement);
121 physPosition -= displacement;
122 }
123 RawPosition = physPosition;
124 return physPosition;
125 }
109 set 126 set
110 { 127 {
111 if (PositionDisplacement != OMV.Vector3.Zero) 128 if (PositionDisplacement != OMV.Vector3.Zero)
112 { 129 {
113 OMV.Vector3 displacedPos = value - (PositionDisplacement * RawOrientation); 130 // This value is the simulator's idea of where the prim is: the center of the root prim
114 DetailLog("{0},BSPrimDisplaced.ForcePosition,val={1},disp={2},newPos={3}", LocalID, value, PositionDisplacement, displacedPos); 131 RawPosition = value;
115 base.ForcePosition = displacedPos; 132
133 // Move the passed root prim postion to the center-of-mass position and set in the physics engine.
134 OMV.Vector3 displacement = PositionDisplacement * RawOrientation;
135 OMV.Vector3 displacedPos = RawPosition + displacement;
136 DetailLog("{0},BSPrimDisplaced.ForcePosition,set,simPos={1},disp={2},physPos={3}",
137 LocalID, RawPosition, displacement, displacedPos);
138 if (PhysBody.HasPhysicalBody)
139 {
140 PhysScene.PE.SetTranslation(PhysBody, displacedPos, RawOrientation);
141 ActivateIfPhysical(false);
142 }
116 } 143 }
117 else 144 else
118 { 145 {
@@ -121,25 +148,12 @@ public class BSPrimDisplaced : BSPrim
121 } 148 }
122 } 149 }
123 150
124 public override Quaternion ForceOrientation 151 // These are also overridden by BSPrimLinkable if the prim can be part of a linkset
125 {
126 get { return base.ForceOrientation; }
127 set
128 {
129 // TODO:
130 base.ForceOrientation = value;
131 }
132 }
133
134 // TODO: decide if this is the right place for these variables.
135 // Somehow incorporate the optional settability by the user.
136 // Is this used?
137 public override OMV.Vector3 CenterOfMass 152 public override OMV.Vector3 CenterOfMass
138 { 153 {
139 get { return RawPosition; } 154 get { return RawPosition; }
140 } 155 }
141 156
142 // Is this used?
143 public override OMV.Vector3 GeometricCenter 157 public override OMV.Vector3 GeometricCenter
144 { 158 {
145 get { return RawPosition; } 159 get { return RawPosition; }
@@ -148,15 +162,18 @@ public class BSPrimDisplaced : BSPrim
148 public override void UpdateProperties(EntityProperties entprop) 162 public override void UpdateProperties(EntityProperties entprop)
149 { 163 {
150 // Undo any center-of-mass displacement that might have been done. 164 // Undo any center-of-mass displacement that might have been done.
151 if (PositionDisplacement != OMV.Vector3.Zero || OrientationDisplacement != OMV.Quaternion.Identity) 165 if (PositionDisplacement != OMV.Vector3.Zero)
152 { 166 {
153 // Correct for any rotation around the center-of-mass 167 // The origional shape was offset from 'zero' by PositionDisplacement.
154 // TODO!!! 168 // These physical location must be back converted to be centered around the displaced
155 169 // root shape.
156 OMV.Vector3 displacedPos = entprop.Position + (PositionDisplacement * entprop.Rotation); 170
157 DetailLog("{0},BSPrimDisplaced.ForcePosition,physPos={1},disp={2},newPos={3}", LocalID, entprop.Position, PositionDisplacement, displacedPos); 171 // Move the returned center-of-mass location to the root prim location.
172 OMV.Vector3 displacement = PositionDisplacement * entprop.Rotation;
173 OMV.Vector3 displacedPos = entprop.Position - displacement;
174 DetailLog("{0},BSPrimDisplaced.UpdateProperties,physPos={1},disp={2},simPos={3}",
175 LocalID, entprop.Position, displacement, displacedPos);
158 entprop.Position = displacedPos; 176 entprop.Position = displacedPos;
159 // entprop.Rotation = something;
160 } 177 }
161 178
162 base.UpdateProperties(entprop); 179 base.UpdateProperties(entprop);
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrimLinkable.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPrimLinkable.cs
index 87eed98..1fbcfcc 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSPrimLinkable.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSPrimLinkable.cs
@@ -37,6 +37,12 @@ namespace OpenSim.Region.Physics.BulletSPlugin
37{ 37{
38public class BSPrimLinkable : BSPrimDisplaced 38public class BSPrimLinkable : BSPrimDisplaced
39{ 39{
40 // The purpose of this subclass is to add linkset functionality to the prim. This overrides
41 // operations necessary for keeping the linkset created and, additionally, this
42 // calls the linkset implementation for its creation and management.
43
44 // This adds the overrides for link() and delink() so the prim is linkable.
45
40 public BSLinkset Linkset { get; set; } 46 public BSLinkset Linkset { get; set; }
41 // The index of this child prim. 47 // The index of this child prim.
42 public int LinksetChildIndex { get; set; } 48 public int LinksetChildIndex { get; set; }
@@ -69,8 +75,8 @@ public class BSPrimLinkable : BSPrimDisplaced
69 BSPrimLinkable parent = obj as BSPrimLinkable; 75 BSPrimLinkable parent = obj as BSPrimLinkable;
70 if (parent != null) 76 if (parent != null)
71 { 77 {
72 BSPhysObject parentBefore = Linkset.LinksetRoot; 78 BSPhysObject parentBefore = Linkset.LinksetRoot; // DEBUG
73 int childrenBefore = Linkset.NumberOfChildren; 79 int childrenBefore = Linkset.NumberOfChildren; // DEBUG
74 80
75 Linkset = parent.Linkset.AddMeToLinkset(this); 81 Linkset = parent.Linkset.AddMeToLinkset(this);
76 82
@@ -85,8 +91,8 @@ public class BSPrimLinkable : BSPrimDisplaced
85 // TODO: decide if this parent checking needs to happen at taint time 91 // TODO: decide if this parent checking needs to happen at taint time
86 // Race condition here: if link() and delink() in same simulation tick, the delink will not happen 92 // Race condition here: if link() and delink() in same simulation tick, the delink will not happen
87 93
88 BSPhysObject parentBefore = Linkset.LinksetRoot; 94 BSPhysObject parentBefore = Linkset.LinksetRoot; // DEBUG
89 int childrenBefore = Linkset.NumberOfChildren; 95 int childrenBefore = Linkset.NumberOfChildren; // DEBUG
90 96
91 Linkset = Linkset.RemoveMeFromLinkset(this); 97 Linkset = Linkset.RemoveMeFromLinkset(this);
92 98
@@ -128,6 +134,17 @@ public class BSPrimLinkable : BSPrimDisplaced
128 get { return Linkset.LinksetMass; } 134 get { return Linkset.LinksetMass; }
129 } 135 }
130 136
137 public override OMV.Vector3 CenterOfMass
138 {
139 get { return Linkset.CenterOfMass; }
140 }
141
142 public override OMV.Vector3 GeometricCenter
143 {
144 get { return Linkset.GeometricCenter; }
145 }
146
147 // Refresh the linkset structure and parameters when the prim's physical parameters are changed.
131 public override void UpdatePhysicalParameters() 148 public override void UpdatePhysicalParameters()
132 { 149 {
133 base.UpdatePhysicalParameters(); 150 base.UpdatePhysicalParameters();
@@ -139,13 +156,17 @@ public class BSPrimLinkable : BSPrimDisplaced
139 Linkset.Refresh(this); 156 Linkset.Refresh(this);
140 } 157 }
141 158
159 // When the prim is made dynamic or static, the linkset needs to change.
142 protected override void MakeDynamic(bool makeStatic) 160 protected override void MakeDynamic(bool makeStatic)
143 { 161 {
144 base.MakeDynamic(makeStatic); 162 base.MakeDynamic(makeStatic);
145 if (makeStatic) 163 if (Linkset != null) // null can happen during initialization
146 Linkset.MakeStatic(this); 164 {
147 else 165 if (makeStatic)
148 Linkset.MakeDynamic(this); 166 Linkset.MakeStatic(this);
167 else
168 Linkset.MakeDynamic(this);
169 }
149 } 170 }
150 171
151 // Body is being taken apart. Remove physical dependencies and schedule a rebuild. 172 // Body is being taken apart. Remove physical dependencies and schedule a rebuild.
@@ -155,6 +176,8 @@ public class BSPrimLinkable : BSPrimDisplaced
155 base.RemoveDependencies(); 176 base.RemoveDependencies();
156 } 177 }
157 178
179 // Called after a simulation step for the changes in physical object properties.
180 // Do any filtering/modification needed for linksets.
158 public override void UpdateProperties(EntityProperties entprop) 181 public override void UpdateProperties(EntityProperties entprop)
159 { 182 {
160 if (Linkset.IsRoot(this)) 183 if (Linkset.IsRoot(this))
@@ -176,6 +199,7 @@ public class BSPrimLinkable : BSPrimDisplaced
176 Linkset.UpdateProperties(UpdatedProperties.EntPropUpdates, this); 199 Linkset.UpdateProperties(UpdatedProperties.EntPropUpdates, this);
177 } 200 }
178 201
202 // Called after a simulation step to post a collision with this object.
179 public override bool Collide(uint collidingWith, BSPhysObject collidee, 203 public override bool Collide(uint collidingWith, BSPhysObject collidee,
180 OMV.Vector3 contactPoint, OMV.Vector3 contactNormal, float pentrationDepth) 204 OMV.Vector3 contactPoint, OMV.Vector3 contactNormal, float pentrationDepth)
181 { 205 {
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
index 1645c98..e56a6f6 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
@@ -785,7 +785,6 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters
785 { 785 {
786 // The simulation of the time interval took less than realtime. 786 // The simulation of the time interval took less than realtime.
787 // Do a sleep for the rest of realtime. 787 // Do a sleep for the rest of realtime.
788 DetailLog("{0},BulletSPluginPhysicsThread,sleeping={1}", BSScene.DetailLogZero, simulationTimeVsRealtimeDifferenceMS);
789 Thread.Sleep(simulationTimeVsRealtimeDifferenceMS); 788 Thread.Sleep(simulationTimeVsRealtimeDifferenceMS);
790 } 789 }
791 else 790 else
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt b/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt
index 4357ef1..0453376 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt
+++ b/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt
@@ -3,25 +3,21 @@ CURRENT PROBLEMS TO FIX AND/OR LOOK AT
3Vehicle buoyancy. Computed correctly? Possibly creating very large effective mass. 3Vehicle buoyancy. Computed correctly? Possibly creating very large effective mass.
4 Interaction of llSetBuoyancy and vehicle buoyancy. Should be additive? 4 Interaction of llSetBuoyancy and vehicle buoyancy. Should be additive?
5 Negative buoyancy computed correctly 5 Negative buoyancy computed correctly
6Center-of-gravity
6Computation of mesh mass. How done? How should it be done? 7Computation of mesh mass. How done? How should it be done?
7Script changing rotation of child prim while vehicle moving (eg turning wheel) causes
8 the wheel to appear to jump back. Looks like sending position from previous update.
9Enable vehicle border crossings (at least as poorly as ODE) 8Enable vehicle border crossings (at least as poorly as ODE)
10 Terrain skirts 9 Terrain skirts
11 Avatar created in previous region and not new region when crossing border 10 Avatar created in previous region and not new region when crossing border
12 Vehicle recreated in new sim at small Z value (offset from root value?) (DONE) 11 Vehicle recreated in new sim at small Z value (offset from root value?) (DONE)
12User settable terrain mesh
13 Allow specifying as convex or concave and use different getHeight functions depending
14Boats, when turning nose down into the water
15 Acts like rotation around Z is also effecting rotation around X and Y
13Deleting a linkset while standing on the root will leave the physical shape of the root behind. 16Deleting a linkset while standing on the root will leave the physical shape of the root behind.
14 Not sure if it is because standing on it. Done with large prim linksets. 17 Not sure if it is because standing on it. Done with large prim linksets.
15Linkset child rotations. 18Linkset child rotations.
16 Nebadon spiral tube has middle sections which are rotated wrong. 19 Nebadon spiral tube has middle sections which are rotated wrong.
17 Select linked spiral tube. Delink and note where the middle section ends up. 20 Select linked spiral tube. Delink and note where the middle section ends up.
18Refarb compound linkset creation to create a pseudo-root for center-of-mass
19 Let children change their shape to physical indendently and just add shapes to compound
20Vehicle angular vertical attraction
21vehicle angular banking
22Center-of-gravity
23Vehicle angular deflection
24 Preferred orientation angular correction fix
25Teravus llMoveToTarget script debug 21Teravus llMoveToTarget script debug
26 Mixing of hover, buoyancy/gravity, moveToTarget, into one force 22 Mixing of hover, buoyancy/gravity, moveToTarget, into one force
27 Setting hover height to zero disables hover even if hover flags are on (from SL wiki) 23 Setting hover height to zero disables hover even if hover flags are on (from SL wiki)
@@ -33,10 +29,16 @@ Vehicle script tuning/debugging
33 Avanti speed script 29 Avanti speed script
34 Weapon shooter script 30 Weapon shooter script
35Move material definitions (friction, ...) into simulator. 31Move material definitions (friction, ...) into simulator.
32osGetPhysicsEngineVerion() and create a version code for the C++ DLL
36One sided meshes? Should terrain be built into a closed shape? 33One sided meshes? Should terrain be built into a closed shape?
37 When meshes get partially wedged into the terrain, they cannot push themselves out. 34 When meshes get partially wedged into the terrain, they cannot push themselves out.
38 It is possible that Bullet processes collisions whether entering or leaving a mesh. 35 It is possible that Bullet processes collisions whether entering or leaving a mesh.
39 Ref: http://bulletphysics.org/Bullet/phpBB3/viewtopic.php?t=4869 36 Ref: http://bulletphysics.org/Bullet/phpBB3/viewtopic.php?t=4869
37Small physical objects do not interact correctly
38 Create chain of .5x.5x.1 torui and make all but top physical so to hang.
39 The chain will fall apart and pairs will dance around on ground
40 Chains of 1x1x.2 will stay connected but will dance.
41 Chains above 2x2x.4 are more stable and get stablier as torui get larger.
40 42
41VEHICLES TODO LIST: 43VEHICLES TODO LIST:
42================================================= 44=================================================
@@ -45,14 +47,12 @@ LINEAR_MOTOR_DIRECTION values should be clamped to reasonable numbers.
45 Same for other velocity settings. 47 Same for other velocity settings.
46UBit improvements to remove rubber-banding of avatars sitting on vehicle child prims: 48UBit improvements to remove rubber-banding of avatars sitting on vehicle child prims:
47 https://github.com/UbitUmarov/Ubit-opensim 49 https://github.com/UbitUmarov/Ubit-opensim
48Vehicles (Move smoothly)
49Some vehicles should not be able to turn if no speed or off ground. 50Some vehicles should not be able to turn if no speed or off ground.
50Cannot edit/move a vehicle being ridden: it jumps back to the origional position. 51Cannot edit/move a vehicle being ridden: it jumps back to the origional position.
51Neb car jiggling left and right 52Neb car jiggling left and right
52 Happens on terrain and any other mesh object. Flat cubes are much smoother. 53 Happens on terrain and any other mesh object. Flat cubes are much smoother.
53 This has been reduced but not eliminated. 54 This has been reduced but not eliminated.
54Implement referenceFrame for all the motion routines. 55Implement referenceFrame for all the motion routines.
55For limitMotorUp, use raycast down to find if vehicle is in the air.
56Verify llGetVel() is returning a smooth and good value for vehicle movement. 56Verify llGetVel() is returning a smooth and good value for vehicle movement.
57llGetVel() should return the root's velocity if requested in a child prim. 57llGetVel() should return the root's velocity if requested in a child prim.
58Implement function efficiency for lineaar and angular motion. 58Implement function efficiency for lineaar and angular motion.
@@ -93,29 +93,15 @@ Revisit CollisionMargin. Builders notice the 0.04 spacing between prims.
93Duplicating a physical prim causes old prim to jump away 93Duplicating a physical prim causes old prim to jump away
94 Dup a phys prim and the original become unselected and thus interacts w/ selected prim. 94 Dup a phys prim and the original become unselected and thus interacts w/ selected prim.
95Scenes with hundred of thousands of static objects take a lot of physics CPU time. 95Scenes with hundred of thousands of static objects take a lot of physics CPU time.
96BSPrim.Force should set a continious force on the prim. The force should be
97 applied each tick. Some limits?
98Gun sending shooter flying. 96Gun sending shooter flying.
99Collision margin (gap between physical objects lying on each other) 97Collision margin (gap between physical objects lying on each other)
100Boundry checking (crashes related to crossing boundry) 98Boundry checking (crashes related to crossing boundry)
101 Add check for border edge position for avatars and objects. 99 Add check for border edge position for avatars and objects.
102 Verify the events are created for border crossings. 100 Verify the events are created for border crossings.
103Avatar rotation (check out changes to ScenePresence for physical rotation)
104Avatar running (what does phys engine need to do?)
105Small physical objects do not interact correctly
106 Create chain of .5x.5x.1 torui and make all but top physical so to hang.
107 The chain will fall apart and pairs will dance around on ground
108 Chains of 1x1x.2 will stay connected but will dance.
109 Chains above 2x2x.4 are more stable and get stablier as torui get larger.
110Add PID motor for avatar movement (slow to stop, ...)
111setForce should set a constant force. Different than AddImpulse.
112Implement raycast.
113Implement ShapeCollection.Dispose() 101Implement ShapeCollection.Dispose()
114Implement water as a plain so raycasting and collisions can happen with same. 102Implement water as a plain or mesh so raycasting and collisions can happen with same.
115Add collision penetration return 103Add collision penetration return
116 Add field passed back by BulletSim.dll and fill with info in ManifoldConstact.GetDistance() 104 Add field passed back by BulletSim.dll and fill with info in ManifoldConstact.GetDistance()
117Add osGetPhysicsEngineName() so scripters can tell whether BulletSim or ODE
118 Also osGetPhysicsEngineVerion() maybe.
119Linkset.Position and Linkset.Orientation requre rewrite to properly return 105Linkset.Position and Linkset.Orientation requre rewrite to properly return
120 child position. LinksetConstraint acts like it's at taint time!! 106 child position. LinksetConstraint acts like it's at taint time!!
121Implement LockAngularMotion -- implements llSetStatus(ROTATE_AXIS_*, T/F) 107Implement LockAngularMotion -- implements llSetStatus(ROTATE_AXIS_*, T/F)
@@ -127,9 +113,6 @@ Selecting and deselecting physical objects causes CPU processing time to jump
127Re-implement buoyancy as a separate force on the object rather than diddling gravity. 113Re-implement buoyancy as a separate force on the object rather than diddling gravity.
128 Register a pre-step event to add the force. 114 Register a pre-step event to add the force.
129More efficient memory usage when passing hull information from BSPrim to BulletSim 115More efficient memory usage when passing hull information from BSPrim to BulletSim
130Avatar movement motor check for zero or small movement. Somehow suppress small movements
131 when avatar has stopped and is just standing. Simple test for near zero has
132 the problem of preventing starting up (increase from zero) especially when falling.
133Physical and phantom will drop through the terrain 116Physical and phantom will drop through the terrain
134 117
135 118
@@ -172,7 +155,6 @@ Do we need to do convex hulls all the time? Can complex meshes be left meshes?
172 There is some problem with meshes and collisions 155 There is some problem with meshes and collisions
173 Hulls are not as detailed as meshes. Hulled vehicles insides are different shape. 156 Hulls are not as detailed as meshes. Hulled vehicles insides are different shape.
174Debounce avatar contact so legs don't keep folding up when standing. 157Debounce avatar contact so legs don't keep folding up when standing.
175Implement LSL physics controls. Like STATUS_ROTATE_X.
176Add border extensions to terrain to help region crossings and objects leaving region. 158Add border extensions to terrain to help region crossings and objects leaving region.
177Use a different capsule shape for avatar when sitting 159Use a different capsule shape for avatar when sitting
178 LL uses a pyrimidal shape scaled by the avatar's bounding box 160 LL uses a pyrimidal shape scaled by the avatar's bounding box
@@ -205,8 +187,6 @@ Keep avatar scaling correct. http://pennycow.blogspot.fr/2011/07/matter-of-scale
205 187
206INTERNAL IMPROVEMENT/CLEANUP 188INTERNAL IMPROVEMENT/CLEANUP
207================================================= 189=================================================
208Can the 'inTaintTime' flag be cleaned up and used? For instance, a call to
209 BSScene.TaintedObject() could immediately execute the callback if already in taint time.
210Create the physical wrapper classes (BulletBody, BulletShape) by methods on 190Create the physical wrapper classes (BulletBody, BulletShape) by methods on
211 BSAPITemplate and make their actual implementation Bullet engine specific. 191 BSAPITemplate and make their actual implementation Bullet engine specific.
212 For the short term, just call the existing functions in ShapeCollection. 192 For the short term, just call the existing functions in ShapeCollection.
@@ -365,4 +345,35 @@ After getting off a vehicle, the root prim is phantom (can be walked through)
365Explore btGImpactMeshShape as alternative to convex hulls for simplified physical objects. 345Explore btGImpactMeshShape as alternative to convex hulls for simplified physical objects.
366 Regular triangle meshes don't do physical collisions. 346 Regular triangle meshes don't do physical collisions.
367 (DONE: discovered GImpact is VERY CPU intensive) 347 (DONE: discovered GImpact is VERY CPU intensive)
348Script changing rotation of child prim while vehicle moving (eg turning wheel) causes
349 the wheel to appear to jump back. Looks like sending position from previous update.
350 (DONE: redo of compound linksets fixed problem)
351Refarb compound linkset creation to create a pseudo-root for center-of-mass
352 Let children change their shape to physical indendently and just add shapes to compound
353 (DONE: redo of compound linkset fixed problem)
354Vehicle angular vertical attraction (DONE: vegaslon code)
355vehicle angular banking (DONE: vegaslon code)
356Vehicle angular deflection (DONE: vegaslon code)
357 Preferred orientation angular correction fix
358Vehicles (Move smoothly)
359For limitMotorUp, use raycast down to find if vehicle is in the air.
360 (WILL NOT BE DONE: gravity does the job well enough)
361BSPrim.Force should set a continious force on the prim. The force should be
362 applied each tick. Some limits?
363 (DONE: added physical actors. Implemented SetForce, SetTorque, ...)
364Implement LSL physics controls. Like STATUS_ROTATE_X. (DONE)
365Add osGetPhysicsEngineName() so scripters can tell whether BulletSim or ODE
366Avatar rotation (check out changes to ScenePresence for physical rotation) (DONE)
367Avatar running (what does phys engine need to do?) (DONE: multiplies run factor by walking force)
368setForce should set a constant force. Different than AddImpulse. (DONE)
369Add PID motor for avatar movement (slow to stop, ...) (WNBD: current works ok)
370Avatar movement motor check for zero or small movement. Somehow suppress small movements
371 when avatar has stopped and is just standing. Simple test for near zero has
372 the problem of preventing starting up (increase from zero) especially when falling.
373 (DONE: avatar movement actor knows if standing on stationary object and zeros motion)
374Can the 'inTaintTime' flag be cleaned up and used? For instance, a call to
375 BSScene.TaintedObject() could immediately execute the callback if already in taint time.
376 (DONE)
377
378
368 379
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index c0b8373..34e2b4d 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -2382,6 +2382,32 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2382 return force; 2382 return force;
2383 } 2383 }
2384 2384
2385 public void llSetVelocity(LSL_Vector velocity, int local)
2386 {
2387 m_host.AddScriptLPS(1);
2388
2389 if (!m_host.ParentGroup.IsDeleted)
2390 {
2391 if (local != 0)
2392 velocity *= llGetRot();
2393
2394 m_host.ParentGroup.RootPart.Velocity = velocity;
2395 }
2396 }
2397
2398 public void llSetAngularVelocity(LSL_Vector angularVelocity, int local)
2399 {
2400 m_host.AddScriptLPS(1);
2401
2402 if (!m_host.ParentGroup.IsDeleted)
2403 {
2404 if (local != 0)
2405 angularVelocity *= llGetRot();
2406
2407 m_host.ParentGroup.RootPart.AngularVelocity = angularVelocity;
2408 }
2409 }
2410
2385 public LSL_Integer llTarget(LSL_Vector position, double range) 2411 public LSL_Integer llTarget(LSL_Vector position, double range)
2386 { 2412 {
2387 m_host.AddScriptLPS(1); 2413 m_host.AddScriptLPS(1);
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs
index ff13ee6..340edb3 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs
@@ -342,6 +342,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
342 void llSetDamage(double damage); 342 void llSetDamage(double damage);
343 void llSetForce(LSL_Vector force, int local); 343 void llSetForce(LSL_Vector force, int local);
344 void llSetForceAndTorque(LSL_Vector force, LSL_Vector torque, int local); 344 void llSetForceAndTorque(LSL_Vector force, LSL_Vector torque, int local);
345 void llSetVelocity(LSL_Vector velocity, int local);
346 void llSetAngularVelocity(LSL_Vector angularVelocity, int local);
345 void llSetHoverHeight(double height, int water, double tau); 347 void llSetHoverHeight(double height, int water, double tau);
346 void llSetInventoryPermMask(string item, int mask, int value); 348 void llSetInventoryPermMask(string item, int mask, int value);
347 void llSetLinkAlpha(int linknumber, double alpha, int face); 349 void llSetLinkAlpha(int linknumber, double alpha, int face);
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs
index 87cc342..7cd17e7 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs
@@ -1548,6 +1548,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
1548 m_LSL_Functions.llSetForceAndTorque(force, torque, local); 1548 m_LSL_Functions.llSetForceAndTorque(force, torque, local);
1549 } 1549 }
1550 1550
1551 public void llSetVelocity(LSL_Vector force, int local)
1552 {
1553 m_LSL_Functions.llSetVelocity(force, local);
1554 }
1555
1556 public void llSetAngularVelocity(LSL_Vector force, int local)
1557 {
1558 m_LSL_Functions.llSetAngularVelocity(force, local);
1559 }
1560
1551 public void llSetHoverHeight(double height, int water, double tau) 1561 public void llSetHoverHeight(double height, int water, double tau)
1552 { 1562 {
1553 m_LSL_Functions.llSetHoverHeight(height, water, tau); 1563 m_LSL_Functions.llSetHoverHeight(height, water, tau);
diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs
index a9fd4ed..40a34c6 100644
--- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs
+++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs
@@ -107,7 +107,7 @@ namespace OpenSim.Server.Handlers.Simulation
107 } 107 }
108 else 108 else
109 { 109 {
110 m_log.InfoFormat("[AGENT HANDLER]: method {0} not supported in agent message", method); 110 m_log.InfoFormat("[AGENT HANDLER]: method {0} not supported in agent message (caller is {1})", method, Util.GetCallerIP(request));
111 responsedata["int_response_code"] = HttpStatusCode.MethodNotAllowed; 111 responsedata["int_response_code"] = HttpStatusCode.MethodNotAllowed;
112 responsedata["str_response_string"] = "Method not allowed"; 112 responsedata["str_response_string"] = "Method not allowed";
113 113
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianPresenceServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianPresenceServiceConnector.cs
index 7bb06fb..0a39088 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianPresenceServiceConnector.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianPresenceServiceConnector.cs
@@ -65,7 +65,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
65 public void PostInitialise() { } 65 public void PostInitialise() { }
66 public void Close() { } 66 public void Close() { }
67 67
68 public SimianPresenceServiceConnector() { m_activityDetector = new SimianActivityDetector(this); } 68 public SimianPresenceServiceConnector() { }
69 public string Name { get { return "SimianPresenceServiceConnector"; } } 69 public string Name { get { return "SimianPresenceServiceConnector"; } }
70 public void AddRegion(Scene scene) 70 public void AddRegion(Scene scene)
71 { 71 {
@@ -121,6 +121,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
121 if (!serviceUrl.EndsWith("/") && !serviceUrl.EndsWith("=")) 121 if (!serviceUrl.EndsWith("/") && !serviceUrl.EndsWith("="))
122 serviceUrl = serviceUrl + '/'; 122 serviceUrl = serviceUrl + '/';
123 m_serverUrl = serviceUrl; 123 m_serverUrl = serviceUrl;
124 m_activityDetector = new SimianActivityDetector(this);
124 m_Enabled = true; 125 m_Enabled = true;
125 } 126 }
126 } 127 }
diff --git a/OpenSim/Services/UserAccountService/GridUserService.cs b/OpenSim/Services/UserAccountService/GridUserService.cs
index fa9a4a8..b1cdd45 100644
--- a/OpenSim/Services/UserAccountService/GridUserService.cs
+++ b/OpenSim/Services/UserAccountService/GridUserService.cs
@@ -156,7 +156,7 @@ namespace OpenSim.Services.UserAccountService
156 156
157 public bool SetLastPosition(string userID, UUID sessionID, UUID regionID, Vector3 lastPosition, Vector3 lastLookAt) 157 public bool SetLastPosition(string userID, UUID sessionID, UUID regionID, Vector3 lastPosition, Vector3 lastLookAt)
158 { 158 {
159 //m_log.DebugFormat("[Grid User Service]: SetLastPosition for {0}", userID); 159 m_log.DebugFormat("[GRID USER SERVICE]: SetLastPosition for {0}", userID);
160 GridUserData d = m_Database.Get(userID); 160 GridUserData d = m_Database.Get(userID);
161 if (d == null) 161 if (d == null)
162 { 162 {
diff --git a/bin/OpenSimDefaults.ini b/bin/OpenSimDefaults.ini
index 4a89fe2..4a3104e 100644
--- a/bin/OpenSimDefaults.ini
+++ b/bin/OpenSimDefaults.ini
@@ -919,54 +919,72 @@
919 ; ## Joint support 919 ; ## Joint support
920 ; ## 920 ; ##
921 921
922 ; if you would like physics joints to be enabled through a special naming convention in the client, set this to true. 922 ; If you would like physics joints to be enabled through a special naming
923 ; (see NINJA Physics documentation, http://opensimulator.org/wiki/NINJA_Physics) 923 ; convention in the client, set this to true.
924 ; default is false 924 ; (See NINJA Physics documentation, http://opensimulator.org/wiki/NINJA_Physics)
925 ; Default is false
925 ;use_NINJA_physics_joints = true 926 ;use_NINJA_physics_joints = true
926 927
927 ; ## 928 ; ##
928 ; ## additional meshing options 929 ; ## additional meshing options
929 ; ## 930 ; ##
930 931
931 ; physical collision mesh proxies are normally created for complex prim shapes, and collisions for simple boxes and 932 ; Physical collision mesh proxies are normally created for complex prim shapes,
932 ; spheres are computed algorithmically. If you would rather have mesh proxies for simple prims, you can set this to 933 ; and collisions for simple boxes and spheres are computed algorithmically.
933 ; true. Note that this will increase memory usage and region startup time. Default is false. 934 ; If you would rather have mesh proxies for simple prims, you can set this to
935 ; true. Note that this will increase memory usage and region startup time.
936 ; Default is false.
934 ;force_simple_prim_meshing = true 937 ;force_simple_prim_meshing = true
935 938
936[BulletSim] 939[BulletSim]
937 ; All the BulletSim parameters can be displayed with the console command "physics get all" 940 ; All the BulletSim parameters can be displayed with the console command
938 ; and all are defined in the source file OpenSim/Regions/Physics/BulletSPlugin/BSParam.cs. 941 ; "physics get all" and all are defined in the source file
942 ; OpenSim/Regions/Physics/BulletSPlugin/BSParam.cs.
939 943
940 ; There are two bullet physics libraries, bulletunmanaged is the default and is a native c++ dll 944 ; There are two bullet physics libraries, bulletunmanaged is the default and is a
941 ; bulletxna is a managed C# dll. They have comparible functionality but the c++ one is much faster. 945 ; native c++ dll bulletxna is a managed C# dll. They have comparible functionality
946 ; but the c++ one is much faster.
942 BulletEngine = "bulletunmanaged" 947 BulletEngine = "bulletunmanaged"
943 ; BulletEngine = "bulletxna" 948 ; BulletEngine = "bulletxna"
944 949
945 ; Terrain Implementation 950 ; BulletSim can run on its own thread independent of the simulator's heartbeat
946 TerrainImplementation = 1 ; 0=Heightfield, 1=mesh 951 ; thread. Enabling this will nto let the physics engine slow down avatar movement, etc.
947 ; For mesh terrain, the detail of the created mesh. '1' gives 256x256 (heightfield resolution). '2' 952 UseSeparatePhysicsThread = false
948 ; gives 512x512. Etc. Cannot be larger than '4'. Higher magnification uses lots of memory. 953
954 ; Terrain implementation can use either Bullet's heightField or BulletSim can build
955 ; a mesh. 0=heightField, 1=mesh
956 TerrainImplementation = 1
957 ; For mesh terrain, the detail of the created mesh. '1' gives 256x256 (heightfield
958 ; resolution). '2' gives 512x512. Etc. Cannot be larger than '4'. Higher
959 ; magnification uses lots of memory.
949 TerrainMeshMagnification = 2 960 TerrainMeshMagnification = 2
950 961
951 ; Avatar physics height adjustments. http://opensimulator.org/wiki/BulletSim#Adjusting_Avatar_Height 962 ; Avatar physics height adjustments.
963 ; http://opensimulator.org/wiki/BulletSim#Adjusting_Avatar_Height
952 AvatarHeightLowFudge = -0.2 ; Adjustment at low end of height range 964 AvatarHeightLowFudge = -0.2 ; Adjustment at low end of height range
953 AvatarHeightMidFudge = 0.1 ; Adjustment at mid point of avatar height range 965 AvatarHeightMidFudge = 0.1 ; Adjustment at mid point of avatar height range
954 AvatarHeightHighFudge = 0.1 ; Adjustment at high end of height range 966 AvatarHeightHighFudge = 0.1 ; Adjustment at high end of height range
955 967
956 ; Default linkset implmentation 968 ; Default linkset implmentation
957 ; 'Constraint' uses physics constraints to hold linkset together. 'Compound' builds a compound 969 ; 'Constraint' uses physics constraints to hold linkset together. 'Compound'
958 ; shape from the children shapes to create a single physical shape. 'Compound' uses a lot less CPU time. 970 ; builds a compound shape from the children shapes to create a single physical
971 ; shape. 'Compound' uses a lot less CPU time.
959 LinkImplementation = 1 ; 0=constraint, 1=compound 972 LinkImplementation = 1 ; 0=constraint, 1=compound
960 973
974 ; If 'true', offset a linkset's origin based on mass of linkset parts.
975 LinksetOffsetCenterOfMass = false
976
961 ; If 'true', turn scuplties into meshes 977 ; If 'true', turn scuplties into meshes
962 MeshSculptedPrim = true 978 MeshSculptedPrim = true
963 979
964 ; If 'true', force simple prims (box and sphere) to be meshed 980 ; If 'true', force simple prims (box and sphere) to be meshed
965 ; If 'false', the Bullet native special case shape is used for square rectangles and even dimensioned spheres 981 ; If 'false', the Bullet native special case shape is used for square rectangles
982 ; and even dimensioned spheres.
966 ForceSimplePrimMeshing = false 983 ForceSimplePrimMeshing = false
967 984
968 ; If 'true', when creating meshes, remove all triangles that have two equal vertexes. 985 ; If 'true', when creating meshes, remove all triangles that have two equal vertexes.
969 ; Happens often in sculpties. If turned off, there will be some doorways that cannot be walked through. 986 ; Happens often in sculpties. If turned off, there will be some doorways
987 ; that cannot be walked through.
970 ShouldRemoveZeroWidthTriangles = true 988 ShouldRemoveZeroWidthTriangles = true
971 989
972 ; If 'true', use convex hull definition in mesh asset if present. 990 ; If 'true', use convex hull definition in mesh asset if present.