aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorMelanie2013-02-06 08:03:04 +0000
committerMelanie2013-02-06 08:03:04 +0000
commite5beb480eaf23fa7454728724de80b2a67ded1e8 (patch)
tree232bfd14074cc3730ab02bdefa339b99a587f1dc /OpenSim
parentminor: Add explanation of MaptileStaticUUID setting in Regions.ini.example (diff)
downloadopensim-SC_OLD-e5beb480eaf23fa7454728724de80b2a67ded1e8.zip
opensim-SC_OLD-e5beb480eaf23fa7454728724de80b2a67ded1e8.tar.gz
opensim-SC_OLD-e5beb480eaf23fa7454728724de80b2a67ded1e8.tar.bz2
opensim-SC_OLD-e5beb480eaf23fa7454728724de80b2a67ded1e8.tar.xz
Partial port of Avination's support for the new physics parameters.
Implements the parameters as properties, the serialization and database storage (MySQL only). Implements llSetPrimitiveParams for prim physics shape and the other 4 extra params. Only the prim shape type "None" is currently functional. No support for the Viewer UI (yet), that will be ported in due course. Lots more to port, this is a large-ish changeset.
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Data/MySQL/MySQLSimulationData.cs56
-rw-r--r--OpenSim/Data/MySQL/Resources/RegionStore.migrations13
-rw-r--r--OpenSim/Framework/ExtraPhysicsData.cs50
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs96
-rw-r--r--OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs43
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs16
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs11
7 files changed, 264 insertions, 21 deletions
diff --git a/OpenSim/Data/MySQL/MySQLSimulationData.cs b/OpenSim/Data/MySQL/MySQLSimulationData.cs
index c95311e..2f471a0 100644
--- a/OpenSim/Data/MySQL/MySQLSimulationData.cs
+++ b/OpenSim/Data/MySQL/MySQLSimulationData.cs
@@ -52,7 +52,7 @@ namespace OpenSim.Data.MySQL
52 private string m_connectionString; 52 private string m_connectionString;
53 private object m_dbLock = new object(); 53 private object m_dbLock = new object();
54 54
55 protected virtual Assembly Assembly 55 protected Assembly Assembly
56 { 56 {
57 get { return GetType().Assembly; } 57 get { return GetType().Assembly; }
58 } 58 }
@@ -119,8 +119,10 @@ namespace OpenSim.Data.MySQL
119 119
120 // Eligibility check 120 // Eligibility check
121 // 121 //
122 if ((flags & (uint)PrimFlags.Temporary) != 0) 122 // PrimFlags.Temporary is not used in OpenSim code and cannot
123 return; 123 // be guaranteed to always be clear. Don't check it.
124// if ((flags & (uint)PrimFlags.Temporary) != 0)
125// return;
124 if ((flags & (uint)PrimFlags.TemporaryOnRez) != 0) 126 if ((flags & (uint)PrimFlags.TemporaryOnRez) != 0)
125 return; 127 return;
126 128
@@ -135,7 +137,7 @@ namespace OpenSim.Data.MySQL
135 foreach (SceneObjectPart prim in obj.Parts) 137 foreach (SceneObjectPart prim in obj.Parts)
136 { 138 {
137 cmd.Parameters.Clear(); 139 cmd.Parameters.Clear();
138 140
139 cmd.CommandText = "replace into prims (" + 141 cmd.CommandText = "replace into prims (" +
140 "UUID, CreationDate, " + 142 "UUID, CreationDate, " +
141 "Name, Text, Description, " + 143 "Name, Text, Description, " +
@@ -171,8 +173,10 @@ namespace OpenSim.Data.MySQL
171 "ParticleSystem, ClickAction, Material, " + 173 "ParticleSystem, ClickAction, Material, " +
172 "CollisionSound, CollisionSoundVolume, " + 174 "CollisionSound, CollisionSoundVolume, " +
173 "PassTouches, " + 175 "PassTouches, " +
174 "LinkNumber, MediaURL, DynAttrs) " + 176 "LinkNumber, MediaURL, " +
175 "values (?UUID, " + 177 "PhysicsShapeType, Density, GravityModifier, " +
178 "Friction, Restitution, DynAttrs " +
179 ") values (" + "?UUID, " +
176 "?CreationDate, ?Name, ?Text, " + 180 "?CreationDate, ?Name, ?Text, " +
177 "?Description, ?SitName, ?TouchName, " + 181 "?Description, ?SitName, ?TouchName, " +
178 "?ObjectFlags, ?OwnerMask, ?NextOwnerMask, " + 182 "?ObjectFlags, ?OwnerMask, ?NextOwnerMask, " +
@@ -203,15 +207,17 @@ namespace OpenSim.Data.MySQL
203 "?SaleType, ?ColorR, ?ColorG, " + 207 "?SaleType, ?ColorR, ?ColorG, " +
204 "?ColorB, ?ColorA, ?ParticleSystem, " + 208 "?ColorB, ?ColorA, ?ParticleSystem, " +
205 "?ClickAction, ?Material, ?CollisionSound, " + 209 "?ClickAction, ?Material, ?CollisionSound, " +
206 "?CollisionSoundVolume, ?PassTouches, ?LinkNumber, " + 210 "?CollisionSoundVolume, ?PassTouches, " +
207 "?MediaURL, ?DynAttrs)"; 211 "?LinkNumber, ?MediaURL, " +
208 212 "?PhysicsShapeType, ?Density, ?GravityModifier, " +
213 "?Friction, ?Restitution, ?DynAttrs)";
214
209 FillPrimCommand(cmd, prim, obj.UUID, regionUUID); 215 FillPrimCommand(cmd, prim, obj.UUID, regionUUID);
210 216
211 ExecuteNonQuery(cmd); 217 ExecuteNonQuery(cmd);
212 218
213 cmd.Parameters.Clear(); 219 cmd.Parameters.Clear();
214 220
215 cmd.CommandText = "replace into primshapes (" + 221 cmd.CommandText = "replace into primshapes (" +
216 "UUID, Shape, ScaleX, ScaleY, " + 222 "UUID, Shape, ScaleX, ScaleY, " +
217 "ScaleZ, PCode, PathBegin, PathEnd, " + 223 "ScaleZ, PCode, PathBegin, PathEnd, " +
@@ -234,9 +240,9 @@ namespace OpenSim.Data.MySQL
234 "?ProfileEnd, ?ProfileCurve, " + 240 "?ProfileEnd, ?ProfileCurve, " +
235 "?ProfileHollow, ?Texture, ?ExtraParams, " + 241 "?ProfileHollow, ?Texture, ?ExtraParams, " +
236 "?State, ?Media)"; 242 "?State, ?Media)";
237 243
238 FillShapeCommand(cmd, prim); 244 FillShapeCommand(cmd, prim);
239 245
240 ExecuteNonQuery(cmd); 246 ExecuteNonQuery(cmd);
241 } 247 }
242 } 248 }
@@ -582,7 +588,7 @@ namespace OpenSim.Data.MySQL
582 cmd.CommandText = "insert into terrain (RegionUUID, " + 588 cmd.CommandText = "insert into terrain (RegionUUID, " +
583 "Revision, Heightfield) values (?RegionUUID, " + 589 "Revision, Heightfield) values (?RegionUUID, " +
584 "1, ?Heightfield)"; 590 "1, ?Heightfield)";
585 591
586 cmd.Parameters.AddWithValue("Heightfield", SerializeTerrain(ter)); 592 cmd.Parameters.AddWithValue("Heightfield", SerializeTerrain(ter));
587 593
588 ExecuteNonQuery(cmd); 594 ExecuteNonQuery(cmd);
@@ -741,7 +747,7 @@ namespace OpenSim.Data.MySQL
741 { 747 {
742 //No result, so store our default windlight profile and return it 748 //No result, so store our default windlight profile and return it
743 nWP.regionID = regionUUID; 749 nWP.regionID = regionUUID;
744 StoreRegionWindlightSettings(nWP); 750// StoreRegionWindlightSettings(nWP);
745 return nWP; 751 return nWP;
746 } 752 }
747 else 753 else
@@ -1097,7 +1103,8 @@ namespace OpenSim.Data.MySQL
1097 "?SunPosition, ?Covenant, ?CovenantChangedDateTime, ?Sandbox, " + 1103 "?SunPosition, ?Covenant, ?CovenantChangedDateTime, ?Sandbox, " +
1098 "?SunVectorX, ?SunVectorY, ?SunVectorZ, " + 1104 "?SunVectorX, ?SunVectorY, ?SunVectorZ, " +
1099 "?LoadedCreationDateTime, ?LoadedCreationID, " + 1105 "?LoadedCreationDateTime, ?LoadedCreationID, " +
1100 "?TerrainImageID, ?TelehubObject, ?ParcelImageID) "; 1106 "?TerrainImageID, " +
1107 "?TelehubObject, ?ParcelImageID)";
1101 1108
1102 FillRegionSettingsCommand(cmd, rs); 1109 FillRegionSettingsCommand(cmd, rs);
1103 1110
@@ -1300,6 +1307,12 @@ namespace OpenSim.Data.MySQL
1300 else 1307 else
1301 prim.DynAttrs = new DAMap(); 1308 prim.DynAttrs = new DAMap();
1302 1309
1310 prim.PhysicsShapeType = (byte)Convert.ToInt32(row["PhysicsShapeType"].ToString());
1311 prim.Density = (float)(double)row["Density"];
1312 prim.GravityModifier = (float)(double)row["GravityModifier"];
1313 prim.Friction = (float)(double)row["Friction"];
1314 prim.Bounciness = (float)(double)row["Restitution"];
1315
1303 return prim; 1316 return prim;
1304 } 1317 }
1305 1318
@@ -1499,7 +1512,7 @@ namespace OpenSim.Data.MySQL
1499 for (int x = 0; x < (int)Constants.RegionSize; x++) 1512 for (int x = 0; x < (int)Constants.RegionSize; x++)
1500 for (int y = 0; y < (int)Constants.RegionSize; y++) 1513 for (int y = 0; y < (int)Constants.RegionSize; y++)
1501 { 1514 {
1502 double height = val[x, y]; 1515 double height = 20.0;
1503 if (height == 0.0) 1516 if (height == 0.0)
1504 height = double.Epsilon; 1517 height = double.Epsilon;
1505 1518
@@ -1646,6 +1659,12 @@ namespace OpenSim.Data.MySQL
1646 cmd.Parameters.AddWithValue("LinkNumber", prim.LinkNum); 1659 cmd.Parameters.AddWithValue("LinkNumber", prim.LinkNum);
1647 cmd.Parameters.AddWithValue("MediaURL", prim.MediaUrl); 1660 cmd.Parameters.AddWithValue("MediaURL", prim.MediaUrl);
1648 1661
1662 cmd.Parameters.AddWithValue("PhysicsShapeType", prim.PhysicsShapeType);
1663 cmd.Parameters.AddWithValue("Density", (double)prim.Density);
1664 cmd.Parameters.AddWithValue("GravityModifier", (double)prim.GravityModifier);
1665 cmd.Parameters.AddWithValue("Friction", (double)prim.Friction);
1666 cmd.Parameters.AddWithValue("Restitution", (double)prim.Bounciness);
1667
1649 if (prim.DynAttrs.Count > 0) 1668 if (prim.DynAttrs.Count > 0)
1650 cmd.Parameters.AddWithValue("DynAttrs", prim.DynAttrs.ToXml()); 1669 cmd.Parameters.AddWithValue("DynAttrs", prim.DynAttrs.ToXml());
1651 else 1670 else
@@ -1728,6 +1747,7 @@ namespace OpenSim.Data.MySQL
1728 cmd.Parameters.AddWithValue("LoadedCreationDateTime", settings.LoadedCreationDateTime); 1747 cmd.Parameters.AddWithValue("LoadedCreationDateTime", settings.LoadedCreationDateTime);
1729 cmd.Parameters.AddWithValue("LoadedCreationID", settings.LoadedCreationID); 1748 cmd.Parameters.AddWithValue("LoadedCreationID", settings.LoadedCreationID);
1730 cmd.Parameters.AddWithValue("TerrainImageID", settings.TerrainImageID); 1749 cmd.Parameters.AddWithValue("TerrainImageID", settings.TerrainImageID);
1750
1731 cmd.Parameters.AddWithValue("ParcelImageID", settings.ParcelImageID); 1751 cmd.Parameters.AddWithValue("ParcelImageID", settings.ParcelImageID);
1732 cmd.Parameters.AddWithValue("TelehubObject", settings.TelehubObject); 1752 cmd.Parameters.AddWithValue("TelehubObject", settings.TelehubObject);
1733 } 1753 }
diff --git a/OpenSim/Data/MySQL/Resources/RegionStore.migrations b/OpenSim/Data/MySQL/Resources/RegionStore.migrations
index c48aec2..48cd60b 100644
--- a/OpenSim/Data/MySQL/Resources/RegionStore.migrations
+++ b/OpenSim/Data/MySQL/Resources/RegionStore.migrations
@@ -910,3 +910,16 @@ BEGIN;
910ALTER TABLE prims ADD COLUMN DynAttrs TEXT; 910ALTER TABLE prims ADD COLUMN DynAttrs TEXT;
911 911
912COMMIT; 912COMMIT;
913
914:VERSION 47 #---------------- Extra prim params
915
916BEGIN;
917
918ALTER TABLE prims ADD COLUMN `PhysicsShapeType` tinyint(4) NOT NULL default '0';
919ALTER TABLE prims ADD COLUMN `Density` double NOT NULL default '1000';
920ALTER TABLE prims ADD COLUMN `GravityModifier` double NOT NULL default '1';
921ALTER TABLE prims ADD COLUMN `Friction` double NOT NULL default '0.6';
922ALTER TABLE prims ADD COLUMN `Restitution` double NOT NULL default '0.5';
923
924COMMIT;
925
diff --git a/OpenSim/Framework/ExtraPhysicsData.cs b/OpenSim/Framework/ExtraPhysicsData.cs
new file mode 100644
index 0000000..9e7334f
--- /dev/null
+++ b/OpenSim/Framework/ExtraPhysicsData.cs
@@ -0,0 +1,50 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using OpenMetaverse;
29
30namespace OpenSim.Framework
31{
32 public enum PhysShapeType : byte
33 {
34 prim = 0,
35 none = 1,
36 convex = 2,
37
38 invalid = 255 // use to mark invalid data in ExtraPhysicsData
39 }
40
41 public struct ExtraPhysicsData
42 {
43 public float Density;
44 public float GravitationModifier;
45 public float Friction;
46 public float Bounce;
47 public PhysShapeType PhysShapeType;
48
49 }
50}
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 19e6d37..55b5462 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -302,6 +302,13 @@ namespace OpenSim.Region.Framework.Scenes
302 protected Vector3 m_lastAcceleration; 302 protected Vector3 m_lastAcceleration;
303 protected Vector3 m_lastAngularVelocity; 303 protected Vector3 m_lastAngularVelocity;
304 protected int m_lastTerseSent; 304 protected int m_lastTerseSent;
305
306 protected byte m_physicsShapeType = (byte)PhysShapeType.prim;
307 // TODO: Implement these
308 //protected float m_density = 1000.0f; // in kg/m^3
309 //protected float m_gravitymod = 1.0f;
310 //protected float m_friction = 0.6f; // wood
311 //protected float m_bounce = 0.5f; // wood
305 312
306 /// <summary> 313 /// <summary>
307 /// Stores media texture data 314 /// Stores media texture data
@@ -1322,6 +1329,69 @@ namespace OpenSim.Region.Framework.Scenes
1322 set { m_collisionSoundVolume = value; } 1329 set { m_collisionSoundVolume = value; }
1323 } 1330 }
1324 1331
1332 public byte DefaultPhysicsShapeType()
1333 {
1334 byte type;
1335
1336 if (Shape != null && (Shape.SculptType == (byte)SculptType.Mesh))
1337 type = (byte)PhysShapeType.convex;
1338 else
1339 type = (byte)PhysShapeType.prim;
1340
1341 return type;
1342 }
1343
1344 public byte PhysicsShapeType
1345 {
1346 get { return m_physicsShapeType; }
1347 set
1348 {
1349 byte oldv = m_physicsShapeType;
1350
1351 if (value >= 0 && value <= (byte)PhysShapeType.convex)
1352 {
1353 if (value == (byte)PhysShapeType.none && ParentGroup != null && ParentGroup.RootPart == this)
1354 m_physicsShapeType = DefaultPhysicsShapeType();
1355 else
1356 m_physicsShapeType = value;
1357 }
1358 else
1359 m_physicsShapeType = DefaultPhysicsShapeType();
1360
1361 if (m_physicsShapeType != oldv && ParentGroup != null)
1362 {
1363 if (m_physicsShapeType == (byte)PhysShapeType.none)
1364 {
1365 if (PhysActor != null)
1366 {
1367 Velocity = new Vector3(0, 0, 0);
1368 Acceleration = new Vector3(0, 0, 0);
1369 if (ParentGroup.RootPart == this)
1370 AngularVelocity = new Vector3(0, 0, 0);
1371 ParentGroup.Scene.RemovePhysicalPrim(1);
1372 RemoveFromPhysics();
1373 }
1374 }
1375 else if (PhysActor == null)
1376 {
1377 ApplyPhysics((uint)Flags, VolumeDetectActive);
1378 }
1379 else
1380 {
1381 // TODO: Update physics actor
1382 }
1383
1384 if (ParentGroup != null)
1385 ParentGroup.HasGroupChanged = true;
1386 }
1387 }
1388 }
1389
1390 public float Density { get; set; }
1391 public float GravityModifier { get; set; }
1392 public float Friction { get; set; }
1393 public float Bounciness { get; set; }
1394
1325 #endregion Public Properties with only Get 1395 #endregion Public Properties with only Get
1326 1396
1327 private uint ApplyMask(uint val, bool set, uint mask) 1397 private uint ApplyMask(uint val, bool set, uint mask)
@@ -1523,9 +1593,8 @@ namespace OpenSim.Region.Framework.Scenes
1523 if (!ParentGroup.Scene.CollidablePrims) 1593 if (!ParentGroup.Scene.CollidablePrims)
1524 return; 1594 return;
1525 1595
1526// m_log.DebugFormat( 1596 if (PhysicsShapeType == (byte)PhysShapeType.none)
1527// "[SCENE OBJECT PART]: Applying physics to {0} {1}, m_physicalPrim {2}", 1597 return;
1528// Name, LocalId, UUID, m_physicalPrim);
1529 1598
1530 bool isPhysical = (rootObjectFlags & (uint) PrimFlags.Physics) != 0; 1599 bool isPhysical = (rootObjectFlags & (uint) PrimFlags.Physics) != 0;
1531 bool isPhantom = (rootObjectFlags & (uint) PrimFlags.Phantom) != 0; 1600 bool isPhantom = (rootObjectFlags & (uint) PrimFlags.Phantom) != 0;
@@ -3878,6 +3947,26 @@ namespace OpenSim.Region.Framework.Scenes
3878 } 3947 }
3879 } 3948 }
3880 3949
3950 public void UpdateExtraPhysics(ExtraPhysicsData physdata)
3951 {
3952 if (physdata.PhysShapeType == PhysShapeType.invalid || ParentGroup == null)
3953 return;
3954
3955 if (PhysicsShapeType != (byte)physdata.PhysShapeType)
3956 {
3957 PhysicsShapeType = (byte)physdata.PhysShapeType;
3958
3959 }
3960
3961 if(Density != physdata.Density)
3962 Density = physdata.Density;
3963 if(GravityModifier != physdata.GravitationModifier)
3964 GravityModifier = physdata.GravitationModifier;
3965 if(Friction != physdata.Friction)
3966 Friction = physdata.Friction;
3967 if(Bounciness != physdata.Bounce)
3968 Bounciness = physdata.Bounce;
3969 }
3881 /// <summary> 3970 /// <summary>
3882 /// Update the flags on this prim. This covers properties such as phantom, physics and temporary. 3971 /// Update the flags on this prim. This covers properties such as phantom, physics and temporary.
3883 /// </summary> 3972 /// </summary>
@@ -3949,6 +4038,7 @@ namespace OpenSim.Region.Framework.Scenes
3949 4038
3950 if (SetPhantom 4039 if (SetPhantom
3951 || ParentGroup.IsAttachment 4040 || ParentGroup.IsAttachment
4041 || PhysicsShapeType == (byte)PhysShapeType.none
3952 || (Shape.PathCurve == (byte)Extrusion.Flexible)) // note: this may have been changed above in the case of joints 4042 || (Shape.PathCurve == (byte)Extrusion.Flexible)) // note: this may have been changed above in the case of joints
3953 { 4043 {
3954 AddFlag(PrimFlags.Phantom); 4044 AddFlag(PrimFlags.Phantom);
diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
index 4a2a47e..78229fe 100644
--- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
+++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
@@ -367,6 +367,13 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
367 m_SOPXmlProcessors.Add("PayPrice2", ProcessPayPrice2); 367 m_SOPXmlProcessors.Add("PayPrice2", ProcessPayPrice2);
368 m_SOPXmlProcessors.Add("PayPrice3", ProcessPayPrice3); 368 m_SOPXmlProcessors.Add("PayPrice3", ProcessPayPrice3);
369 m_SOPXmlProcessors.Add("PayPrice4", ProcessPayPrice4); 369 m_SOPXmlProcessors.Add("PayPrice4", ProcessPayPrice4);
370
371 m_SOPXmlProcessors.Add("PhysicsShapeType", ProcessPhysicsShapeType);
372 m_SOPXmlProcessors.Add("Density", ProcessDensity);
373 m_SOPXmlProcessors.Add("Friction", ProcessFriction);
374 m_SOPXmlProcessors.Add("Bounce", ProcessBounce);
375 m_SOPXmlProcessors.Add("GravityModifier", ProcessGravityModifier);
376
370 #endregion 377 #endregion
371 378
372 #region TaskInventoryXmlProcessors initialization 379 #region TaskInventoryXmlProcessors initialization
@@ -594,6 +601,31 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
594 obj.ClickAction = (byte)reader.ReadElementContentAsInt("ClickAction", String.Empty); 601 obj.ClickAction = (byte)reader.ReadElementContentAsInt("ClickAction", String.Empty);
595 } 602 }
596 603
604 private static void ProcessPhysicsShapeType(SceneObjectPart obj, XmlTextReader reader)
605 {
606 obj.PhysicsShapeType = (byte)reader.ReadElementContentAsInt("PhysicsShapeType", String.Empty);
607 }
608
609 private static void ProcessDensity(SceneObjectPart obj, XmlTextReader reader)
610 {
611 obj.Density = reader.ReadElementContentAsFloat("Density", String.Empty);
612 }
613
614 private static void ProcessFriction(SceneObjectPart obj, XmlTextReader reader)
615 {
616 obj.Friction = reader.ReadElementContentAsFloat("Friction", String.Empty);
617 }
618
619 private static void ProcessBounce(SceneObjectPart obj, XmlTextReader reader)
620 {
621 obj.Bounciness = reader.ReadElementContentAsFloat("Bounce", String.Empty);
622 }
623
624 private static void ProcessGravityModifier(SceneObjectPart obj, XmlTextReader reader)
625 {
626 obj.GravityModifier = reader.ReadElementContentAsFloat("GravityModifier", String.Empty);
627 }
628
597 private static void ProcessShape(SceneObjectPart obj, XmlTextReader reader) 629 private static void ProcessShape(SceneObjectPart obj, XmlTextReader reader)
598 { 630 {
599 List<string> errorNodeNames; 631 List<string> errorNodeNames;
@@ -1257,6 +1289,17 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
1257 writer.WriteElementString("PayPrice3", sop.PayPrice[3].ToString()); 1289 writer.WriteElementString("PayPrice3", sop.PayPrice[3].ToString());
1258 writer.WriteElementString("PayPrice4", sop.PayPrice[4].ToString()); 1290 writer.WriteElementString("PayPrice4", sop.PayPrice[4].ToString());
1259 1291
1292 if(sop.PhysicsShapeType != sop.DefaultPhysicsShapeType())
1293 writer.WriteElementString("PhysicsShapeType", sop.PhysicsShapeType.ToString().ToLower());
1294 if (sop.Density != 1000.0f)
1295 writer.WriteElementString("Density", sop.Density.ToString().ToLower());
1296 if (sop.Friction != 0.6f)
1297 writer.WriteElementString("Friction", sop.Friction.ToString().ToLower());
1298 if (sop.Bounciness != 0.5f)
1299 writer.WriteElementString("Bounce", sop.Bounciness.ToString().ToLower());
1300 if (sop.GravityModifier != 1.0f)
1301 writer.WriteElementString("GravityModifier", sop.GravityModifier.ToString().ToLower());
1302
1260 writer.WriteEndElement(); 1303 writer.WriteEndElement();
1261 } 1304 }
1262 1305
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 4fa3c60..64052ae 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -7594,6 +7594,22 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7594 part.ScriptSetPhysicsStatus(physics); 7594 part.ScriptSetPhysicsStatus(physics);
7595 break; 7595 break;
7596 7596
7597 case (int)ScriptBaseClass.PRIM_PHYSICS_SHAPE_TYPE:
7598 if (remain < 1)
7599 return null;
7600
7601 int shape_type = rules.GetLSLIntegerItem(idx++);
7602
7603 ExtraPhysicsData physdata = new ExtraPhysicsData();
7604 physdata.Density = part.Density;
7605 physdata.Bounce = part.Bounciness;
7606 physdata.GravitationModifier = part.GravityModifier;
7607 physdata.PhysShapeType = (PhysShapeType)shape_type;
7608
7609 part.UpdateExtraPhysics(physdata);
7610
7611 break;
7612
7597 case (int)ScriptBaseClass.PRIM_TEMP_ON_REZ: 7613 case (int)ScriptBaseClass.PRIM_TEMP_ON_REZ:
7598 if (remain < 1) 7614 if (remain < 1)
7599 return null; 7615 return null;
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs
index 9bf1a64..bd66ba3 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs
@@ -661,6 +661,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
661 public const int PRIM_MEDIA_PERM_GROUP = 2; 661 public const int PRIM_MEDIA_PERM_GROUP = 2;
662 public const int PRIM_MEDIA_PERM_ANYONE = 4; 662 public const int PRIM_MEDIA_PERM_ANYONE = 4;
663 663
664 public const int PRIM_PHYSICS_SHAPE_TYPE = 30;
665 public const int PRIM_PHYSICS_SHAPE_PRIM = 0;
666 public const int PRIM_PHYSICS_SHAPE_CONVEX = 2;
667 public const int PRIM_PHYSICS_SHAPE_NONE = 1;
668
669 public const int PRIM_PHYSICS_MATERIAL = 31;
670 public const int DENSITY = 1;
671 public const int FRICTION = 2;
672 public const int RESTITUTION = 4;
673 public const int GRAVITY_MULTIPLIER = 8;
674
664 // extra constants for llSetPrimMediaParams 675 // extra constants for llSetPrimMediaParams
665 public static readonly LSLInteger LSL_STATUS_OK = new LSLInteger(0); 676 public static readonly LSLInteger LSL_STATUS_OK = new LSLInteger(0);
666 public static readonly LSLInteger LSL_STATUS_MALFORMED_PARAMS = new LSLInteger(1000); 677 public static readonly LSLInteger LSL_STATUS_MALFORMED_PARAMS = new LSLInteger(1000);