diff options
Diffstat (limited to 'OpenSim/Region/Framework')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.cs | 2 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 47 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 24 |
3 files changed, 62 insertions, 11 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index ec5cf32..456e86b 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -4766,7 +4766,7 @@ Environment.Exit(1); | |||
4766 | bool wasUsingPhysics = ((jointProxyObject.Flags & PrimFlags.Physics) != 0); | 4766 | bool wasUsingPhysics = ((jointProxyObject.Flags & PrimFlags.Physics) != 0); |
4767 | if (wasUsingPhysics) | 4767 | if (wasUsingPhysics) |
4768 | { | 4768 | { |
4769 | jointProxyObject.UpdatePrimFlags(false, false, true, false); // FIXME: possible deadlock here; check to make sure all the scene alterations set into motion here won't deadlock | 4769 | jointProxyObject.UpdatePrimFlags(false, false, true, false,false); // FIXME: possible deadlock here; check to make sure all the scene alterations set into motion here won't deadlock |
4770 | } | 4770 | } |
4771 | } | 4771 | } |
4772 | 4772 | ||
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 683aafc..9961438 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |||
@@ -1281,7 +1281,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
1281 | 1281 | ||
1282 | m_rootPart.SetParentLocalId(0); | 1282 | m_rootPart.SetParentLocalId(0); |
1283 | AttachmentPoint = (byte)0; | 1283 | AttachmentPoint = (byte)0; |
1284 | m_rootPart.ApplyPhysics(m_rootPart.GetEffectiveObjectFlags(), m_rootPart.VolumeDetectActive); | 1284 | // must check if buildind should be true or false here |
1285 | m_rootPart.ApplyPhysics(m_rootPart.GetEffectiveObjectFlags(), m_rootPart.VolumeDetectActive,false); | ||
1285 | HasGroupChanged = true; | 1286 | HasGroupChanged = true; |
1286 | RootPart.Rezzed = DateTime.Now; | 1287 | RootPart.Rezzed = DateTime.Now; |
1287 | RootPart.RemFlag(PrimFlags.TemporaryOnRez); | 1288 | RootPart.RemFlag(PrimFlags.TemporaryOnRez); |
@@ -1581,21 +1582,33 @@ namespace OpenSim.Region.Framework.Scenes | |||
1581 | public void ApplyPhysics() | 1582 | public void ApplyPhysics() |
1582 | { | 1583 | { |
1583 | // Apply physics to the root prim | 1584 | // Apply physics to the root prim |
1584 | m_rootPart.ApplyPhysics(m_rootPart.GetEffectiveObjectFlags(), m_rootPart.VolumeDetectActive); | 1585 | // m_rootPart.ApplyPhysics(m_rootPart.GetEffectiveObjectFlags(), m_rootPart.VolumeDetectActive); |
1585 | 1586 | ||
1586 | // Apply physics to child prims | 1587 | // Apply physics to child prims |
1587 | SceneObjectPart[] parts = m_parts.GetArray(); | 1588 | SceneObjectPart[] parts = m_parts.GetArray(); |
1588 | if (parts.Length > 1) | 1589 | if (parts.Length > 1) |
1589 | { | 1590 | { |
1591 | ResetChildPrimPhysicsPositions(); | ||
1592 | |||
1593 | // Apply physics to the root prim | ||
1594 | m_rootPart.ApplyPhysics(m_rootPart.GetEffectiveObjectFlags(), m_rootPart.VolumeDetectActive, true); | ||
1590 | for (int i = 0; i < parts.Length; i++) | 1595 | for (int i = 0; i < parts.Length; i++) |
1591 | { | 1596 | { |
1592 | SceneObjectPart part = parts[i]; | 1597 | SceneObjectPart part = parts[i]; |
1593 | if (part.LocalId != m_rootPart.LocalId) | 1598 | if (part.LocalId != m_rootPart.LocalId) |
1594 | part.ApplyPhysics(m_rootPart.GetEffectiveObjectFlags(), part.VolumeDetectActive); | 1599 | // part.ApplyPhysics(m_rootPart.GetEffectiveObjectFlags(), part.VolumeDetectActive); |
1595 | } | 1600 | part.ApplyPhysics(m_rootPart.GetEffectiveObjectFlags(), part.VolumeDetectActive, true); |
1596 | 1601 | ||
1602 | } | ||
1597 | // Hack to get the physics scene geometries in the right spot | 1603 | // Hack to get the physics scene geometries in the right spot |
1598 | ResetChildPrimPhysicsPositions(); | 1604 | // ResetChildPrimPhysicsPositions(); |
1605 | if (m_rootPart.PhysActor != null) | ||
1606 | m_rootPart.PhysActor.Building = false; | ||
1607 | } | ||
1608 | else | ||
1609 | { | ||
1610 | // Apply physics to the root prim | ||
1611 | m_rootPart.ApplyPhysics(m_rootPart.GetEffectiveObjectFlags(), m_rootPart.VolumeDetectActive, false); | ||
1599 | } | 1612 | } |
1600 | } | 1613 | } |
1601 | 1614 | ||
@@ -1829,13 +1842,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
1829 | pbs, | 1842 | pbs, |
1830 | newPart.AbsolutePosition, | 1843 | newPart.AbsolutePosition, |
1831 | newPart.Scale, | 1844 | newPart.Scale, |
1832 | newPart.RotationOffset, | 1845 | //newPart.RotationOffset, |
1846 | newPart.GetWorldRotation(), | ||
1833 | part.PhysActor.IsPhysical, | 1847 | part.PhysActor.IsPhysical, |
1834 | newPart.LocalId); | 1848 | newPart.LocalId); |
1835 | 1849 | ||
1836 | newPart.DoPhysicsPropertyUpdate(part.PhysActor.IsPhysical, true); | 1850 | newPart.DoPhysicsPropertyUpdate(part.PhysActor.IsPhysical, true); |
1837 | } | 1851 | } |
1838 | } | 1852 | } |
1853 | if (dupe.m_rootPart.PhysActor != null && userExposed) | ||
1854 | dupe.m_rootPart.PhysActor.Building = false; // tell physics to finish building | ||
1839 | 1855 | ||
1840 | if (userExposed) | 1856 | if (userExposed) |
1841 | { | 1857 | { |
@@ -2853,12 +2869,31 @@ namespace OpenSim.Region.Framework.Scenes | |||
2853 | } | 2869 | } |
2854 | } | 2870 | } |
2855 | 2871 | ||
2872 | /* | ||
2856 | RootPart.UpdatePrimFlags(UsePhysics, SetTemporary, SetPhantom, SetVolumeDetect); | 2873 | RootPart.UpdatePrimFlags(UsePhysics, SetTemporary, SetPhantom, SetVolumeDetect); |
2857 | for (int i = 0; i < parts.Length; i++) | 2874 | for (int i = 0; i < parts.Length; i++) |
2858 | { | 2875 | { |
2859 | if (parts[i] != RootPart) | 2876 | if (parts[i] != RootPart) |
2860 | parts[i].UpdatePrimFlags(UsePhysics, SetTemporary, SetPhantom, SetVolumeDetect); | 2877 | parts[i].UpdatePrimFlags(UsePhysics, SetTemporary, SetPhantom, SetVolumeDetect); |
2861 | } | 2878 | } |
2879 | */ | ||
2880 | if (parts.Length > 1) | ||
2881 | { | ||
2882 | m_rootPart.UpdatePrimFlags(UsePhysics, SetTemporary, SetPhantom, SetVolumeDetect, true); | ||
2883 | |||
2884 | for (int i = 0; i < parts.Length; i++) | ||
2885 | { | ||
2886 | |||
2887 | if (parts[i].UUID != m_rootPart.UUID) | ||
2888 | parts[i].UpdatePrimFlags(UsePhysics, SetTemporary, SetPhantom, SetVolumeDetect, true); | ||
2889 | } | ||
2890 | |||
2891 | if (m_rootPart.PhysActor != null) | ||
2892 | m_rootPart.PhysActor.Building = false; | ||
2893 | } | ||
2894 | else | ||
2895 | m_rootPart.UpdatePrimFlags(UsePhysics, SetTemporary, SetPhantom, SetVolumeDetect, false); | ||
2896 | |||
2862 | } | 2897 | } |
2863 | } | 2898 | } |
2864 | 2899 | ||
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index ac39b6b..577c0d3 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | |||
@@ -1503,7 +1503,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
1503 | /// </summary> | 1503 | /// </summary> |
1504 | /// <param name="rootObjectFlags"></param> | 1504 | /// <param name="rootObjectFlags"></param> |
1505 | /// <param name="VolumeDetectActive"></param> | 1505 | /// <param name="VolumeDetectActive"></param> |
1506 | public void ApplyPhysics(uint rootObjectFlags, bool VolumeDetectActive) | 1506 | // public void ApplyPhysics(uint rootObjectFlags, bool VolumeDetectActive) |
1507 | public void ApplyPhysics(uint rootObjectFlags, bool VolumeDetectActive, bool building) | ||
1507 | { | 1508 | { |
1508 | if (!ParentGroup.Scene.CollidablePrims) | 1509 | if (!ParentGroup.Scene.CollidablePrims) |
1509 | return; | 1510 | return; |
@@ -1539,7 +1540,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
1539 | Shape, | 1540 | Shape, |
1540 | AbsolutePosition, | 1541 | AbsolutePosition, |
1541 | Scale, | 1542 | Scale, |
1542 | RotationOffset, | 1543 | // RotationOffset, |
1544 | GetWorldRotation(), // physics wants world rotation | ||
1543 | RigidBody, | 1545 | RigidBody, |
1544 | m_localId); | 1546 | m_localId); |
1545 | } | 1547 | } |
@@ -1556,6 +1558,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
1556 | PhysActor.SetMaterial(Material); | 1558 | PhysActor.SetMaterial(Material); |
1557 | DoPhysicsPropertyUpdate(RigidBody, true); | 1559 | DoPhysicsPropertyUpdate(RigidBody, true); |
1558 | PhysActor.SetVolumeDetect(VolumeDetectActive ? 1 : 0); | 1560 | PhysActor.SetVolumeDetect(VolumeDetectActive ? 1 : 0); |
1561 | if (!building) | ||
1562 | PhysActor.Building = false; | ||
1559 | } | 1563 | } |
1560 | } | 1564 | } |
1561 | } | 1565 | } |
@@ -1791,6 +1795,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
1791 | if (!isNew) | 1795 | if (!isNew) |
1792 | ParentGroup.Scene.RemovePhysicalPrim(1); | 1796 | ParentGroup.Scene.RemovePhysicalPrim(1); |
1793 | 1797 | ||
1798 | Velocity = new Vector3(0, 0, 0); | ||
1799 | Acceleration = new Vector3(0, 0, 0); | ||
1800 | AngularVelocity = new Vector3(0, 0, 0); | ||
1801 | |||
1794 | PhysActor.OnRequestTerseUpdate -= PhysicsRequestingTerseUpdate; | 1802 | PhysActor.OnRequestTerseUpdate -= PhysicsRequestingTerseUpdate; |
1795 | PhysActor.OnOutOfBounds -= PhysicsOutOfBounds; | 1803 | PhysActor.OnOutOfBounds -= PhysicsOutOfBounds; |
1796 | PhysActor.delink(); | 1804 | PhysActor.delink(); |
@@ -4267,7 +4275,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
4267 | /// <param name="SetTemporary"></param> | 4275 | /// <param name="SetTemporary"></param> |
4268 | /// <param name="SetPhantom"></param> | 4276 | /// <param name="SetPhantom"></param> |
4269 | /// <param name="SetVD"></param> | 4277 | /// <param name="SetVD"></param> |
4270 | public void UpdatePrimFlags(bool UsePhysics, bool SetTemporary, bool SetPhantom, bool SetVD) | 4278 | // public void UpdatePrimFlags(bool UsePhysics, bool SetTemporary, bool SetPhantom, bool SetVD) |
4279 | public void UpdatePrimFlags(bool UsePhysics, bool SetTemporary, bool SetPhantom, bool SetVD, bool building) | ||
4271 | { | 4280 | { |
4272 | bool wasUsingPhysics = ((Flags & PrimFlags.Physics) != 0); | 4281 | bool wasUsingPhysics = ((Flags & PrimFlags.Physics) != 0); |
4273 | bool wasTemporary = ((Flags & PrimFlags.TemporaryOnRez) != 0); | 4282 | bool wasTemporary = ((Flags & PrimFlags.TemporaryOnRez) != 0); |
@@ -4285,6 +4294,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
4285 | // that... | 4294 | // that... |
4286 | // ... if VD is changed, all others are not. | 4295 | // ... if VD is changed, all others are not. |
4287 | // ... if one of the others is changed, VD is not. | 4296 | // ... if one of the others is changed, VD is not. |
4297 | // do this first | ||
4298 | if (building && PhysActor != null && PhysActor.Building != building) | ||
4299 | PhysActor.Building = building; | ||
4288 | if (SetVD) // VD is active, special logic applies | 4300 | if (SetVD) // VD is active, special logic applies |
4289 | { | 4301 | { |
4290 | // State machine logic for VolumeDetect | 4302 | // State machine logic for VolumeDetect |
@@ -4366,7 +4378,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
4366 | Shape, | 4378 | Shape, |
4367 | AbsolutePosition, | 4379 | AbsolutePosition, |
4368 | Scale, | 4380 | Scale, |
4369 | RotationOffset, | 4381 | // RotationOffset, |
4382 | GetWorldRotation(), //physics wants world rotation like all other functions send | ||
4370 | UsePhysics, | 4383 | UsePhysics, |
4371 | m_localId); | 4384 | m_localId); |
4372 | 4385 | ||
@@ -4446,6 +4459,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
4446 | } | 4459 | } |
4447 | // m_log.Debug("Update: PHY:" + UsePhysics.ToString() + ", T:" + IsTemporary.ToString() + ", PHA:" + IsPhantom.ToString() + " S:" + CastsShadows.ToString()); | 4460 | // m_log.Debug("Update: PHY:" + UsePhysics.ToString() + ", T:" + IsTemporary.ToString() + ", PHA:" + IsPhantom.ToString() + " S:" + CastsShadows.ToString()); |
4448 | 4461 | ||
4462 | // and last in case we have a new actor and not building | ||
4463 | if (PhysActor != null && PhysActor.Building != building) | ||
4464 | PhysActor.Building = building; | ||
4449 | if (ParentGroup != null) | 4465 | if (ParentGroup != null) |
4450 | { | 4466 | { |
4451 | ParentGroup.HasGroupChanged = true; | 4467 | ParentGroup.HasGroupChanged = true; |