diff options
Merge branch 'ubitwork'
Diffstat (limited to 'OpenSim/Region/Framework/Scenes')
3 files changed, 98 insertions, 35 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 5ccea13..9898681 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |||
@@ -2057,30 +2057,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
2057 | } | 2057 | } |
2058 | } | 2058 | } |
2059 | 2059 | ||
2060 | public void setAngularImpulse(Vector3 impulse) | ||
2061 | { | ||
2062 | if (RootPart.PhysActor != null) | ||
2063 | { | ||
2064 | if (!IsAttachment) | ||
2065 | { | ||
2066 | RootPart.PhysActor.Torque = impulse; | ||
2067 | m_scene.PhysicsScene.AddPhysicsActorTaint(RootPart.PhysActor); | ||
2068 | } | ||
2069 | } | ||
2070 | } | ||
2071 | |||
2072 | public Vector3 GetTorque() | 2060 | public Vector3 GetTorque() |
2073 | { | 2061 | { |
2074 | if (RootPart.PhysActor != null) | 2062 | return RootPart.Torque; |
2075 | { | ||
2076 | if (!IsAttachment) | ||
2077 | { | ||
2078 | Vector3 torque = RootPart.PhysActor.Torque; | ||
2079 | return torque; | ||
2080 | } | ||
2081 | } | ||
2082 | |||
2083 | return Vector3.Zero; | ||
2084 | } | 2063 | } |
2085 | 2064 | ||
2086 | // This is used by both Double-Click Auto-Pilot and llMoveToTarget() in an attached object | 2065 | // 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 b6d5c4b..825f2a3 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 | } |
@@ -2005,10 +2071,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2005 | 2071 | ||
2006 | public Vector3 GetForce() | 2072 | public Vector3 GetForce() |
2007 | { | 2073 | { |
2008 | if (PhysActor != null) | 2074 | return Force; |
2009 | return PhysActor.Force; | ||
2010 | else | ||
2011 | return Vector3.Zero; | ||
2012 | } | 2075 | } |
2013 | 2076 | ||
2014 | /// <summary> | 2077 | /// <summary> |
@@ -3153,10 +3216,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
3153 | 3216 | ||
3154 | public void SetBuoyancy(float fvalue) | 3217 | public void SetBuoyancy(float fvalue) |
3155 | { | 3218 | { |
3219 | Buoyancy = fvalue; | ||
3220 | /* | ||
3156 | if (PhysActor != null) | 3221 | if (PhysActor != null) |
3157 | { | 3222 | { |
3158 | PhysActor.Buoyancy = fvalue; | 3223 | PhysActor.Buoyancy = fvalue; |
3159 | } | 3224 | } |
3225 | */ | ||
3160 | } | 3226 | } |
3161 | 3227 | ||
3162 | public void SetDieAtEdge(bool p) | 3228 | public void SetDieAtEdge(bool p) |
@@ -3184,10 +3250,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
3184 | 3250 | ||
3185 | public void SetForce(Vector3 force) | 3251 | public void SetForce(Vector3 force) |
3186 | { | 3252 | { |
3253 | Force = force; | ||
3254 | /* | ||
3187 | if (PhysActor != null) | 3255 | if (PhysActor != null) |
3188 | { | 3256 | { |
3189 | PhysActor.Force = force; | 3257 | PhysActor.Force = force; |
3190 | } | 3258 | } |
3259 | */ | ||
3191 | } | 3260 | } |
3192 | 3261 | ||
3193 | public SOPVehicle sopVehicle | 3262 | 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 |