diff options
author | UbitUmarov | 2012-02-08 23:14:53 +0000 |
---|---|---|
committer | UbitUmarov | 2012-02-08 23:14:53 +0000 |
commit | 6af01f6767838235091b9e34cdaea05951d68f68 (patch) | |
tree | 18bbf9186fee6aa6884ef824c8dc7e8aed47773a /OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |
parent | first change in SOP. in AddPrimShape(..) give physics the world rotation and ... (diff) | |
download | opensim-SC_OLD-6af01f6767838235091b9e34cdaea05951d68f68.zip opensim-SC_OLD-6af01f6767838235091b9e34cdaea05951d68f68.tar.gz opensim-SC_OLD-6af01f6767838235091b9e34cdaea05951d68f68.tar.bz2 opensim-SC_OLD-6af01f6767838235091b9e34cdaea05951d68f68.tar.xz |
initial introdution of physics actor building control.
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 47 |
1 files changed, 41 insertions, 6 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 46c4d7b..2a3d735 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 | { |
@@ -2849,12 +2865,31 @@ namespace OpenSim.Region.Framework.Scenes | |||
2849 | } | 2865 | } |
2850 | } | 2866 | } |
2851 | 2867 | ||
2868 | /* | ||
2852 | RootPart.UpdatePrimFlags(UsePhysics, SetTemporary, SetPhantom, SetVolumeDetect); | 2869 | RootPart.UpdatePrimFlags(UsePhysics, SetTemporary, SetPhantom, SetVolumeDetect); |
2853 | for (int i = 0; i < parts.Length; i++) | 2870 | for (int i = 0; i < parts.Length; i++) |
2854 | { | 2871 | { |
2855 | if (parts[i] != RootPart) | 2872 | if (parts[i] != RootPart) |
2856 | parts[i].UpdatePrimFlags(UsePhysics, SetTemporary, SetPhantom, SetVolumeDetect); | 2873 | parts[i].UpdatePrimFlags(UsePhysics, SetTemporary, SetPhantom, SetVolumeDetect); |
2857 | } | 2874 | } |
2875 | */ | ||
2876 | if (parts.Length > 1) | ||
2877 | { | ||
2878 | m_rootPart.UpdatePrimFlags(UsePhysics, SetTemporary, SetPhantom, SetVolumeDetect, true); | ||
2879 | |||
2880 | for (int i = 0; i < parts.Length; i++) | ||
2881 | { | ||
2882 | |||
2883 | if (parts[i].UUID != m_rootPart.UUID) | ||
2884 | parts[i].UpdatePrimFlags(UsePhysics, SetTemporary, SetPhantom, SetVolumeDetect, true); | ||
2885 | } | ||
2886 | |||
2887 | if (m_rootPart.PhysActor != null) | ||
2888 | m_rootPart.PhysActor.Building = false; | ||
2889 | } | ||
2890 | else | ||
2891 | m_rootPart.UpdatePrimFlags(UsePhysics, SetTemporary, SetPhantom, SetVolumeDetect, false); | ||
2892 | |||
2858 | } | 2893 | } |
2859 | } | 2894 | } |
2860 | 2895 | ||