aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework
diff options
context:
space:
mode:
authorUbitUmarov2012-02-25 22:20:25 +0000
committerUbitUmarov2012-02-25 22:20:25 +0000
commite07440d0c53fdc8e90f4887242e3b21049a729c0 (patch)
treecba4154ec1678c27aa9b4adf1c9a80088554dac1 /OpenSim/Region/Framework
parentMerge branch 'master' of ssh://3dhosting.de/var/git/careminster into ubitwork (diff)
downloadopensim-SC_OLD-e07440d0c53fdc8e90f4887242e3b21049a729c0.zip
opensim-SC_OLD-e07440d0c53fdc8e90f4887242e3b21049a729c0.tar.gz
opensim-SC_OLD-e07440d0c53fdc8e90f4887242e3b21049a729c0.tar.bz2
opensim-SC_OLD-e07440d0c53fdc8e90f4887242e3b21049a729c0.tar.xz
changed SOP Force and Torque, adding XML (de/)serialization, also changed Buoyance. PLEASE trap deserialization from inventory etc, making force and torque vector3.Zero, unless we want then to rez moving. (needs checking/testing as usual)
Diffstat (limited to 'OpenSim/Region/Framework')
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs23
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs93
-rw-r--r--OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs17
3 files changed, 98 insertions, 35 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index 248d4c6..e9021f1 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -2045,30 +2045,9 @@ namespace OpenSim.Region.Framework.Scenes
2045 } 2045 }
2046 } 2046 }
2047 2047
2048 public void setAngularImpulse(Vector3 impulse)
2049 {
2050 if (RootPart.PhysActor != null)
2051 {
2052 if (!IsAttachment)
2053 {
2054 RootPart.PhysActor.Torque = impulse;
2055 m_scene.PhysicsScene.AddPhysicsActorTaint(RootPart.PhysActor);
2056 }
2057 }
2058 }
2059
2060 public Vector3 GetTorque() 2048 public Vector3 GetTorque()
2061 { 2049 {
2062 if (RootPart.PhysActor != null) 2050 return RootPart.Torque;
2063 {
2064 if (!IsAttachment)
2065 {
2066 Vector3 torque = RootPart.PhysActor.Torque;
2067 return torque;
2068 }
2069 }
2070
2071 return Vector3.Zero;
2072 } 2051 }
2073 2052
2074 // This is used by both Double-Click Auto-Pilot and llMoveToTarget() in an attached object 2053 // This is used by both Double-Click Auto-Pilot and llMoveToTarget() in an attached object
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index dd9431b..f35a27e 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -294,6 +294,8 @@ namespace OpenSim.Region.Framework.Scenes
294 protected Vector3 m_lastAngularVelocity; 294 protected Vector3 m_lastAngularVelocity;
295 protected int m_lastTerseSent; 295 protected int m_lastTerseSent;
296 protected float m_buoyancy = 0.0f; 296 protected float m_buoyancy = 0.0f;
297 protected Vector3 m_force;
298 protected Vector3 m_torque;
297 299
298 /// <summary> 300 /// <summary>
299 /// Stores media texture data 301 /// Stores media texture data
@@ -1302,14 +1304,66 @@ namespace OpenSim.Region.Framework.Scenes
1302 1304
1303 public float Buoyancy 1305 public float Buoyancy
1304 { 1306 {
1305 get { return m_buoyancy; } 1307 get
1308 {
1309 if (ParentID != 0 && ParentGroup != null)
1310 m_buoyancy = ParentGroup.RootPart.Buoyancy;
1311 return m_buoyancy;
1312 }
1306 set 1313 set
1307 { 1314 {
1308 m_buoyancy = value; 1315 m_buoyancy = value;
1309 if (PhysActor != null) 1316 if (ParentID != 0)
1310 { 1317 {
1318 if (ParentGroup != null)
1319 ParentGroup.RootPart.Buoyancy = value;
1320 }
1321 else if (PhysActor != null)
1311 PhysActor.Buoyancy = value; 1322 PhysActor.Buoyancy = value;
1323 }
1324 }
1325
1326 public Vector3 Force
1327 {
1328 get
1329 {
1330 if (ParentID != 0 && ParentGroup != null)
1331 m_force = ParentGroup.RootPart.Force;
1332 return m_force;
1333 }
1334
1335 set
1336 {
1337 m_force = value;
1338 if (ParentID != 0)
1339 {
1340 if (ParentGroup != null)
1341 ParentGroup.RootPart.Force = value;
1312 } 1342 }
1343 else if (PhysActor != null)
1344 PhysActor.Force = value;
1345 }
1346 }
1347
1348 public Vector3 Torque
1349 {
1350 get
1351 {
1352 if (ParentID != 0 && ParentGroup != null)
1353 m_torque = ParentGroup.RootPart.Torque;
1354 return m_torque;
1355 }
1356
1357 set
1358 {
1359 m_torque = value;
1360 if (ParentID != 0)
1361 {
1362 if (ParentGroup != null)
1363 ParentGroup.RootPart.Torque = value;
1364 }
1365 else if (PhysActor != null)
1366 PhysActor.Torque = value;
1313 } 1367 }
1314 } 1368 }
1315 1369
@@ -1488,20 +1542,24 @@ namespace OpenSim.Region.Framework.Scenes
1488 /// </summary> 1542 /// </summary>
1489 /// <param name="impulsei">Vector force</param> 1543 /// <param name="impulsei">Vector force</param>
1490 /// <param name="localGlobalTF">true for the local frame, false for the global frame</param> 1544 /// <param name="localGlobalTF">true for the local frame, false for the global frame</param>
1491 public void SetAngularImpulse(Vector3 impulsei, bool localGlobalTF) 1545
1546 // this is actualy Set Torque.. keeping naming so not to edit lslapi also
1547 public void SetAngularImpulse(Vector3 torquei, bool localGlobalTF)
1492 { 1548 {
1493 Vector3 impulse = impulsei; 1549 Vector3 torque = torquei;
1494 1550
1495 if (localGlobalTF) 1551 if (localGlobalTF)
1496 { 1552 {
1553/*
1497 Quaternion grot = GetWorldRotation(); 1554 Quaternion grot = GetWorldRotation();
1498 Quaternion AXgrot = grot; 1555 Quaternion AXgrot = grot;
1499 Vector3 AXimpulsei = impulsei; 1556 Vector3 AXimpulsei = impulsei;
1500 Vector3 newimpulse = AXimpulsei * AXgrot; 1557 Vector3 newimpulse = AXimpulsei * AXgrot;
1501 impulse = newimpulse; 1558 */
1559 torque *= GetWorldRotation();
1502 } 1560 }
1503 1561
1504 ParentGroup.setAngularImpulse(impulse); 1562 Torque = torque;
1505 } 1563 }
1506 1564
1507 /// <summary> 1565 /// <summary>
@@ -1571,14 +1629,22 @@ namespace OpenSim.Region.Framework.Scenes
1571 1629
1572 DoPhysicsPropertyUpdate(RigidBody, true); 1630 DoPhysicsPropertyUpdate(RigidBody, true);
1573 PhysActor.SetVolumeDetect(VolumeDetectActive ? 1 : 0); 1631 PhysActor.SetVolumeDetect(VolumeDetectActive ? 1 : 0);
1632
1633 if (!building)
1634 PhysActor.Building = false;
1574 1635
1575 Velocity = velocity; 1636 Velocity = velocity;
1576 AngularVelocity = rotationalVelocity; 1637 AngularVelocity = rotationalVelocity;
1577 PhysActor.Velocity = velocity; 1638 PhysActor.Velocity = velocity;
1578 PhysActor.RotationalVelocity = rotationalVelocity; 1639 PhysActor.RotationalVelocity = rotationalVelocity;
1579 1640
1580 if (!building) 1641 // if not vehicle and root part apply force and torque
1581 PhysActor.Building = false; 1642 if ((m_vehicle == null || m_vehicle.Type == Vehicle.TYPE_NONE)
1643 && LocalId == ParentGroup.RootPart.LocalId)
1644 {
1645 PhysActor.Force = Force;
1646 PhysActor.Torque = Torque;
1647 }
1582 } 1648 }
1583 } 1649 }
1584 } 1650 }
@@ -2002,10 +2068,7 @@ namespace OpenSim.Region.Framework.Scenes
2002 2068
2003 public Vector3 GetForce() 2069 public Vector3 GetForce()
2004 { 2070 {
2005 if (PhysActor != null) 2071 return Force;
2006 return PhysActor.Force;
2007 else
2008 return Vector3.Zero;
2009 } 2072 }
2010 2073
2011 /// <summary> 2074 /// <summary>
@@ -3150,10 +3213,13 @@ namespace OpenSim.Region.Framework.Scenes
3150 3213
3151 public void SetBuoyancy(float fvalue) 3214 public void SetBuoyancy(float fvalue)
3152 { 3215 {
3216 Buoyancy = fvalue;
3217/*
3153 if (PhysActor != null) 3218 if (PhysActor != null)
3154 { 3219 {
3155 PhysActor.Buoyancy = fvalue; 3220 PhysActor.Buoyancy = fvalue;
3156 } 3221 }
3222 */
3157 } 3223 }
3158 3224
3159 public void SetDieAtEdge(bool p) 3225 public void SetDieAtEdge(bool p)
@@ -3181,10 +3247,13 @@ namespace OpenSim.Region.Framework.Scenes
3181 3247
3182 public void SetForce(Vector3 force) 3248 public void SetForce(Vector3 force)
3183 { 3249 {
3250 Force = force;
3251/*
3184 if (PhysActor != null) 3252 if (PhysActor != null)
3185 { 3253 {
3186 PhysActor.Force = force; 3254 PhysActor.Force = force;
3187 } 3255 }
3256 */
3188 } 3257 }
3189 3258
3190 public SOPVehicle sopVehicle 3259 public SOPVehicle sopVehicle
diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
index 72a0ec3..ed761da 100644
--- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
+++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
@@ -349,6 +349,8 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
349 m_SOPXmlProcessors.Add("PayPrice4", ProcessPayPrice4); 349 m_SOPXmlProcessors.Add("PayPrice4", ProcessPayPrice4);
350 350
351 m_SOPXmlProcessors.Add("Buoyancy", ProcessBuoyancy); 351 m_SOPXmlProcessors.Add("Buoyancy", ProcessBuoyancy);
352 m_SOPXmlProcessors.Add("Force", ProcessForce);
353 m_SOPXmlProcessors.Add("Torque", ProcessTorque);
352 m_SOPXmlProcessors.Add("VolumeDetectActive", ProcessVolumeDetectActive); 354 m_SOPXmlProcessors.Add("VolumeDetectActive", ProcessVolumeDetectActive);
353 355
354 //Ubit comented until proper testing 356 //Ubit comented until proper testing
@@ -762,7 +764,16 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
762 764
763 private static void ProcessBuoyancy(SceneObjectPart obj, XmlTextReader reader) 765 private static void ProcessBuoyancy(SceneObjectPart obj, XmlTextReader reader)
764 { 766 {
765 obj.Buoyancy = (int)reader.ReadElementContentAsFloat("Buoyancy", String.Empty); 767 obj.Buoyancy = (float)reader.ReadElementContentAsFloat("Buoyancy", String.Empty);
768 }
769
770 private static void ProcessForce(SceneObjectPart obj, XmlTextReader reader)
771 {
772 obj.Force = Util.ReadVector(reader, "Force");
773 }
774 private static void ProcessTorque(SceneObjectPart obj, XmlTextReader reader)
775 {
776 obj.Torque = Util.ReadVector(reader, "Torque");
766 } 777 }
767 778
768 private static void ProcessVolumeDetectActive(SceneObjectPart obj, XmlTextReader reader) 779 private static void ProcessVolumeDetectActive(SceneObjectPart obj, XmlTextReader reader)
@@ -1256,6 +1267,10 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
1256 writer.WriteElementString("PayPrice4", sop.PayPrice[4].ToString()); 1267 writer.WriteElementString("PayPrice4", sop.PayPrice[4].ToString());
1257 1268
1258 writer.WriteElementString("Buoyancy", sop.Buoyancy.ToString()); 1269 writer.WriteElementString("Buoyancy", sop.Buoyancy.ToString());
1270
1271 WriteVector(writer, "Force", sop.Force);
1272 WriteVector(writer, "Torque", sop.Torque);
1273
1259 writer.WriteElementString("VolumeDetectActive", sop.VolumeDetectActive.ToString().ToLower()); 1274 writer.WriteElementString("VolumeDetectActive", sop.VolumeDetectActive.ToString().ToLower());
1260 1275
1261 //Ubit comented until proper testing 1276 //Ubit comented until proper testing