diff options
Diffstat (limited to '')
-rwxr-xr-x | OpenSim/Region/PhysicsModules/BulletS/BulletSimData.cs (renamed from OpenSim/Region/Physics/BulletSPlugin/BulletSimData.cs) | 72 |
1 files changed, 43 insertions, 29 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BulletSimData.cs b/OpenSim/Region/PhysicsModules/BulletS/BulletSimData.cs index 662dd68..3329395 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BulletSimData.cs +++ b/OpenSim/Region/PhysicsModules/BulletS/BulletSimData.cs | |||
@@ -29,7 +29,7 @@ using System.Collections.Generic; | |||
29 | using System.Text; | 29 | using System.Text; |
30 | using OMV = OpenMetaverse; | 30 | using OMV = OpenMetaverse; |
31 | 31 | ||
32 | namespace OpenSim.Region.Physics.BulletSPlugin | 32 | namespace OpenSim.Region.PhysicsModule.BulletS |
33 | { | 33 | { |
34 | // Classes to allow some type checking for the API | 34 | // Classes to allow some type checking for the API |
35 | // These hold pointers to allocated objects in the unmanaged space. | 35 | // These hold pointers to allocated objects in the unmanaged space. |
@@ -104,18 +104,20 @@ public class BulletShape | |||
104 | { | 104 | { |
105 | public BulletShape() | 105 | public BulletShape() |
106 | { | 106 | { |
107 | type = BSPhysicsShapeType.SHAPE_UNKNOWN; | 107 | shapeType = BSPhysicsShapeType.SHAPE_UNKNOWN; |
108 | shapeKey = (System.UInt64)FixedShapeKey.KEY_NONE; | 108 | shapeKey = (System.UInt64)FixedShapeKey.KEY_NONE; |
109 | isNativeShape = false; | 109 | isNativeShape = false; |
110 | } | 110 | } |
111 | public BSPhysicsShapeType type; | 111 | public BSPhysicsShapeType shapeType; |
112 | public System.UInt64 shapeKey; | 112 | public System.UInt64 shapeKey; |
113 | public bool isNativeShape; | 113 | public bool isNativeShape; |
114 | 114 | ||
115 | public virtual void Clear() { } | 115 | public virtual void Clear() { } |
116 | public virtual bool HasPhysicalShape { get { return false; } } | 116 | public virtual bool HasPhysicalShape { get { return false; } } |
117 | |||
117 | // Make another reference to this physical object. | 118 | // Make another reference to this physical object. |
118 | public virtual BulletShape Clone() { return new BulletShape(); } | 119 | public virtual BulletShape Clone() { return new BulletShape(); } |
120 | |||
119 | // Return 'true' if this and other refer to the same physical object | 121 | // Return 'true' if this and other refer to the same physical object |
120 | public virtual bool ReferenceSame(BulletShape xx) { return false; } | 122 | public virtual bool ReferenceSame(BulletShape xx) { return false; } |
121 | 123 | ||
@@ -131,7 +133,7 @@ public class BulletShape | |||
131 | buff.Append("<p="); | 133 | buff.Append("<p="); |
132 | buff.Append(AddrString); | 134 | buff.Append(AddrString); |
133 | buff.Append(",s="); | 135 | buff.Append(",s="); |
134 | buff.Append(type.ToString()); | 136 | buff.Append(shapeType.ToString()); |
135 | buff.Append(",k="); | 137 | buff.Append(",k="); |
136 | buff.Append(shapeKey.ToString("X")); | 138 | buff.Append(shapeKey.ToString("X")); |
137 | buff.Append(",n="); | 139 | buff.Append(",n="); |
@@ -163,14 +165,15 @@ public class BulletConstraint | |||
163 | // than making copies. | 165 | // than making copies. |
164 | public class BulletHMapInfo | 166 | public class BulletHMapInfo |
165 | { | 167 | { |
166 | public BulletHMapInfo(uint id, float[] hm) { | 168 | public BulletHMapInfo(uint id, float[] hm, float pSizeX, float pSizeY) { |
167 | ID = id; | 169 | ID = id; |
168 | heightMap = hm; | 170 | heightMap = hm; |
169 | terrainRegionBase = OMV.Vector3.Zero; | 171 | terrainRegionBase = OMV.Vector3.Zero; |
170 | minCoords = new OMV.Vector3(100f, 100f, 25f); | 172 | minCoords = new OMV.Vector3(100f, 100f, 25f); |
171 | maxCoords = new OMV.Vector3(101f, 101f, 26f); | 173 | maxCoords = new OMV.Vector3(101f, 101f, 26f); |
172 | minZ = maxZ = 0f; | 174 | minZ = maxZ = 0f; |
173 | sizeX = sizeY = 256f; | 175 | sizeX = pSizeX; |
176 | sizeY = pSizeY; | ||
174 | } | 177 | } |
175 | public uint ID; | 178 | public uint ID; |
176 | public float[] heightMap; | 179 | public float[] heightMap; |
@@ -187,6 +190,7 @@ public class BulletHMapInfo | |||
187 | public enum CollisionType | 190 | public enum CollisionType |
188 | { | 191 | { |
189 | Avatar, | 192 | Avatar, |
193 | PhantomToOthersAvatar, // An avatar that it phantom to other avatars but not to anything else | ||
190 | Groundplane, | 194 | Groundplane, |
191 | Terrain, | 195 | Terrain, |
192 | Static, | 196 | Static, |
@@ -215,45 +219,55 @@ public static class BulletSimData | |||
215 | { | 219 | { |
216 | 220 | ||
217 | // Map of collisionTypes to flags for collision groups and masks. | 221 | // Map of collisionTypes to flags for collision groups and masks. |
222 | // An object's 'group' is the collison groups this object belongs to | ||
223 | // An object's 'filter' is the groups another object has to belong to in order to collide with me | ||
224 | // A collision happens if ((obj1.group & obj2.filter) != 0) || ((obj2.group & obj1.filter) != 0) | ||
225 | // | ||
218 | // As mentioned above, don't use the CollisionFilterGroups definitions directly in the code | 226 | // As mentioned above, don't use the CollisionFilterGroups definitions directly in the code |
219 | // but, instead, use references to this dictionary. Finding and debugging | 227 | // but, instead, use references to this dictionary. Finding and debugging |
220 | // collision flag problems will be made easier. | 228 | // collision flag problems will be made easier. |
221 | public static Dictionary<CollisionType, CollisionTypeFilterGroup> CollisionTypeMasks | 229 | public static Dictionary<CollisionType, CollisionTypeFilterGroup> CollisionTypeMasks |
222 | = new Dictionary<CollisionType, CollisionTypeFilterGroup>() | 230 | = new Dictionary<CollisionType, CollisionTypeFilterGroup>() |
223 | { | 231 | { |
224 | { CollisionType.Avatar, | 232 | { CollisionType.Avatar, |
225 | new CollisionTypeFilterGroup(CollisionType.Avatar, | 233 | new CollisionTypeFilterGroup(CollisionType.Avatar, |
226 | (uint)CollisionFilterGroups.BCharacterGroup, | 234 | (uint)CollisionFilterGroups.BCharacterGroup, |
227 | (uint)CollisionFilterGroups.BAllGroup) | 235 | (uint)(CollisionFilterGroups.BAllGroup)) |
228 | }, | 236 | }, |
229 | { CollisionType.Groundplane, | 237 | { CollisionType.PhantomToOthersAvatar, |
230 | new CollisionTypeFilterGroup(CollisionType.Groundplane, | 238 | new CollisionTypeFilterGroup(CollisionType.PhantomToOthersAvatar, |
231 | (uint)CollisionFilterGroups.BGroundPlaneGroup, | 239 | (uint)CollisionFilterGroups.BCharacterGroup, |
232 | (uint)CollisionFilterGroups.BAllGroup) | 240 | (uint)(CollisionFilterGroups.BAllGroup & ~CollisionFilterGroups.BCharacterGroup)) |
241 | }, | ||
242 | { CollisionType.Groundplane, | ||
243 | new CollisionTypeFilterGroup(CollisionType.Groundplane, | ||
244 | (uint)CollisionFilterGroups.BGroundPlaneGroup, | ||
245 | // (uint)CollisionFilterGroups.BAllGroup) | ||
246 | (uint)(CollisionFilterGroups.BCharacterGroup | CollisionFilterGroups.BSolidGroup)) | ||
233 | }, | 247 | }, |
234 | { CollisionType.Terrain, | 248 | { CollisionType.Terrain, |
235 | new CollisionTypeFilterGroup(CollisionType.Terrain, | 249 | new CollisionTypeFilterGroup(CollisionType.Terrain, |
236 | (uint)CollisionFilterGroups.BTerrainGroup, | 250 | (uint)CollisionFilterGroups.BTerrainGroup, |
237 | (uint)(CollisionFilterGroups.BAllGroup & ~CollisionFilterGroups.BStaticGroup)) | 251 | (uint)(CollisionFilterGroups.BAllGroup & ~CollisionFilterGroups.BStaticGroup)) |
238 | }, | 252 | }, |
239 | { CollisionType.Static, | 253 | { CollisionType.Static, |
240 | new CollisionTypeFilterGroup(CollisionType.Static, | 254 | new CollisionTypeFilterGroup(CollisionType.Static, |
241 | (uint)CollisionFilterGroups.BStaticGroup, | 255 | (uint)CollisionFilterGroups.BStaticGroup, |
242 | (uint)(CollisionFilterGroups.BCharacterGroup | CollisionFilterGroups.BSolidGroup)) | 256 | (uint)(CollisionFilterGroups.BCharacterGroup | CollisionFilterGroups.BSolidGroup)) |
243 | }, | 257 | }, |
244 | { CollisionType.Dynamic, | 258 | { CollisionType.Dynamic, |
245 | new CollisionTypeFilterGroup(CollisionType.Dynamic, | 259 | new CollisionTypeFilterGroup(CollisionType.Dynamic, |
246 | (uint)CollisionFilterGroups.BSolidGroup, | 260 | (uint)CollisionFilterGroups.BSolidGroup, |
247 | (uint)(CollisionFilterGroups.BAllGroup)) | 261 | (uint)(CollisionFilterGroups.BAllGroup)) |
248 | }, | 262 | }, |
249 | { CollisionType.VolumeDetect, | 263 | { CollisionType.VolumeDetect, |
250 | new CollisionTypeFilterGroup(CollisionType.VolumeDetect, | 264 | new CollisionTypeFilterGroup(CollisionType.VolumeDetect, |
251 | (uint)CollisionFilterGroups.BSensorTrigger, | 265 | (uint)CollisionFilterGroups.BSensorTrigger, |
252 | (uint)(~CollisionFilterGroups.BSensorTrigger)) | 266 | (uint)(~CollisionFilterGroups.BSensorTrigger)) |
253 | }, | 267 | }, |
254 | { CollisionType.LinksetChild, | 268 | { CollisionType.LinksetChild, |
255 | new CollisionTypeFilterGroup(CollisionType.LinksetChild, | 269 | new CollisionTypeFilterGroup(CollisionType.LinksetChild, |
256 | (uint)CollisionFilterGroups.BLinksetChildGroup, | 270 | (uint)CollisionFilterGroups.BLinksetChildGroup, |
257 | (uint)(CollisionFilterGroups.BNoneGroup)) | 271 | (uint)(CollisionFilterGroups.BNoneGroup)) |
258 | // (uint)(CollisionFilterGroups.BCharacterGroup | CollisionFilterGroups.BSolidGroup)) | 272 | // (uint)(CollisionFilterGroups.BCharacterGroup | CollisionFilterGroups.BSolidGroup)) |
259 | }, | 273 | }, |