diff options
author | Teravus Ovares | 2008-01-14 18:29:04 +0000 |
---|---|---|
committer | Teravus Ovares | 2008-01-14 18:29:04 +0000 |
commit | a522d7844b44534136475c5f45dd8608ee37ef1f (patch) | |
tree | 325df5653e84d9d625fd10a6a0798cb83782995e /OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs | |
parent | Print out the exception as well as APPLICATION EXCEPTION DETECTED when the se... (diff) | |
download | opensim-SC-a522d7844b44534136475c5f45dd8608ee37ef1f.zip opensim-SC-a522d7844b44534136475c5f45dd8608ee37ef1f.tar.gz opensim-SC-a522d7844b44534136475c5f45dd8608ee37ef1f.tar.bz2 opensim-SC-a522d7844b44534136475c5f45dd8608ee37ef1f.tar.xz |
* First pass at collidable linksets
* There will be bugs, you can count on that. To avoid them, set the linksets phantom
* After region restart, the linksets restore in a non collidable state.
* Linksets can but shouldn't be made physical with the physical checkbox or when you unlink them, they tend to explode.
* After creating a linkset, you have to move the linkset or set it phantom and not phantom for it to become collidable.
* There's a few ParentGroup references that need to be refactored.
Diffstat (limited to 'OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs')
-rw-r--r-- | OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs | 80 |
1 files changed, 51 insertions, 29 deletions
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs index cd8b8e4..879e4a3 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs | |||
@@ -146,13 +146,13 @@ namespace OpenSim.Region.Environment.Scenes | |||
146 | part.GroupPosition = val; | 146 | part.GroupPosition = val; |
147 | } | 147 | } |
148 | } | 148 | } |
149 | if (m_rootPart.PhysActor != null) | 149 | //if (m_rootPart.PhysActor != null) |
150 | { | 150 | //{ |
151 | m_rootPart.PhysActor.Position = | 151 | //m_rootPart.PhysActor.Position = |
152 | new PhysicsVector(m_rootPart.GroupPosition.X, m_rootPart.GroupPosition.Y, | 152 | //new PhysicsVector(m_rootPart.GroupPosition.X, m_rootPart.GroupPosition.Y, |
153 | m_rootPart.GroupPosition.Z); | 153 | //m_rootPart.GroupPosition.Z); |
154 | m_scene.PhysicsScene.AddPhysicsActorTaint(m_rootPart.PhysActor); | 154 | //m_scene.PhysicsScene.AddPhysicsActorTaint(m_rootPart.PhysActor); |
155 | } | 155 | //} |
156 | } | 156 | } |
157 | } | 157 | } |
158 | 158 | ||
@@ -844,7 +844,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
844 | } | 844 | } |
845 | return false; | 845 | return false; |
846 | } | 846 | } |
847 | 847 | ||
848 | #endregion | 848 | #endregion |
849 | 849 | ||
850 | #region Packet Handlers | 850 | #region Packet Handlers |
@@ -881,12 +881,12 @@ namespace OpenSim.Region.Environment.Scenes | |||
881 | m_parts.Add(linkPart.UUID, linkPart); | 881 | m_parts.Add(linkPart.UUID, linkPart); |
882 | linkPart.SetParent(this); | 882 | linkPart.SetParent(this); |
883 | 883 | ||
884 | if (linkPart.PhysActor != null) | 884 | //if (linkPart.PhysActor != null) |
885 | { | 885 | //{ |
886 | m_scene.PhysicsScene.RemovePrim(linkPart.PhysActor); | 886 | // m_scene.PhysicsScene.RemovePrim(linkPart.PhysActor); |
887 | 887 | ||
888 | linkPart.PhysActor = null; | 888 | //linkPart.PhysActor = null; |
889 | } | 889 | //} |
890 | 890 | ||
891 | //TODO: rest of parts | 891 | //TODO: rest of parts |
892 | foreach (SceneObjectPart part in objectGroup.Children.Values) | 892 | foreach (SceneObjectPart part in objectGroup.Children.Values) |
@@ -902,6 +902,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
902 | m_scene.DeleteEntity(objectGroup.UUID); | 902 | m_scene.DeleteEntity(objectGroup.UUID); |
903 | 903 | ||
904 | objectGroup.DeleteParts(); | 904 | objectGroup.DeleteParts(); |
905 | AbsolutePosition = AbsolutePosition; | ||
905 | ScheduleGroupForFullUpdate(); | 906 | ScheduleGroupForFullUpdate(); |
906 | } | 907 | } |
907 | 908 | ||
@@ -918,7 +919,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
918 | { | 919 | { |
919 | // Remove the part from this object | 920 | // Remove the part from this object |
920 | m_parts.Remove(linkPart.UUID); | 921 | m_parts.Remove(linkPart.UUID); |
921 | 922 | linkPart.ParentID = 0; | |
922 | // We need to reset the child part's position | 923 | // We need to reset the child part's position |
923 | // ready for life as a separate object after being a part of another object | 924 | // ready for life as a separate object after being a part of another object |
924 | Quaternion parentRot | 925 | Quaternion parentRot |
@@ -951,19 +952,19 @@ namespace OpenSim.Region.Environment.Scenes | |||
951 | // Add physics information back to delinked part if appropriate | 952 | // Add physics information back to delinked part if appropriate |
952 | // XXX This is messy and should be refactorable with the similar section in | 953 | // XXX This is messy and should be refactorable with the similar section in |
953 | // SceneObjectPart.UpdatePrimFlags() | 954 | // SceneObjectPart.UpdatePrimFlags() |
954 | if (m_rootPart.PhysActor != null) | 955 | //if (m_rootPart.PhysActor != null) |
955 | { | 956 | //{ |
956 | linkPart.PhysActor = m_scene.PhysicsScene.AddPrimShape( | 957 | //linkPart.PhysActor = m_scene.PhysicsScene.AddPrimShape( |
957 | linkPart.Name, | 958 | //linkPart.Name, |
958 | linkPart.Shape, | 959 | //linkPart.Shape, |
959 | new PhysicsVector(linkPart.AbsolutePosition.X, linkPart.AbsolutePosition.Y, | 960 | //new PhysicsVector(linkPart.AbsolutePosition.X, linkPart.AbsolutePosition.Y, |
960 | linkPart.AbsolutePosition.Z), | 961 | //linkPart.AbsolutePosition.Z), |
961 | new PhysicsVector(linkPart.Scale.X, linkPart.Scale.Y, linkPart.Scale.Z), | 962 | //new PhysicsVector(linkPart.Scale.X, linkPart.Scale.Y, linkPart.Scale.Z), |
962 | new Quaternion(linkPart.RotationOffset.W, linkPart.RotationOffset.X, | 963 | //new Quaternion(linkPart.RotationOffset.W, linkPart.RotationOffset.X, |
963 | linkPart.RotationOffset.Y, linkPart.RotationOffset.Z), | 964 | //linkPart.RotationOffset.Y, linkPart.RotationOffset.Z), |
964 | m_rootPart.PhysActor.IsPhysical); | 965 | //m_rootPart.PhysActor.IsPhysical); |
965 | m_rootPart.DoPhysicsPropertyUpdate(m_rootPart.PhysActor.IsPhysical, true); | 966 | //m_rootPart.DoPhysicsPropertyUpdate(m_rootPart.PhysActor.IsPhysical, true); |
966 | } | 967 | //} |
967 | 968 | ||
968 | SceneObjectGroup objectGroup = new SceneObjectGroup(m_scene, m_regionHandle, linkPart); | 969 | SceneObjectGroup objectGroup = new SceneObjectGroup(m_scene, m_regionHandle, linkPart); |
969 | 970 | ||
@@ -1139,7 +1140,18 @@ namespace OpenSim.Region.Environment.Scenes | |||
1139 | SceneObjectPart part = GetChildPart(localID); | 1140 | SceneObjectPart part = GetChildPart(localID); |
1140 | if (part != null) | 1141 | if (part != null) |
1141 | { | 1142 | { |
1142 | part.UpdatePrimFlags(type, inUse, data); | 1143 | // If we have children |
1144 | if (m_parts.Count > 1) | ||
1145 | { | ||
1146 | foreach (SceneObjectPart parts in m_parts.Values) | ||
1147 | { | ||
1148 | parts.UpdatePrimFlags(type, inUse, data); | ||
1149 | } | ||
1150 | } | ||
1151 | else | ||
1152 | { | ||
1153 | part.UpdatePrimFlags(type, inUse, data); | ||
1154 | } | ||
1143 | } | 1155 | } |
1144 | } | 1156 | } |
1145 | 1157 | ||
@@ -1639,7 +1651,17 @@ namespace OpenSim.Region.Environment.Scenes | |||
1639 | 1651 | ||
1640 | public void ApplyPhysics() | 1652 | public void ApplyPhysics() |
1641 | { | 1653 | { |
1642 | m_rootPart.ApplyPhysics(); | 1654 | if (m_parts.Count > 1) |
1655 | { | ||
1656 | foreach (SceneObjectPart parts in m_parts.Values) | ||
1657 | { | ||
1658 | parts.ApplyPhysics(); | ||
1659 | } | ||
1660 | } | ||
1661 | else | ||
1662 | { | ||
1663 | m_rootPart.ApplyPhysics(); | ||
1664 | } | ||
1643 | } | 1665 | } |
1644 | } | 1666 | } |
1645 | } | 1667 | } |