diff options
author | Teravus Ovares | 2007-11-16 08:53:37 +0000 |
---|---|---|
committer | Teravus Ovares | 2007-11-16 08:53:37 +0000 |
commit | b63076c303c380ac119cb608499b9ac54d524f05 (patch) | |
tree | a40395caef9d3b9bd0a24773e9b65bc10928fd3e /OpenSim/Region/Environment/Scenes | |
parent | * Fixed object edit movements causing full object updates instead of terse ob... (diff) | |
download | opensim-SC-b63076c303c380ac119cb608499b9ac54d524f05.zip opensim-SC-b63076c303c380ac119cb608499b9ac54d524f05.tar.gz opensim-SC-b63076c303c380ac119cb608499b9ac54d524f05.tar.bz2 opensim-SC-b63076c303c380ac119cb608499b9ac54d524f05.tar.xz |
* ODE step two on the way to separate dynamic space allocation ( One more to go )
Diffstat (limited to 'OpenSim/Region/Environment/Scenes')
-rw-r--r-- | OpenSim/Region/Environment/Scenes/SceneObjectPart.cs | 54 |
1 files changed, 48 insertions, 6 deletions
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs index 727ebb0..20c8517 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs | |||
@@ -806,6 +806,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
806 | bool IsTemporary = false; | 806 | bool IsTemporary = false; |
807 | bool IsPhantom = false; | 807 | bool IsPhantom = false; |
808 | bool CastsShadows = false; | 808 | bool CastsShadows = false; |
809 | bool wasUsingPhysics = ((ObjectFlags & (uint)LLObject.ObjectFlags.Physics) != 0); | ||
809 | //bool IsLocked = false; | 810 | //bool IsLocked = false; |
810 | int i = 0; | 811 | int i = 0; |
811 | 812 | ||
@@ -829,19 +830,24 @@ namespace OpenSim.Region.Environment.Scenes | |||
829 | if (UsePhysics ) | 830 | if (UsePhysics ) |
830 | { | 831 | { |
831 | AddFlag(LLObject.ObjectFlags.Physics); | 832 | AddFlag(LLObject.ObjectFlags.Physics); |
832 | if (PhysActor != null) | 833 | if (!wasUsingPhysics) |
833 | PhysActor.OnRequestTerseUpdate += PhysicsRequestingTerseUpdate; | 834 | { |
835 | doPhysicsPropertyUpdate(UsePhysics); | ||
836 | } | ||
834 | 837 | ||
835 | } | 838 | } |
836 | else | 839 | else |
837 | { | 840 | { |
838 | if (m_parentGroup.m_scene.m_physicalPrim) | 841 | RemFlag(LLObject.ObjectFlags.Physics); |
842 | if (wasUsingPhysics) | ||
839 | { | 843 | { |
840 | RemFlag(LLObject.ObjectFlags.Physics); | 844 | doPhysicsPropertyUpdate(UsePhysics); |
841 | if (PhysActor != null) | ||
842 | PhysActor.OnRequestTerseUpdate -= PhysicsRequestingTerseUpdate; | ||
843 | } | 845 | } |
844 | } | 846 | } |
847 | |||
848 | |||
849 | |||
850 | |||
845 | 851 | ||
846 | if (IsPhantom) | 852 | if (IsPhantom) |
847 | { | 853 | { |
@@ -884,6 +890,35 @@ namespace OpenSim.Region.Environment.Scenes | |||
884 | // System.Console.WriteLine("Update: PHY:" + UsePhysics.ToString() + ", T:" + IsTemporary.ToString() + ", PHA:" + IsPhantom.ToString() + " S:" + CastsShadows.ToString()); | 890 | // System.Console.WriteLine("Update: PHY:" + UsePhysics.ToString() + ", T:" + IsTemporary.ToString() + ", PHA:" + IsPhantom.ToString() + " S:" + CastsShadows.ToString()); |
885 | ScheduleFullUpdate(); | 891 | ScheduleFullUpdate(); |
886 | } | 892 | } |
893 | private void doPhysicsPropertyUpdate(bool UsePhysics) | ||
894 | { | ||
895 | if (PhysActor != null) | ||
896 | { | ||
897 | if (PhysActor.IsPhysical) | ||
898 | { | ||
899 | PhysActor.OnRequestTerseUpdate -= PhysicsRequestingTerseUpdate; | ||
900 | PhysActor.OnOutOfBounds -= PhysicsOutOfBounds; | ||
901 | } | ||
902 | m_parentGroup.m_scene.PhysScene.RemovePrim(PhysActor); | ||
903 | /// that's not wholesome. Had to make m_scene public | ||
904 | PhysActor = null; | ||
905 | |||
906 | PhysActor = m_parentGroup.m_scene.PhysScene.AddPrimShape( | ||
907 | Name, | ||
908 | Shape, | ||
909 | new PhysicsVector(AbsolutePosition.X, AbsolutePosition.Y, | ||
910 | AbsolutePosition.Z), | ||
911 | new PhysicsVector(Scale.X, Scale.Y, Scale.Z), | ||
912 | new Quaternion(RotationOffset.W, RotationOffset.X, | ||
913 | RotationOffset.Y, RotationOffset.Z), UsePhysics); | ||
914 | if (UsePhysics) | ||
915 | { | ||
916 | PhysActor.OnRequestTerseUpdate += PhysicsRequestingTerseUpdate; | ||
917 | PhysActor.OnOutOfBounds += PhysicsOutOfBounds; | ||
918 | } | ||
919 | } | ||
920 | |||
921 | } | ||
887 | 922 | ||
888 | public void UpdateExtraParam(ushort type, bool inUse, byte[] data) | 923 | public void UpdateExtraParam(ushort type, bool inUse, byte[] data) |
889 | { | 924 | { |
@@ -1130,6 +1165,13 @@ namespace OpenSim.Region.Environment.Scenes | |||
1130 | } | 1165 | } |
1131 | #endregion | 1166 | #endregion |
1132 | 1167 | ||
1168 | public void PhysicsOutOfBounds(PhysicsVector pos) | ||
1169 | { | ||
1170 | OpenSim.Framework.Console.MainLog.Instance.Verbose("PHYSICS", "Physical Object went out of bounds."); | ||
1171 | doPhysicsPropertyUpdate(false); | ||
1172 | ScheduleFullUpdate(); | ||
1173 | } | ||
1174 | |||
1133 | 1175 | ||
1134 | public virtual void OnGrab(LLVector3 offsetPos, IClientAPI remoteClient) | 1176 | public virtual void OnGrab(LLVector3 offsetPos, IClientAPI remoteClient) |
1135 | { | 1177 | { |