aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework')
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs47
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs24
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs10
4 files changed, 72 insertions, 11 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index bbdf35d..8552d4c 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 a4ca0fb..644b78a 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -1368,7 +1368,8 @@ namespace OpenSim.Region.Framework.Scenes
1368 1368
1369 m_rootPart.SetParentLocalId(0); 1369 m_rootPart.SetParentLocalId(0);
1370 AttachmentPoint = (byte)0; 1370 AttachmentPoint = (byte)0;
1371 m_rootPart.ApplyPhysics(m_rootPart.GetEffectiveObjectFlags(), m_rootPart.VolumeDetectActive); 1371 // must check if buildind should be true or false here
1372 m_rootPart.ApplyPhysics(m_rootPart.GetEffectiveObjectFlags(), m_rootPart.VolumeDetectActive,false);
1372 HasGroupChanged = true; 1373 HasGroupChanged = true;
1373 RootPart.Rezzed = DateTime.Now; 1374 RootPart.Rezzed = DateTime.Now;
1374 RootPart.RemFlag(PrimFlags.TemporaryOnRez); 1375 RootPart.RemFlag(PrimFlags.TemporaryOnRez);
@@ -1668,21 +1669,33 @@ namespace OpenSim.Region.Framework.Scenes
1668 public void ApplyPhysics() 1669 public void ApplyPhysics()
1669 { 1670 {
1670 // Apply physics to the root prim 1671 // Apply physics to the root prim
1671 m_rootPart.ApplyPhysics(m_rootPart.GetEffectiveObjectFlags(), m_rootPart.VolumeDetectActive); 1672 // m_rootPart.ApplyPhysics(m_rootPart.GetEffectiveObjectFlags(), m_rootPart.VolumeDetectActive);
1672 1673
1673 // Apply physics to child prims 1674 // Apply physics to child prims
1674 SceneObjectPart[] parts = m_parts.GetArray(); 1675 SceneObjectPart[] parts = m_parts.GetArray();
1675 if (parts.Length > 1) 1676 if (parts.Length > 1)
1676 { 1677 {
1678 ResetChildPrimPhysicsPositions();
1679
1680 // Apply physics to the root prim
1681 m_rootPart.ApplyPhysics(m_rootPart.GetEffectiveObjectFlags(), m_rootPart.VolumeDetectActive, true);
1677 for (int i = 0; i < parts.Length; i++) 1682 for (int i = 0; i < parts.Length; i++)
1678 { 1683 {
1679 SceneObjectPart part = parts[i]; 1684 SceneObjectPart part = parts[i];
1680 if (part.LocalId != m_rootPart.LocalId) 1685 if (part.LocalId != m_rootPart.LocalId)
1681 part.ApplyPhysics(m_rootPart.GetEffectiveObjectFlags(), part.VolumeDetectActive); 1686// part.ApplyPhysics(m_rootPart.GetEffectiveObjectFlags(), part.VolumeDetectActive);
1682 } 1687 part.ApplyPhysics(m_rootPart.GetEffectiveObjectFlags(), part.VolumeDetectActive, true);
1683 1688
1689 }
1684 // Hack to get the physics scene geometries in the right spot 1690 // Hack to get the physics scene geometries in the right spot
1685 ResetChildPrimPhysicsPositions(); 1691// ResetChildPrimPhysicsPositions();
1692 if (m_rootPart.PhysActor != null)
1693 m_rootPart.PhysActor.Building = false;
1694 }
1695 else
1696 {
1697 // Apply physics to the root prim
1698 m_rootPart.ApplyPhysics(m_rootPart.GetEffectiveObjectFlags(), m_rootPart.VolumeDetectActive, false);
1686 } 1699 }
1687 } 1700 }
1688 1701
@@ -1916,13 +1929,16 @@ namespace OpenSim.Region.Framework.Scenes
1916 pbs, 1929 pbs,
1917 newPart.AbsolutePosition, 1930 newPart.AbsolutePosition,
1918 newPart.Scale, 1931 newPart.Scale,
1919 newPart.RotationOffset, 1932 //newPart.RotationOffset,
1933 newPart.GetWorldRotation(),
1920 part.PhysActor.IsPhysical, 1934 part.PhysActor.IsPhysical,
1921 newPart.LocalId); 1935 newPart.LocalId);
1922 1936
1923 newPart.DoPhysicsPropertyUpdate(part.PhysActor.IsPhysical, true); 1937 newPart.DoPhysicsPropertyUpdate(part.PhysActor.IsPhysical, true);
1924 } 1938 }
1925 } 1939 }
1940 if (dupe.m_rootPart.PhysActor != null && userExposed)
1941 dupe.m_rootPart.PhysActor.Building = false; // tell physics to finish building
1926 1942
1927 if (userExposed) 1943 if (userExposed)
1928 { 1944 {
@@ -2940,12 +2956,31 @@ namespace OpenSim.Region.Framework.Scenes
2940 } 2956 }
2941 } 2957 }
2942 2958
2959/*
2943 RootPart.UpdatePrimFlags(UsePhysics, SetTemporary, SetPhantom, SetVolumeDetect); 2960 RootPart.UpdatePrimFlags(UsePhysics, SetTemporary, SetPhantom, SetVolumeDetect);
2944 for (int i = 0; i < parts.Length; i++) 2961 for (int i = 0; i < parts.Length; i++)
2945 { 2962 {
2946 if (parts[i] != RootPart) 2963 if (parts[i] != RootPart)
2947 parts[i].UpdatePrimFlags(UsePhysics, SetTemporary, SetPhantom, SetVolumeDetect); 2964 parts[i].UpdatePrimFlags(UsePhysics, SetTemporary, SetPhantom, SetVolumeDetect);
2948 } 2965 }
2966*/
2967 if (parts.Length > 1)
2968 {
2969 m_rootPart.UpdatePrimFlags(UsePhysics, SetTemporary, SetPhantom, SetVolumeDetect, true);
2970
2971 for (int i = 0; i < parts.Length; i++)
2972 {
2973
2974 if (parts[i].UUID != m_rootPart.UUID)
2975 parts[i].UpdatePrimFlags(UsePhysics, SetTemporary, SetPhantom, SetVolumeDetect, true);
2976 }
2977
2978 if (m_rootPart.PhysActor != null)
2979 m_rootPart.PhysActor.Building = false;
2980 }
2981 else
2982 m_rootPart.UpdatePrimFlags(UsePhysics, SetTemporary, SetPhantom, SetVolumeDetect, false);
2983
2949 } 2984 }
2950 } 2985 }
2951 2986
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;
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 429fc06..8a42616 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -1843,8 +1843,11 @@ namespace OpenSim.Region.Framework.Scenes
1843// m_log.DebugFormat("[SCENE PRESENCE]: StandUp() for {0}", Name); 1843// m_log.DebugFormat("[SCENE PRESENCE]: StandUp() for {0}", Name);
1844 1844
1845 SitGround = false; 1845 SitGround = false;
1846
1847/* move this down so avatar gets physical in the new position and not where it is siting
1846 if (PhysicsActor == null) 1848 if (PhysicsActor == null)
1847 AddToPhysicalScene(false); 1849 AddToPhysicalScene(false);
1850 */
1848 1851
1849 if (ParentID != 0) 1852 if (ParentID != 0)
1850 { 1853 {
@@ -1879,6 +1882,10 @@ namespace OpenSim.Region.Framework.Scenes
1879 ParentPosition = Vector3.Zero; 1882 ParentPosition = Vector3.Zero;
1880 1883
1881 ParentID = 0; 1884 ParentID = 0;
1885
1886 if (PhysicsActor == null)
1887 AddToPhysicalScene(false);
1888
1882 SendAvatarDataToAllAgents(); 1889 SendAvatarDataToAllAgents();
1883 m_requestedSitTargetID = 0; 1890 m_requestedSitTargetID = 0;
1884 1891
@@ -1886,6 +1893,9 @@ namespace OpenSim.Region.Framework.Scenes
1886 part.ParentGroup.TriggerScriptChangedEvent(Changed.LINK); 1893 part.ParentGroup.TriggerScriptChangedEvent(Changed.LINK);
1887 } 1894 }
1888 1895
1896 else if (PhysicsActor == null)
1897 AddToPhysicalScene(false);
1898
1889 Animator.TrySetMovementAnimation("STAND"); 1899 Animator.TrySetMovementAnimation("STAND");
1890 } 1900 }
1891 1901