diff options
Diffstat (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSShapes.cs')
-rwxr-xr-x | OpenSim/Region/Physics/BulletSPlugin/BSShapes.cs | 45 |
1 files changed, 37 insertions, 8 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSShapes.cs b/OpenSim/Region/Physics/BulletSPlugin/BSShapes.cs index 1008184..f89c52f 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSShapes.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSShapes.cs | |||
@@ -117,11 +117,11 @@ public abstract class BSShape | |||
117 | StringBuilder buff = new StringBuilder(); | 117 | StringBuilder buff = new StringBuilder(); |
118 | if (physShapeInfo == null) | 118 | if (physShapeInfo == null) |
119 | { | 119 | { |
120 | buff.Append(",noPhys"); | 120 | buff.Append("<noPhys"); |
121 | } | 121 | } |
122 | else | 122 | else |
123 | { | 123 | { |
124 | buff.Append(",phy="); | 124 | buff.Append("<phy="); |
125 | buff.Append(physShapeInfo.ToString()); | 125 | buff.Append(physShapeInfo.ToString()); |
126 | } | 126 | } |
127 | buff.Append(",c="); | 127 | buff.Append(",c="); |
@@ -810,17 +810,25 @@ public class BSShapeCompound : BSShape | |||
810 | } | 810 | } |
811 | else | 811 | else |
812 | { | 812 | { |
813 | if (physicsScene.PE.IsCompound(pShape)) | 813 | BSShapeConvexHull chullDesc; |
814 | if (BSShapeConvexHull.TryGetHullByPtr(pShape, out chullDesc)) | ||
814 | { | 815 | { |
815 | BSShapeCompound recursiveCompound = new BSShapeCompound(pShape); | 816 | chullDesc.Dereference(physicsScene); |
816 | recursiveCompound.Dereference(physicsScene); | ||
817 | } | 817 | } |
818 | else | 818 | else |
819 | { | 819 | { |
820 | if (physicsScene.PE.IsNativeShape(pShape)) | 820 | if (physicsScene.PE.IsCompound(pShape)) |
821 | { | 821 | { |
822 | BSShapeNative nativeShape = new BSShapeNative(pShape); | 822 | BSShapeCompound recursiveCompound = new BSShapeCompound(pShape); |
823 | nativeShape.Dereference(physicsScene); | 823 | recursiveCompound.Dereference(physicsScene); |
824 | } | ||
825 | else | ||
826 | { | ||
827 | if (physicsScene.PE.IsNativeShape(pShape)) | ||
828 | { | ||
829 | BSShapeNative nativeShape = new BSShapeNative(pShape); | ||
830 | nativeShape.Dereference(physicsScene); | ||
831 | } | ||
824 | } | 832 | } |
825 | } | 833 | } |
826 | } | 834 | } |
@@ -900,6 +908,27 @@ public class BSShapeConvexHull : BSShape | |||
900 | // TODO: schedule aging and destruction of unused meshes. | 908 | // TODO: schedule aging and destruction of unused meshes. |
901 | } | 909 | } |
902 | } | 910 | } |
911 | // Loop through all the known hulls and return the description based on the physical address. | ||
912 | public static bool TryGetHullByPtr(BulletShape pShape, out BSShapeConvexHull outHull) | ||
913 | { | ||
914 | bool ret = false; | ||
915 | BSShapeConvexHull foundDesc = null; | ||
916 | lock (ConvexHulls) | ||
917 | { | ||
918 | foreach (BSShapeConvexHull sh in ConvexHulls.Values) | ||
919 | { | ||
920 | if (sh.physShapeInfo.ReferenceSame(pShape)) | ||
921 | { | ||
922 | foundDesc = sh; | ||
923 | ret = true; | ||
924 | break; | ||
925 | } | ||
926 | |||
927 | } | ||
928 | } | ||
929 | outHull = foundDesc; | ||
930 | return ret; | ||
931 | } | ||
903 | } | 932 | } |
904 | 933 | ||
905 | // ============================================================================================================ | 934 | // ============================================================================================================ |