aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorJeff Ames2008-05-17 00:06:35 +0000
committerJeff Ames2008-05-17 00:06:35 +0000
commita5f08b430d644c7a4274db9fff3db0c63a6a7857 (patch)
tree4216400d14b587763167839344d61c0a6f6d8c85 /OpenSim/Region
parent* Committing patch from mantis 0001297: [PATCH] Fix behavior of child prim in... (diff)
downloadopensim-SC-a5f08b430d644c7a4274db9fff3db0c63a6a7857.zip
opensim-SC-a5f08b430d644c7a4274db9fff3db0c63a6a7857.tar.gz
opensim-SC-a5f08b430d644c7a4274db9fff3db0c63a6a7857.tar.bz2
opensim-SC-a5f08b430d644c7a4274db9fff3db0c63a6a7857.tar.xz
Formatting cleanup.
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs38
-rw-r--r--OpenSim/Region/Communications/OGS1/OGS1UserServices.cs6
-rw-r--r--OpenSim/Region/Environment/Modules/Agent/AssetTransaction/AgentAssetsTransactions.cs2
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.Inventory.cs58
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObjectGroup.Inventory.cs10
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs2
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs22
-rw-r--r--OpenSim/Region/Environment/Scenes/ScenePresence.cs6
-rw-r--r--OpenSim/Region/Physics/OdePlugin/ODEPrim.cs154
9 files changed, 93 insertions, 205 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
index 4d27a0c..180a806 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
@@ -5007,25 +5007,25 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5007 RezScriptPacket rezScriptx = (RezScriptPacket)Pack; 5007 RezScriptPacket rezScriptx = (RezScriptPacket)Pack;
5008 5008
5009 handlerRezScript = OnRezScript; 5009 handlerRezScript = OnRezScript;
5010 InventoryItemBase item=new InventoryItemBase(); 5010 InventoryItemBase item=new InventoryItemBase();
5011 item.ID=rezScriptx.InventoryBlock.ItemID; 5011 item.ID=rezScriptx.InventoryBlock.ItemID;
5012 item.Folder=rezScriptx.InventoryBlock.FolderID; 5012 item.Folder=rezScriptx.InventoryBlock.FolderID;
5013 item.Creator=rezScriptx.InventoryBlock.CreatorID; 5013 item.Creator=rezScriptx.InventoryBlock.CreatorID;
5014 item.Owner=rezScriptx.InventoryBlock.OwnerID; 5014 item.Owner=rezScriptx.InventoryBlock.OwnerID;
5015 item.BasePermissions=rezScriptx.InventoryBlock.BaseMask; 5015 item.BasePermissions=rezScriptx.InventoryBlock.BaseMask;
5016 item.CurrentPermissions=rezScriptx.InventoryBlock.OwnerMask; 5016 item.CurrentPermissions=rezScriptx.InventoryBlock.OwnerMask;
5017 item.EveryOnePermissions=rezScriptx.InventoryBlock.EveryoneMask; 5017 item.EveryOnePermissions=rezScriptx.InventoryBlock.EveryoneMask;
5018 item.NextPermissions=rezScriptx.InventoryBlock.NextOwnerMask; 5018 item.NextPermissions=rezScriptx.InventoryBlock.NextOwnerMask;
5019 item.GroupOwned=rezScriptx.InventoryBlock.GroupOwned; 5019 item.GroupOwned=rezScriptx.InventoryBlock.GroupOwned;
5020 item.GroupID=rezScriptx.InventoryBlock.GroupID; 5020 item.GroupID=rezScriptx.InventoryBlock.GroupID;
5021 item.AssetType=rezScriptx.InventoryBlock.Type; 5021 item.AssetType=rezScriptx.InventoryBlock.Type;
5022 item.InvType=rezScriptx.InventoryBlock.InvType; 5022 item.InvType=rezScriptx.InventoryBlock.InvType;
5023 item.Flags=rezScriptx.InventoryBlock.Flags; 5023 item.Flags=rezScriptx.InventoryBlock.Flags;
5024 item.SaleType=rezScriptx.InventoryBlock.SaleType; 5024 item.SaleType=rezScriptx.InventoryBlock.SaleType;
5025 item.SalePrice=rezScriptx.InventoryBlock.SalePrice; 5025 item.SalePrice=rezScriptx.InventoryBlock.SalePrice;
5026 item.Name=Util.FieldToString(rezScriptx.InventoryBlock.Name); 5026 item.Name=Util.FieldToString(rezScriptx.InventoryBlock.Name);
5027 item.Description=Util.FieldToString(rezScriptx.InventoryBlock.Description); 5027 item.Description=Util.FieldToString(rezScriptx.InventoryBlock.Description);
5028 item.CreationDate=(int)rezScriptx.InventoryBlock.CreationDate; 5028 item.CreationDate=(int)rezScriptx.InventoryBlock.CreationDate;
5029 5029
5030 if (handlerRezScript != null) 5030 if (handlerRezScript != null)
5031 { 5031 {
diff --git a/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs b/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs
index b0ae6b2..a1ef67f 100644
--- a/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs
+++ b/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs
@@ -89,7 +89,7 @@ namespace OpenSim.Region.Communications.OGS1
89 89
90 public AvatarAppearance ConvertXMLRPCDataToAvatarAppearance(Hashtable data) 90 public AvatarAppearance ConvertXMLRPCDataToAvatarAppearance(Hashtable data)
91 { 91 {
92 if (data != null) 92 if (data != null)
93 { 93 {
94 if (data.Contains("error_type")) 94 if (data.Contains("error_type"))
95 { 95 {
@@ -587,7 +587,7 @@ namespace OpenSim.Region.Communications.OGS1
587 XmlRpcRequest req = new XmlRpcRequest("get_avatar_appearance", parameters); 587 XmlRpcRequest req = new XmlRpcRequest("get_avatar_appearance", parameters);
588 XmlRpcResponse resp = req.Send(m_parent.NetworkServersInfo.UserURL, 8000); 588 XmlRpcResponse resp = req.Send(m_parent.NetworkServersInfo.UserURL, 8000);
589 Hashtable respData = (Hashtable) resp.Value; 589 Hashtable respData = (Hashtable) resp.Value;
590 590
591 return ConvertXMLRPCDataToAvatarAppearance(respData); 591 return ConvertXMLRPCDataToAvatarAppearance(respData);
592 } 592 }
593 catch (WebException e) 593 catch (WebException e)
@@ -611,7 +611,7 @@ namespace OpenSim.Region.Communications.OGS1
611 XmlRpcRequest req = new XmlRpcRequest("update_avatar_appearance", parameters); 611 XmlRpcRequest req = new XmlRpcRequest("update_avatar_appearance", parameters);
612 XmlRpcResponse resp = req.Send(m_parent.NetworkServersInfo.UserURL, 8000); 612 XmlRpcResponse resp = req.Send(m_parent.NetworkServersInfo.UserURL, 8000);
613 Hashtable respData = (Hashtable) resp.Value; 613 Hashtable respData = (Hashtable) resp.Value;
614 614
615 if (respData != null) 615 if (respData != null)
616 { 616 {
617 if (respData.Contains("returnString")) 617 if (respData.Contains("returnString"))
diff --git a/OpenSim/Region/Environment/Modules/Agent/AssetTransaction/AgentAssetsTransactions.cs b/OpenSim/Region/Environment/Modules/Agent/AssetTransaction/AgentAssetsTransactions.cs
index b401cdb..81e19e6 100644
--- a/OpenSim/Region/Environment/Modules/Agent/AssetTransaction/AgentAssetsTransactions.cs
+++ b/OpenSim/Region/Environment/Modules/Agent/AssetTransaction/AgentAssetsTransactions.cs
@@ -381,7 +381,7 @@ namespace OpenSim.Region.Environment.Modules.Agent.AssetTransaction
381 item.Folder = InventFolder; 381 item.Folder = InventFolder;
382 item.BasePermissions = 0x7fffffff; 382 item.BasePermissions = 0x7fffffff;
383 item.CurrentPermissions = 0x7fffffff; 383 item.CurrentPermissions = 0x7fffffff;
384 item.EveryOnePermissions=0; 384 item.EveryOnePermissions=0;
385 item.NextPermissions = nextPerm; 385 item.NextPermissions = nextPerm;
386 item.Flags = (uint) wearableType; 386 item.Flags = (uint) wearableType;
387 387
diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
index 0447631..88f0cb4 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
@@ -951,7 +951,7 @@ namespace OpenSim.Region.Environment.Scenes
951 /// <param name="localID"></param> 951 /// <param name="localID"></param>
952 public void RezScript(IClientAPI remoteClient, InventoryItemBase itemBase, LLUUID transactionID, uint localID) 952 public void RezScript(IClientAPI remoteClient, InventoryItemBase itemBase, LLUUID transactionID, uint localID)
953 { 953 {
954 LLUUID itemID=itemBase.ID; 954 LLUUID itemID=itemBase.ID;
955 LLUUID copyID = LLUUID.Random(); 955 LLUUID copyID = LLUUID.Random();
956 956
957 if (itemID != LLUUID.Zero) 957 if (itemID != LLUUID.Zero)
@@ -1001,38 +1001,38 @@ namespace OpenSim.Region.Environment.Scenes
1001 } 1001 }
1002 else // If the itemID is zero then the script has been rezzed directly in an object's inventory 1002 else // If the itemID is zero then the script has been rezzed directly in an object's inventory
1003 { 1003 {
1004 SceneObjectPart part=GetSceneObjectPart(itemBase.Folder); 1004 SceneObjectPart part=GetSceneObjectPart(itemBase.Folder);
1005 if(part == null) 1005 if (part == null)
1006 return; 1006 return;
1007 1007
1008 AssetBase asset = CreateAsset(itemBase.Name, itemBase.Description, (sbyte)itemBase.InvType, (sbyte)itemBase.AssetType, Encoding.ASCII.GetBytes("default\n{\n state_entry()\n {\n llSay(0, \"Script running\");\n }\n}")); 1008 AssetBase asset = CreateAsset(itemBase.Name, itemBase.Description, (sbyte)itemBase.InvType, (sbyte)itemBase.AssetType, Encoding.ASCII.GetBytes("default\n{\n state_entry()\n {\n llSay(0, \"Script running\");\n }\n}"));
1009 AssetCache.AddAsset(asset); 1009 AssetCache.AddAsset(asset);
1010 1010
1011 TaskInventoryItem taskItem=new TaskInventoryItem(); 1011 TaskInventoryItem taskItem=new TaskInventoryItem();
1012 1012
1013 taskItem.ResetIDs(itemBase.Folder); 1013 taskItem.ResetIDs(itemBase.Folder);
1014 taskItem.ParentID = itemBase.Folder; 1014 taskItem.ParentID = itemBase.Folder;
1015 taskItem.CreationDate = (uint)itemBase.CreationDate; 1015 taskItem.CreationDate = (uint)itemBase.CreationDate;
1016 taskItem.Name = itemBase.Name; 1016 taskItem.Name = itemBase.Name;
1017 taskItem.Description = itemBase.Description; 1017 taskItem.Description = itemBase.Description;
1018 taskItem.Type = itemBase.AssetType; 1018 taskItem.Type = itemBase.AssetType;
1019 taskItem.InvType = itemBase.InvType; 1019 taskItem.InvType = itemBase.InvType;
1020 taskItem.OwnerID = itemBase.Owner; 1020 taskItem.OwnerID = itemBase.Owner;
1021 taskItem.CreatorID = itemBase.Creator; 1021 taskItem.CreatorID = itemBase.Creator;
1022 taskItem.BaseMask = itemBase.BasePermissions; 1022 taskItem.BaseMask = itemBase.BasePermissions;
1023 taskItem.OwnerMask = itemBase.CurrentPermissions; 1023 taskItem.OwnerMask = itemBase.CurrentPermissions;
1024 taskItem.EveryoneMask = itemBase.EveryOnePermissions; 1024 taskItem.EveryoneMask = itemBase.EveryOnePermissions;
1025 taskItem.NextOwnerMask = itemBase.NextPermissions; 1025 taskItem.NextOwnerMask = itemBase.NextPermissions;
1026 taskItem.GroupID = itemBase.GroupID; 1026 taskItem.GroupID = itemBase.GroupID;
1027 taskItem.GroupMask = 0; 1027 taskItem.GroupMask = 0;
1028 taskItem.Flags = itemBase.Flags; 1028 taskItem.Flags = itemBase.Flags;
1029 taskItem.PermsGranter = LLUUID.Zero; 1029 taskItem.PermsGranter = LLUUID.Zero;
1030 taskItem.PermsMask = 0; 1030 taskItem.PermsMask = 0;
1031 taskItem.AssetID = asset.ID; 1031 taskItem.AssetID = asset.ID;
1032 1032
1033 part.AddInventoryItem(taskItem); 1033 part.AddInventoryItem(taskItem);
1034 part.GetProperties(remoteClient); 1034 part.GetProperties(remoteClient);
1035 part.StartScript(taskItem); 1035 part.StartScript(taskItem);
1036 } 1036 }
1037 } 1037 }
1038 1038
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.Inventory.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.Inventory.cs
index b24e0de..c26ff51 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.Inventory.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.Inventory.cs
@@ -205,11 +205,11 @@ namespace OpenSim.Region.Environment.Scenes
205 // FIXME: ignoring group permissions for now as they aren't stored in item 205 // FIXME: ignoring group permissions for now as they aren't stored in item
206 taskItem.EveryoneMask = item.EveryOnePermissions; 206 taskItem.EveryoneMask = item.EveryOnePermissions;
207 taskItem.NextOwnerMask = item.NextPermissions; 207 taskItem.NextOwnerMask = item.NextPermissions;
208 taskItem.Flags = item.Flags; 208 taskItem.Flags = item.Flags;
209 // TODO: These are pending addition of those fields to TaskInventoryItem 209 // TODO: These are pending addition of those fields to TaskInventoryItem
210// taskItem.SalePrice = item.SalePrice; 210// taskItem.SalePrice = item.SalePrice;
211// taskItem.SaleType = item.SaleType; 211// taskItem.SaleType = item.SaleType;
212 taskItem.CreationDate = (uint)item.CreationDate; 212 taskItem.CreationDate = (uint)item.CreationDate;
213 213
214 part.AddInventoryItem(taskItem); 214 part.AddInventoryItem(taskItem);
215 215
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
index 7f26f35..635a989 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
@@ -1927,7 +1927,7 @@ namespace OpenSim.Region.Environment.Scenes
1927 /// <param name="client"></param> 1927 /// <param name="client"></param>
1928 public void GetProperties(IClientAPI client) 1928 public void GetProperties(IClientAPI client)
1929 { 1929 {
1930 m_rootPart.GetProperties(client); 1930 m_rootPart.GetProperties(client);
1931 } 1931 }
1932 1932
1933 /// <summary> 1933 /// <summary>
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs
index 0444685..a9dc9cf 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs
@@ -42,7 +42,7 @@ namespace OpenSim.Region.Environment.Scenes
42 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 42 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
43 43
44 private string m_inventoryFileName = String.Empty; 44 private string m_inventoryFileName = String.Empty;
45 private int m_inventoryFileNameSerial = 0; 45 private int m_inventoryFileNameSerial = 0;
46 46
47 /// <summary> 47 /// <summary>
48 /// Exposing this is not particularly good, but it's one of the least evils at the moment to see 48 /// Exposing this is not particularly good, but it's one of the least evils at the moment to see
@@ -445,16 +445,16 @@ namespace OpenSim.Region.Environment.Scenes
445 return -1; 445 return -1;
446 } 446 }
447 447
448 public string GetInventoryFileName() 448 public string GetInventoryFileName()
449 { 449 {
450 if(m_inventoryFileName == String.Empty) 450 if (m_inventoryFileName == String.Empty)
451 m_inventoryFileName = "inventory_" + LLUUID.Random().ToString() + ".tmp"; 451 m_inventoryFileName = "inventory_" + LLUUID.Random().ToString() + ".tmp";
452 if(m_inventoryFileNameSerial < m_inventorySerial) 452 if (m_inventoryFileNameSerial < m_inventorySerial)
453 { 453 {
454 m_inventoryFileName = "inventory_" + LLUUID.Random().ToString() + ".tmp"; 454 m_inventoryFileName = "inventory_" + LLUUID.Random().ToString() + ".tmp";
455 } 455 }
456 return m_inventoryFileName; 456 return m_inventoryFileName;
457 } 457 }
458 458
459 /// <summary> 459 /// <summary>
460 /// Return the name with which a client can request a xfer of this prim's inventory metadata 460 /// Return the name with which a client can request a xfer of this prim's inventory metadata
diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs
index 7eaab40..6977083 100644
--- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs
@@ -1451,15 +1451,15 @@ namespace OpenSim.Region.Environment.Scenes
1451 /// 1451 ///
1452 /// </summary> 1452 /// </summary>
1453 public void SendInitialData() 1453 public void SendInitialData()
1454 { 1454 {
1455 // justincc - very temporary fix for the fact that m_apperance appears to be null at this point in grid mode 1455 // justincc - very temporary fix for the fact that m_apperance appears to be null at this point in grid mode
1456 LLObject.TextureEntry texture = AvatarAppearance.GetDefaultTexture(); 1456 LLObject.TextureEntry texture = AvatarAppearance.GetDefaultTexture();
1457 if (null != m_appearance) 1457 if (null != m_appearance)
1458 texture = m_appearance.Texture; 1458 texture = m_appearance.Texture;
1459 1459
1460 m_controllingClient.SendAvatarData(m_regionInfo.RegionHandle, m_firstname, m_lastname, m_uuid, LocalId, 1460 m_controllingClient.SendAvatarData(m_regionInfo.RegionHandle, m_firstname, m_lastname, m_uuid, LocalId,
1461 m_pos, texture.ToBytes(), m_parentID); 1461 m_pos, texture.ToBytes(), m_parentID);
1462 1462
1463 if (!m_isChildAgent) 1463 if (!m_isChildAgent)
1464 { 1464 {
1465 m_scene.InformClientOfNeighbours(this); 1465 m_scene.InformClientOfNeighbours(this);
diff --git a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
index 1f9a6b6..1ba4bb1 100644
--- a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
+++ b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
@@ -69,8 +69,6 @@ namespace OpenSim.Region.Physics.OdePlugin
69 private float PID_G = 25f; 69 private float PID_G = 25f;
70 private float m_tensor = 5f; 70 private float m_tensor = 5f;
71 private int body_autodisable_frames = 20; 71 private int body_autodisable_frames = 20;
72
73
74 72
75 private bool m_usePID = false; 73 private bool m_usePID = false;
76 74
@@ -98,7 +96,6 @@ namespace OpenSim.Region.Physics.OdePlugin
98 public bool m_taintselected = false; 96 public bool m_taintselected = false;
99 public bool m_taintCollidesWater = false; 97 public bool m_taintCollidesWater = false;
100 98
101
102 public uint m_localID = 0; 99 public uint m_localID = 0;
103 100
104 //public GCHandle gc; 101 //public GCHandle gc;
@@ -148,11 +145,9 @@ namespace OpenSim.Region.Physics.OdePlugin
148 145
149 private IntPtr m_linkJoint = (IntPtr)0; 146 private IntPtr m_linkJoint = (IntPtr)0;
150 147
151
152 public OdePrim(String primName, OdeScene parent_scene, PhysicsVector pos, PhysicsVector size, 148 public OdePrim(String primName, OdeScene parent_scene, PhysicsVector pos, PhysicsVector size,
153 Quaternion rotation, IMesh mesh, PrimitiveBaseShape pbs, bool pisPhysical, CollisionLocker dode) 149 Quaternion rotation, IMesh mesh, PrimitiveBaseShape pbs, bool pisPhysical, CollisionLocker dode)
154 { 150 {
155
156 _target_velocity = new PhysicsVector(0, 0, 0); 151 _target_velocity = new PhysicsVector(0, 0, 0);
157 //gc = GCHandle.Alloc(prim_geom, GCHandleType.Pinned); 152 //gc = GCHandle.Alloc(prim_geom, GCHandleType.Pinned);
158 ode = dode; 153 ode = dode;
@@ -214,7 +209,6 @@ namespace OpenSim.Region.Physics.OdePlugin
214 m_taintadd = true; 209 m_taintadd = true;
215 _parent_scene.AddPhysicsActorTaint(this); 210 _parent_scene.AddPhysicsActorTaint(this);
216 // don't do .add() here; old geoms get recycled with the same hash 211 // don't do .add() here; old geoms get recycled with the same hash
217
218 } 212 }
219 213
220 public override int PhysicsActorType 214 public override int PhysicsActorType
@@ -256,11 +250,9 @@ namespace OpenSim.Region.Physics.OdePlugin
256 } 250 }
257 else 251 else
258 { 252 {
259
260 m_taintselected = value; 253 m_taintselected = value;
261 m_isSelected = value; 254 m_isSelected = value;
262 } 255 }
263
264 } 256 }
265 } 257 }
266 258
@@ -274,14 +266,12 @@ namespace OpenSim.Region.Physics.OdePlugin
274 d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags); 266 d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags);
275 } 267 }
276 //m_log.Warn("Setting Geom to: " + prim_geom); 268 //m_log.Warn("Setting Geom to: " + prim_geom);
277
278 } 269 }
279 270
280 public void enableBodySoft() 271 public void enableBodySoft()
281 { 272 {
282 if (m_isphysical) 273 if (m_isphysical && Body != (IntPtr)0)
283 if (Body != (IntPtr)0) 274 d.BodyEnable(Body);
284 d.BodyEnable(Body);
285 275
286 m_disabled = false; 276 m_disabled = false;
287 } 277 }
@@ -290,12 +280,10 @@ namespace OpenSim.Region.Physics.OdePlugin
290 { 280 {
291 m_disabled = true; 281 m_disabled = true;
292 282
293 if (m_isphysical) 283 if (m_isphysical && Body != (IntPtr)0)
294 if (Body != (IntPtr)0) 284 d.BodyDisable(Body);
295 d.BodyDisable(Body);
296 } 285 }
297 286
298
299 public void enableBody() 287 public void enableBody()
300 { 288 {
301 // Sets the geom to a body 289 // Sets the geom to a body
@@ -316,7 +304,6 @@ namespace OpenSim.Region.Physics.OdePlugin
316 d.GeomSetCategoryBits(prim_geom, (int)m_collisionCategories); 304 d.GeomSetCategoryBits(prim_geom, (int)m_collisionCategories);
317 d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags); 305 d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags);
318 306
319
320 d.BodySetAutoDisableFlag(Body, true); 307 d.BodySetAutoDisableFlag(Body, true);
321 d.BodySetAutoDisableSteps(Body, body_autodisable_frames); 308 d.BodySetAutoDisableSteps(Body, body_autodisable_frames);
322 309
@@ -342,7 +329,6 @@ namespace OpenSim.Region.Physics.OdePlugin
342 // No material is passed to the physics engines yet.. soo.. 329 // No material is passed to the physics engines yet.. soo..
343 // we're using the m_density constant in the class definition 330 // we're using the m_density constant in the class definition
344 331
345
346 float returnMass = 0; 332 float returnMass = 0;
347 333
348 switch (_pbs.ProfileShape) 334 switch (_pbs.ProfileShape)
@@ -439,7 +425,6 @@ namespace OpenSim.Region.Physics.OdePlugin
439 float hollowVolume = 0; 425 float hollowVolume = 0;
440 switch (_pbs.HollowShape) 426 switch (_pbs.HollowShape)
441 { 427 {
442
443 case HollowShape.Same: 428 case HollowShape.Same:
444 case HollowShape.Circle: 429 case HollowShape.Circle:
445 // Hollow shape is a perfect cyllinder in respect to the cube's scale 430 // Hollow shape is a perfect cyllinder in respect to the cube's scale
@@ -459,8 +444,6 @@ namespace OpenSim.Region.Physics.OdePlugin
459 hollowVolume = hollowsizex * hollowsizey * hollowsizez; 444 hollowVolume = hollowsizex * hollowsizey * hollowsizez;
460 break; 445 break;
461 446
462
463
464 case HollowShape.Triangle: 447 case HollowShape.Triangle:
465 // Equilateral Triangular Prism volume hollow calculation 448 // Equilateral Triangular Prism volume hollow calculation
466 // Triangle is an Equilateral Triangular Prism with aLength = to _size.Y 449 // Triangle is an Equilateral Triangular Prism with aLength = to _size.Y
@@ -493,7 +476,6 @@ namespace OpenSim.Region.Physics.OdePlugin
493 // we treat this as a box currently 476 // we treat this as a box currently
494 volume = _size.X * _size.Y * _size.Z; 477 volume = _size.X * _size.Y * _size.Z;
495 } 478 }
496
497 } 479 }
498 else 480 else
499 { 481 {
@@ -501,6 +483,7 @@ namespace OpenSim.Region.Physics.OdePlugin
501 volume = _size.X * _size.Y * _size.Z; 483 volume = _size.X * _size.Y * _size.Z;
502 } 484 }
503 break; 485 break;
486
504 case ProfileShape.EquilateralTriangle: 487 case ProfileShape.EquilateralTriangle:
505 /* 488 /*
506 v = (abs((xB*yA-xA*yB)+(xC*yB-xB*yC)+(xA*yC-xC*yA))/2) * h 489 v = (abs((xB*yA-xA*yB)+(xC*yB-xB*yC)+(xA*yC-xC*yA))/2) * h
@@ -533,7 +516,6 @@ namespace OpenSim.Region.Physics.OdePlugin
533 float hollowVolume = 0; 516 float hollowVolume = 0;
534 switch (_pbs.HollowShape) 517 switch (_pbs.HollowShape)
535 { 518 {
536
537 case HollowShape.Same: 519 case HollowShape.Same:
538 case HollowShape.Triangle: 520 case HollowShape.Triangle:
539 // Equilateral Triangular Prism volume hollow calculation 521 // Equilateral Triangular Prism volume hollow calculation
@@ -562,7 +544,6 @@ namespace OpenSim.Region.Physics.OdePlugin
562 hollowVolume = ((float)((Math.PI * Math.Pow(hRadius, 2) * hLength)/2) * hollowAmount); 544 hollowVolume = ((float)((Math.PI * Math.Pow(hRadius, 2) * hLength)/2) * hollowAmount);
563 break; 545 break;
564 546
565
566 default: 547 default:
567 hollowVolume = 0; 548 hollowVolume = 0;
568 break; 549 break;
@@ -642,7 +623,6 @@ namespace OpenSim.Region.Physics.OdePlugin
642 623
643 #endregion 624 #endregion
644 625
645
646 public void setMass() 626 public void setMass()
647 { 627 {
648 if (Body != (IntPtr) 0) 628 if (Body != (IntPtr) 0)
@@ -656,7 +636,6 @@ namespace OpenSim.Region.Physics.OdePlugin
656 } 636 }
657 } 637 }
658 638
659
660 public void disableBody() 639 public void disableBody()
661 { 640 {
662 //this kills the body so things like 'mesh' can re-create it. 641 //this kills the body so things like 'mesh' can re-create it.
@@ -689,7 +668,6 @@ namespace OpenSim.Region.Physics.OdePlugin
689 668
690 Thread.Sleep(10); 669 Thread.Sleep(10);
691 670
692
693 //Kill Body so that mesh can re-make the geom 671 //Kill Body so that mesh can re-make the geom
694 if (IsPhysical && Body != (IntPtr) 0) 672 if (IsPhysical && Body != (IntPtr) 0)
695 { 673 {
@@ -707,7 +685,6 @@ namespace OpenSim.Region.Physics.OdePlugin
707 3*sizeof (int)); 685 3*sizeof (int));
708 d.GeomTriMeshDataPreprocess(_triMeshData); 686 d.GeomTriMeshDataPreprocess(_triMeshData);
709 687
710
711 _parent_scene.waitForSpaceUnlock(m_targetSpace); 688 _parent_scene.waitForSpaceUnlock(m_targetSpace);
712 689
713 try 690 try
@@ -719,7 +696,6 @@ namespace OpenSim.Region.Physics.OdePlugin
719 } 696 }
720 catch (AccessViolationException) 697 catch (AccessViolationException)
721 { 698 {
722
723 m_log.Error("[PHYSICS]: MESH LOCKED"); 699 m_log.Error("[PHYSICS]: MESH LOCKED");
724 return; 700 return;
725 } 701 }
@@ -730,14 +706,11 @@ namespace OpenSim.Region.Physics.OdePlugin
730 m_collisionscore = 0; 706 m_collisionscore = 0;
731 707
732 enableBody(); 708 enableBody();
733
734 } 709 }
735 } 710 }
736 711
737 public void ProcessTaints(float timestep) 712 public void ProcessTaints(float timestep)
738 { 713 {
739
740
741 if (m_taintadd) 714 if (m_taintadd)
742 { 715 {
743 changeadd(timestep); 716 changeadd(timestep);
@@ -783,7 +756,6 @@ namespace OpenSim.Region.Physics.OdePlugin
783 756
784 if (!m_angularlock.IsIdentical(m_taintAngularLock,0)) 757 if (!m_angularlock.IsIdentical(m_taintAngularLock,0))
785 changeAngularLock(timestep); 758 changeAngularLock(timestep);
786
787 } 759 }
788 else 760 else
789 { 761 {
@@ -812,7 +784,7 @@ namespace OpenSim.Region.Physics.OdePlugin
812 { 784 {
813 d.JointDestroy(Amotor); 785 d.JointDestroy(Amotor);
814 Amotor = (IntPtr)0; 786 Amotor = (IntPtr)0;
815 } 787 }
816 } 788 }
817 } 789 }
818 } 790 }
@@ -822,7 +794,6 @@ namespace OpenSim.Region.Physics.OdePlugin
822 794
823 private void changelink(float timestep) 795 private void changelink(float timestep)
824 { 796 {
825
826 if (_parent == null && m_taintparent != null) 797 if (_parent == null && m_taintparent != null)
827 { 798 {
828 if (m_taintparent.PhysicsActorType == (int)ActorTypes.Prim) 799 if (m_taintparent.PhysicsActorType == (int)ActorTypes.Prim)
@@ -836,7 +807,6 @@ namespace OpenSim.Region.Physics.OdePlugin
836 d.JointSetFixed(m_linkJoint); 807 d.JointSetFixed(m_linkJoint);
837 } 808 }
838 } 809 }
839
840 } 810 }
841 else if (_parent != null && m_taintparent == null) 811 else if (_parent != null && m_taintparent == null)
842 { 812 {
@@ -845,20 +815,15 @@ namespace OpenSim.Region.Physics.OdePlugin
845 815
846 _linkJointGroup = (IntPtr)0; 816 _linkJointGroup = (IntPtr)0;
847 m_linkJoint = (IntPtr)0; 817 m_linkJoint = (IntPtr)0;
848
849 } 818 }
850 819
851
852 _parent = m_taintparent; 820 _parent = m_taintparent;
853 } 821 }
854 822
855 private void changeSelectedStatus(float timestep) 823 private void changeSelectedStatus(float timestep)
856 { 824 {
857
858 if (m_taintselected) 825 if (m_taintselected)
859 { 826 {
860
861
862 m_collisionCategories = CollisionCategories.Selected; 827 m_collisionCategories = CollisionCategories.Selected;
863 m_collisionFlags = (CollisionCategories.Sensor | CollisionCategories.Space); 828 m_collisionFlags = (CollisionCategories.Sensor | CollisionCategories.Space);
864 829
@@ -882,17 +847,14 @@ namespace OpenSim.Region.Physics.OdePlugin
882 { 847 {
883 disableBodySoft(); 848 disableBodySoft();
884 } 849 }
885
886 } 850 }
887 else 851 else
888 { 852 {
889
890 m_collisionCategories = CollisionCategories.Geom; 853 m_collisionCategories = CollisionCategories.Geom;
891 854
892 if (m_isphysical) 855 if (m_isphysical)
893 m_collisionCategories |= CollisionCategories.Body; 856 m_collisionCategories |= CollisionCategories.Body;
894 857
895
896 m_collisionFlags = m_default_collisionFlags; 858 m_collisionFlags = m_default_collisionFlags;
897 859
898 if (m_collidesLand) 860 if (m_collidesLand)
@@ -910,42 +872,27 @@ namespace OpenSim.Region.Physics.OdePlugin
910 d.BodySetLinearVel(Body, 0f, 0f, 0f); 872 d.BodySetLinearVel(Body, 0f, 0f, 0f);
911 enableBodySoft(); 873 enableBodySoft();
912 } 874 }
913
914
915 } 875 }
916 876
917
918 resetCollisionAccounting(); 877 resetCollisionAccounting();
919 m_isSelected = m_taintselected; 878 m_isSelected = m_taintselected;
920 } 879 }
921 880
922 public void ResetTaints() 881 public void ResetTaints()
923 { 882 {
924
925 m_taintposition = _position; 883 m_taintposition = _position;
926
927 m_taintrot = _orientation; 884 m_taintrot = _orientation;
928
929 m_taintPhysics = m_isphysical; 885 m_taintPhysics = m_isphysical;
930
931 m_taintselected = m_isSelected; 886 m_taintselected = m_isSelected;
932
933 m_taintsize = _size; 887 m_taintsize = _size;
934
935
936 m_taintshape = false; 888 m_taintshape = false;
937
938 m_taintforce = false; 889 m_taintforce = false;
939
940 m_taintdisable = false; 890 m_taintdisable = false;
941
942 m_taintVelocity = PhysicsVector.Zero; 891 m_taintVelocity = PhysicsVector.Zero;
943 } 892 }
893
944 public void changeadd(float timestep) 894 public void changeadd(float timestep)
945 { 895 {
946
947
948
949 int[] iprimspaceArrItem = _parent_scene.calculateSpaceArrayItemFromPos(_position); 896 int[] iprimspaceArrItem = _parent_scene.calculateSpaceArrayItemFromPos(_position);
950 IntPtr targetspace = _parent_scene.calculateSpaceForGeom(_position); 897 IntPtr targetspace = _parent_scene.calculateSpaceForGeom(_position);
951 898
@@ -954,12 +901,7 @@ namespace OpenSim.Region.Physics.OdePlugin
954 901
955 m_targetSpace = targetspace; 902 m_targetSpace = targetspace;
956 903
957 904 if (_mesh == null)
958
959 if (_mesh != null)
960 {
961 }
962 else
963 { 905 {
964 if (_parent_scene.needsMeshing(_pbs)) 906 if (_parent_scene.needsMeshing(_pbs))
965 { 907 {
@@ -983,8 +925,6 @@ namespace OpenSim.Region.Physics.OdePlugin
983 { 925 {
984 if (((_size.X / 2f) > 0f)) 926 if (((_size.X / 2f) > 0f))
985 { 927 {
986
987
988 _parent_scene.waitForSpaceUnlock(m_targetSpace); 928 _parent_scene.waitForSpaceUnlock(m_targetSpace);
989 try 929 try
990 { 930 {
@@ -1065,13 +1005,10 @@ namespace OpenSim.Region.Physics.OdePlugin
1065 d.GeomSetQuaternion(prim_geom, ref myrot); 1005 d.GeomSetQuaternion(prim_geom, ref myrot);
1066 } 1006 }
1067 1007
1068
1069 if (m_isphysical && Body == (IntPtr)0) 1008 if (m_isphysical && Body == (IntPtr)0)
1070 { 1009 {
1071 enableBody(); 1010 enableBody();
1072 } 1011 }
1073
1074
1075 } 1012 }
1076 1013
1077 _parent_scene.geom_name_map[prim_geom] = this.m_primName; 1014 _parent_scene.geom_name_map[prim_geom] = this.m_primName;
@@ -1080,14 +1017,10 @@ namespace OpenSim.Region.Physics.OdePlugin
1080 changeSelectedStatus(timestep); 1017 changeSelectedStatus(timestep);
1081 1018
1082 m_taintadd = false; 1019 m_taintadd = false;
1083
1084
1085 } 1020 }
1021
1086 public void changemove(float timestep) 1022 public void changemove(float timestep)
1087 { 1023 {
1088
1089
1090
1091 if (m_isphysical) 1024 if (m_isphysical)
1092 { 1025 {
1093 // This is a fallback.. May no longer be necessary. 1026 // This is a fallback.. May no longer be necessary.
@@ -1115,7 +1048,6 @@ namespace OpenSim.Region.Physics.OdePlugin
1115 } 1048 }
1116 } 1049 }
1117 d.BodyEnable(Body); 1050 d.BodyEnable(Body);
1118
1119 } 1051 }
1120 else 1052 else
1121 { 1053 {
@@ -1136,7 +1068,6 @@ namespace OpenSim.Region.Physics.OdePlugin
1136 } 1068 }
1137 } 1069 }
1138 1070
1139
1140 changeSelectedStatus(timestep); 1071 changeSelectedStatus(timestep);
1141 1072
1142 resetCollisionAccounting(); 1073 resetCollisionAccounting();
@@ -1151,21 +1082,15 @@ namespace OpenSim.Region.Physics.OdePlugin
1151 1082
1152 if (IsPhysical && Body != (IntPtr)0 && !m_isSelected) 1083 if (IsPhysical && Body != (IntPtr)0 && !m_isSelected)
1153 { 1084 {
1154
1155 //float PID_P = 900.0f; 1085 //float PID_P = 900.0f;
1156 1086
1157
1158 float m_mass = CalculateMass(); 1087 float m_mass = CalculateMass();
1159 1088
1160 fz = 0f; 1089 fz = 0f;
1161 //m_log.Info(m_collisionFlags.ToString()); 1090 //m_log.Info(m_collisionFlags.ToString());
1162 1091
1163
1164
1165
1166 if (m_buoyancy != 0) 1092 if (m_buoyancy != 0)
1167 { 1093 {
1168
1169 if (m_buoyancy > 0) 1094 if (m_buoyancy > 0)
1170 { 1095 {
1171 fz = (((-1 * _parent_scene.gravityz) * m_buoyancy) * m_mass); 1096 fz = (((-1 * _parent_scene.gravityz) * m_buoyancy) * m_mass);
@@ -1177,8 +1102,6 @@ namespace OpenSim.Region.Physics.OdePlugin
1177 { 1102 {
1178 fz = (-1 * (((-1 * _parent_scene.gravityz) * (-1 * m_buoyancy)) * m_mass)); 1103 fz = (-1 * (((-1 * _parent_scene.gravityz) * (-1 * m_buoyancy)) * m_mass));
1179 } 1104 }
1180
1181
1182 } 1105 }
1183 1106
1184 if (m_usePID) 1107 if (m_usePID)
@@ -1190,28 +1113,21 @@ namespace OpenSim.Region.Physics.OdePlugin
1190 1113
1191 // If the PID Controller isn't active then we set our force 1114 // If the PID Controller isn't active then we set our force
1192 // calculating base velocity to the current position 1115 // calculating base velocity to the current position
1193
1194
1195 1116
1196 if ((m_PIDTau < 1)) 1117 if ((m_PIDTau < 1))
1197 { 1118 {
1198 PID_G = PID_G / m_PIDTau; 1119 PID_G = PID_G / m_PIDTau;
1199 } 1120 }
1200 1121
1201
1202 if ((PID_G - m_PIDTau) <= 0) 1122 if ((PID_G - m_PIDTau) <= 0)
1203 { 1123 {
1204 PID_G = m_PIDTau + 1; 1124 PID_G = m_PIDTau + 1;
1205 } 1125 }
1206 //PidStatus = true; 1126 //PidStatus = true;
1207 1127
1208
1209
1210
1211 PhysicsVector vec = new PhysicsVector(); 1128 PhysicsVector vec = new PhysicsVector();
1212 d.Vector3 vel = d.BodyGetLinearVel(Body); 1129 d.Vector3 vel = d.BodyGetLinearVel(Body);
1213 1130
1214
1215 d.Vector3 pos = d.BodyGetPosition(Body); 1131 d.Vector3 pos = d.BodyGetPosition(Body);
1216 _target_velocity = 1132 _target_velocity =
1217 new PhysicsVector( 1133 new PhysicsVector(
@@ -1220,20 +1136,17 @@ namespace OpenSim.Region.Physics.OdePlugin
1220 (m_PIDTarget.Z - pos.Z) * ((PID_G - m_PIDTau) * timestep) 1136 (m_PIDTarget.Z - pos.Z) * ((PID_G - m_PIDTau) * timestep)
1221 ); 1137 );
1222 1138
1223
1224 // if velocity is zero, use position control; otherwise, velocity control 1139 // if velocity is zero, use position control; otherwise, velocity control
1225 1140
1226 if (_target_velocity.IsIdentical(PhysicsVector.Zero,0.1f)) 1141 if (_target_velocity.IsIdentical(PhysicsVector.Zero,0.1f))
1227 { 1142 {
1228 // keep track of where we stopped. No more slippin' & slidin' 1143 // keep track of where we stopped. No more slippin' & slidin'
1229 1144
1230
1231 // We only want to deactivate the PID Controller if we think we want to have our surrogate 1145 // We only want to deactivate the PID Controller if we think we want to have our surrogate
1232 // react to the physics scene by moving it's position. 1146 // react to the physics scene by moving it's position.
1233 // Avatar to Avatar collisions 1147 // Avatar to Avatar collisions
1234 // Prim to avatar collisions 1148 // Prim to avatar collisions
1235 1149
1236
1237 //fx = (_target_velocity.X - vel.X) * (PID_D) + (_zeroPosition.X - pos.X) * (PID_P * 2); 1150 //fx = (_target_velocity.X - vel.X) * (PID_D) + (_zeroPosition.X - pos.X) * (PID_P * 2);
1238 //fy = (_target_velocity.Y - vel.Y) * (PID_D) + (_zeroPosition.Y - pos.Y) * (PID_P * 2); 1151 //fy = (_target_velocity.Y - vel.Y) * (PID_D) + (_zeroPosition.Y - pos.Y) * (PID_P * 2);
1239 //fz = fz + (_target_velocity.Z - vel.Z) * (PID_D) + (_zeroPosition.Z - pos.Z) * PID_P; 1152 //fz = fz + (_target_velocity.Z - vel.Z) * (PID_D) + (_zeroPosition.Z - pos.Z) * PID_P;
@@ -1241,25 +1154,19 @@ namespace OpenSim.Region.Physics.OdePlugin
1241 d.BodySetLinearVel(Body, 0, 0, 0); 1154 d.BodySetLinearVel(Body, 0, 0, 0);
1242 d.BodyAddForce(Body, 0, 0, fz); 1155 d.BodyAddForce(Body, 0, 0, fz);
1243 return; 1156 return;
1244
1245 } 1157 }
1246 else 1158 else
1247 { 1159 {
1248
1249 _zeroFlag = false; 1160 _zeroFlag = false;
1250 1161
1251 // We're flying and colliding with something 1162 // We're flying and colliding with something
1252 fx = ((_target_velocity.X) - vel.X) * (PID_D); 1163 fx = ((_target_velocity.X) - vel.X) * (PID_D);
1253 fy = ((_target_velocity.Y) - vel.Y) * (PID_D); 1164 fy = ((_target_velocity.Y) - vel.Y) * (PID_D);
1254 1165
1255 1166 // vec.Z = (_target_velocity.Z - vel.Z) * PID_D + (_zeroPosition.Z - pos.Z) * PID_P;
1256
1257
1258 // vec.Z = (_target_velocity.Z - vel.Z) * PID_D + (_zeroPosition.Z - pos.Z) * PID_P;
1259 1167
1260 fz = fz + ((_target_velocity.Z - vel.Z) * (PID_D) * m_mass); 1168 fz = fz + ((_target_velocity.Z - vel.Z) * (PID_D) * m_mass);
1261 } 1169 }
1262
1263 } 1170 }
1264 1171
1265 fx *= m_mass; 1172 fx *= m_mass;
@@ -1285,8 +1192,6 @@ namespace OpenSim.Region.Physics.OdePlugin
1285 1192
1286 public void rotate(float timestep) 1193 public void rotate(float timestep)
1287 { 1194 {
1288
1289
1290 d.Quaternion myrot = new d.Quaternion(); 1195 d.Quaternion myrot = new d.Quaternion();
1291 myrot.W = _orientation.w; 1196 myrot.W = _orientation.w;
1292 myrot.X = _orientation.x; 1197 myrot.X = _orientation.x;
@@ -1313,7 +1218,6 @@ namespace OpenSim.Region.Physics.OdePlugin
1313 1218
1314 public void changedisable(float timestep) 1219 public void changedisable(float timestep)
1315 { 1220 {
1316
1317 m_disabled = true; 1221 m_disabled = true;
1318 if (Body != (IntPtr)0) 1222 if (Body != (IntPtr)0)
1319 { 1223 {
@@ -1321,14 +1225,11 @@ namespace OpenSim.Region.Physics.OdePlugin
1321 Body = (IntPtr)0; 1225 Body = (IntPtr)0;
1322 } 1226 }
1323 1227
1324
1325 m_taintdisable = false; 1228 m_taintdisable = false;
1326 } 1229 }
1327 1230
1328 public void changePhysicsStatus(float timestep) 1231 public void changePhysicsStatus(float timestep)
1329 { 1232 {
1330
1331
1332 if (m_isphysical == true) 1233 if (m_isphysical == true)
1333 { 1234 {
1334 if (Body == (IntPtr)0) 1235 if (Body == (IntPtr)0)
@@ -1366,7 +1267,6 @@ namespace OpenSim.Region.Physics.OdePlugin
1366 1267
1367 public void changesize(float timestamp) 1268 public void changesize(float timestamp)
1368 { 1269 {
1369
1370 //if (!_parent_scene.geom_name_map.ContainsKey(prim_geom)) 1270 //if (!_parent_scene.geom_name_map.ContainsKey(prim_geom))
1371 //{ 1271 //{
1372 // m_taintsize = _size; 1272 // m_taintsize = _size;
@@ -1418,7 +1318,6 @@ namespace OpenSim.Region.Physics.OdePlugin
1418 myrot.Z = _orientation.z; 1318 myrot.Z = _orientation.z;
1419 d.GeomSetQuaternion(prim_geom, ref myrot); 1319 d.GeomSetQuaternion(prim_geom, ref myrot);
1420 1320
1421
1422 //d.GeomBoxSetLengths(prim_geom, _size.X, _size.Y, _size.Z); 1321 //d.GeomBoxSetLengths(prim_geom, _size.X, _size.Y, _size.Z);
1423 if (IsPhysical && Body == (IntPtr)0) 1322 if (IsPhysical && Body == (IntPtr)0)
1424 { 1323 {
@@ -1520,7 +1419,6 @@ namespace OpenSim.Region.Physics.OdePlugin
1520 myrot.Z = _orientation.z; 1419 myrot.Z = _orientation.z;
1521 d.GeomSetQuaternion(prim_geom, ref myrot); 1420 d.GeomSetQuaternion(prim_geom, ref myrot);
1522 1421
1523
1524 //d.GeomBoxSetLengths(prim_geom, _size.X, _size.Y, _size.Z); 1422 //d.GeomBoxSetLengths(prim_geom, _size.X, _size.Y, _size.Z);
1525 if (IsPhysical && Body == (IntPtr) 0) 1423 if (IsPhysical && Body == (IntPtr) 0)
1526 { 1424 {
@@ -1559,7 +1457,6 @@ namespace OpenSim.Region.Physics.OdePlugin
1559 1457
1560 public void changeshape(float timestamp) 1458 public void changeshape(float timestamp)
1561 { 1459 {
1562
1563 string oldname = _parent_scene.geom_name_map[prim_geom]; 1460 string oldname = _parent_scene.geom_name_map[prim_geom];
1564 1461
1565 // Cleanup of old prim geometry and Bodies 1462 // Cleanup of old prim geometry and Bodies
@@ -1574,7 +1471,7 @@ namespace OpenSim.Region.Physics.OdePlugin
1574 if (_size.Y <= 0) _size.Y = 0.01f; 1471 if (_size.Y <= 0) _size.Y = 0.01f;
1575 if (_size.Z <= 0) _size.Z = 0.01f; 1472 if (_size.Z <= 0) _size.Z = 0.01f;
1576 // Construction of new prim 1473 // Construction of new prim
1577 1474
1578 if (_parent_scene.needsMeshing(_pbs)) 1475 if (_parent_scene.needsMeshing(_pbs))
1579 { 1476 {
1580 // Don't need to re-enable body.. it's done in SetMesh 1477 // Don't need to re-enable body.. it's done in SetMesh
@@ -1596,14 +1493,12 @@ namespace OpenSim.Region.Physics.OdePlugin
1596 myrot.Z = _orientation.z; 1493 myrot.Z = _orientation.z;
1597 d.GeomSetQuaternion(prim_geom, ref myrot); 1494 d.GeomSetQuaternion(prim_geom, ref myrot);
1598 1495
1599
1600 //d.GeomBoxSetLengths(prim_geom, _size.X, _size.Y, _size.Z); 1496 //d.GeomBoxSetLengths(prim_geom, _size.X, _size.Y, _size.Z);
1601 if (IsPhysical && Body == (IntPtr)0) 1497 if (IsPhysical && Body == (IntPtr)0)
1602 { 1498 {
1603 // Re creates body on size. 1499 // Re creates body on size.
1604 // EnableBody also does setMass() 1500 // EnableBody also does setMass()
1605 enableBody(); 1501 enableBody();
1606
1607 } 1502 }
1608 } 1503 }
1609 else 1504 else
@@ -1623,7 +1518,6 @@ namespace OpenSim.Region.Physics.OdePlugin
1623 _parent_scene.waitForSpaceUnlock(m_targetSpace); 1518 _parent_scene.waitForSpaceUnlock(m_targetSpace);
1624 SetGeom(d.CreateBox(m_targetSpace, _size.X, _size.Y, _size.Z)); 1519 SetGeom(d.CreateBox(m_targetSpace, _size.X, _size.Y, _size.Z));
1625 } 1520 }
1626
1627 } 1521 }
1628 else 1522 else
1629 { 1523 {
@@ -1698,7 +1592,6 @@ namespace OpenSim.Region.Physics.OdePlugin
1698 myrot.Z = _orientation.z; 1592 myrot.Z = _orientation.z;
1699 d.GeomSetQuaternion(prim_geom, ref myrot); 1593 d.GeomSetQuaternion(prim_geom, ref myrot);
1700 1594
1701
1702 //d.GeomBoxSetLengths(prim_geom, _size.X, _size.Y, _size.Z); 1595 //d.GeomBoxSetLengths(prim_geom, _size.X, _size.Y, _size.Z);
1703 if (IsPhysical && Body == (IntPtr)0) 1596 if (IsPhysical && Body == (IntPtr)0)
1704 { 1597 {
@@ -1709,7 +1602,6 @@ namespace OpenSim.Region.Physics.OdePlugin
1709 } 1602 }
1710 } 1603 }
1711 1604
1712
1713 _parent_scene.geom_name_map[prim_geom] = oldname; 1605 _parent_scene.geom_name_map[prim_geom] = oldname;
1714 1606
1715 changeSelectedStatus(timestamp); 1607 changeSelectedStatus(timestamp);
@@ -1722,9 +1614,6 @@ namespace OpenSim.Region.Physics.OdePlugin
1722 { 1614 {
1723 if (!m_isSelected) 1615 if (!m_isSelected)
1724 { 1616 {
1725
1726
1727
1728 lock (m_forcelist) 1617 lock (m_forcelist)
1729 { 1618 {
1730 //m_log.Info("[PHYSICS]: dequeing forcelist"); 1619 //m_log.Info("[PHYSICS]: dequeing forcelist");
@@ -1741,19 +1630,17 @@ namespace OpenSim.Region.Physics.OdePlugin
1741 m_forcelist.Clear(); 1630 m_forcelist.Clear();
1742 } 1631 }
1743 1632
1744
1745 m_collisionscore = 0; 1633 m_collisionscore = 0;
1746 m_interpenetrationcount = 0; 1634 m_interpenetrationcount = 0;
1747 } 1635 }
1748 m_taintforce = false; 1636 m_taintforce = false;
1749 1637
1750 } 1638 }
1639
1751 private void changevelocity(float timestep) 1640 private void changevelocity(float timestep)
1752 { 1641 {
1753 if (!m_isSelected) 1642 if (!m_isSelected)
1754 { 1643 {
1755
1756
1757 Thread.Sleep(20); 1644 Thread.Sleep(20);
1758 if (IsPhysical) 1645 if (IsPhysical)
1759 { 1646 {
@@ -1767,6 +1654,7 @@ namespace OpenSim.Region.Physics.OdePlugin
1767 } 1654 }
1768 m_taintVelocity = PhysicsVector.Zero; 1655 m_taintVelocity = PhysicsVector.Zero;
1769 } 1656 }
1657
1770 public override bool IsPhysical 1658 public override bool IsPhysical
1771 { 1659 {
1772 get { return m_isphysical; } 1660 get { return m_isphysical; }
@@ -1974,10 +1862,7 @@ namespace OpenSim.Region.Physics.OdePlugin
1974 public void UpdatePositionAndVelocity() 1862 public void UpdatePositionAndVelocity()
1975 { 1863 {
1976 // no lock; called from Simulate() -- if you call this from elsewhere, gotta lock or do Monitor.Enter/Exit! 1864 // no lock; called from Simulate() -- if you call this from elsewhere, gotta lock or do Monitor.Enter/Exit!
1977 if (_parent != null) 1865 if (_parent == null)
1978 {
1979 }
1980 else
1981 { 1866 {
1982 PhysicsVector pv = new PhysicsVector(0, 0, 0); 1867 PhysicsVector pv = new PhysicsVector(0, 0, 0);
1983 bool lastZeroFlag = _zeroFlag; 1868 bool lastZeroFlag = _zeroFlag;
@@ -2173,6 +2058,7 @@ namespace OpenSim.Region.Physics.OdePlugin
2173 public override void SetMomentum(PhysicsVector momentum) 2058 public override void SetMomentum(PhysicsVector momentum)
2174 { 2059 {
2175 } 2060 }
2061
2176 public override PhysicsVector PIDTarget { set { m_PIDTarget = value; ; } } 2062 public override PhysicsVector PIDTarget { set { m_PIDTarget = value; ; } }
2177 public override bool PIDActive { set { m_usePID = value; } } 2063 public override bool PIDActive { set { m_usePID = value; } }
2178 public override float PIDTau { set { m_PIDTau = value; } } 2064 public override float PIDTau { set { m_PIDTau = value; } }
@@ -2188,8 +2074,6 @@ namespace OpenSim.Region.Physics.OdePlugin
2188 Amotor = IntPtr.Zero; 2074 Amotor = IntPtr.Zero;
2189 } 2075 }
2190 2076
2191
2192
2193 float axisnum = 3; 2077 float axisnum = 3;
2194 2078
2195 axisnum = (axisnum - (axis.X + axis.Y + axis.Z)); 2079 axisnum = (axisnum - (axis.X + axis.Y + axis.Z));
@@ -2217,17 +2101,17 @@ namespace OpenSim.Region.Physics.OdePlugin
2217 i++; 2101 i++;
2218 } 2102 }
2219 2103
2220
2221 if (axis.Z == 0) 2104 if (axis.Z == 0)
2222 { 2105 {
2223 d.JointSetAMotorAxis(Amotor, i, 0, 0, 0, 1); 2106 d.JointSetAMotorAxis(Amotor, i, 0, 0, 0, 1);
2224 i++; 2107 i++;
2225 } 2108 }
2109
2226 for (int j = 0; j < (int)axisnum; j++) 2110 for (int j = 0; j < (int)axisnum; j++)
2227 { 2111 {
2228 //d.JointSetAMotorAngle(Amotor, j, 0); 2112 //d.JointSetAMotorAngle(Amotor, j, 0);
2229 } 2113 }
2230 // 2114
2231 //d.JointSetAMotorAngle(Amotor, 1, 0); 2115 //d.JointSetAMotorAngle(Amotor, 1, 0);
2232 //d.JointSetAMotorAngle(Amotor, 2, 0); 2116 //d.JointSetAMotorAngle(Amotor, 2, 0);
2233 2117
@@ -2242,16 +2126,19 @@ namespace OpenSim.Region.Physics.OdePlugin
2242 d.JointSetAMotorParam(Amotor, (int)dParam.FudgeFactor, 0f); 2126 d.JointSetAMotorParam(Amotor, (int)dParam.FudgeFactor, 0f);
2243 d.JointSetAMotorParam(Amotor, (int)dParam.FMax, m_tensor); 2127 d.JointSetAMotorParam(Amotor, (int)dParam.FMax, m_tensor);
2244 } 2128 }
2129
2245 public override void SubscribeEvents(int ms) 2130 public override void SubscribeEvents(int ms)
2246 { 2131 {
2247 m_eventsubscription = ms; 2132 m_eventsubscription = ms;
2248 _parent_scene.addCollisionEventReporting(this); 2133 _parent_scene.addCollisionEventReporting(this);
2249 } 2134 }
2135
2250 public override void UnSubscribeEvents() 2136 public override void UnSubscribeEvents()
2251 { 2137 {
2252 _parent_scene.remCollisionEventReporting(this); 2138 _parent_scene.remCollisionEventReporting(this);
2253 m_eventsubscription = 0; 2139 m_eventsubscription = 0;
2254 } 2140 }
2141
2255 public void AddCollisionEvent(uint CollidedWith, float depth) 2142 public void AddCollisionEvent(uint CollidedWith, float depth)
2256 { 2143 {
2257 if (CollisionEventsThisFrame == null) 2144 if (CollisionEventsThisFrame == null)
@@ -2273,6 +2160,7 @@ namespace OpenSim.Region.Physics.OdePlugin
2273 CollisionEventsThisFrame = new CollisionEventUpdate(); 2160 CollisionEventsThisFrame = new CollisionEventUpdate();
2274 } 2161 }
2275 } 2162 }
2163
2276 public override bool SubscribedEvents() 2164 public override bool SubscribedEvents()
2277 { 2165 {
2278 if (m_eventsubscription > 0) 2166 if (m_eventsubscription > 0)