diff options
Diffstat (limited to 'OpenSim/Region/Physics')
12 files changed, 94 insertions, 33 deletions
diff --git a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsActor.cs b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsActor.cs index e43136a..0d17e0e 100644 --- a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsActor.cs +++ b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsActor.cs | |||
@@ -118,14 +118,7 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin | |||
118 | 118 | ||
119 | public override Vector3 Position { get; set; } | 119 | public override Vector3 Position { get; set; } |
120 | 120 | ||
121 | public override Vector3 Size | 121 | public override Vector3 Size { get; set; } |
122 | { | ||
123 | get { return _size; } | ||
124 | set { | ||
125 | _size = value; | ||
126 | _size.Z = _size.Z / 2.0f; | ||
127 | } | ||
128 | } | ||
129 | 122 | ||
130 | public override PrimitiveBaseShape Shape | 123 | public override PrimitiveBaseShape Shape |
131 | { | 124 | { |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSAPIXNA.cs b/OpenSim/Region/Physics/BulletSPlugin/BSAPIXNA.cs index 17ebed2..aca1ed4 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSAPIXNA.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSAPIXNA.cs | |||
@@ -1311,7 +1311,7 @@ private sealed class BulletConstraintXNA : BulletConstraint | |||
1311 | /* TODO */ | 1311 | /* TODO */ |
1312 | ConfigurationParameters[] configparms = new ConfigurationParameters[1]; | 1312 | ConfigurationParameters[] configparms = new ConfigurationParameters[1]; |
1313 | configparms[0] = parms; | 1313 | configparms[0] = parms; |
1314 | Vector3 worldExtent = new Vector3(Constants.RegionSize, Constants.RegionSize, Constants.RegionHeight); | 1314 | Vector3 worldExtent = maxPosition; |
1315 | m_maxCollisions = maxCollisions; | 1315 | m_maxCollisions = maxCollisions; |
1316 | m_maxUpdatesPerFrame = maxUpdates; | 1316 | m_maxUpdatesPerFrame = maxUpdates; |
1317 | specialCollisionObjects = new Dictionary<uint, GhostObject>(); | 1317 | specialCollisionObjects = new Dictionary<uint, GhostObject>(); |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs b/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs index 7b98f9d..0722d70 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs | |||
@@ -1011,8 +1011,13 @@ namespace OpenSim.Region.Physics.BulletSPlugin | |||
1011 | VDetailLog("{0}, MoveLinear,clampMax,origVelW={1},lenSq={2},maxVelSq={3},,newVelW={4}", | 1011 | VDetailLog("{0}, MoveLinear,clampMax,origVelW={1},lenSq={2},maxVelSq={3},,newVelW={4}", |
1012 | ControllingPrim.LocalID, origVelW, newVelocityLengthSq, BSParam.VehicleMaxLinearVelocitySquared, VehicleVelocity); | 1012 | ControllingPrim.LocalID, origVelW, newVelocityLengthSq, BSParam.VehicleMaxLinearVelocitySquared, VehicleVelocity); |
1013 | } | 1013 | } |
1014 | else if (newVelocityLengthSq < 0.001f) | 1014 | else if (newVelocityLengthSq < BSParam.VehicleMinLinearVelocitySquared) |
1015 | { | ||
1016 | Vector3 origVelW = VehicleVelocity; // DEBUG DEBUG | ||
1017 | VDetailLog("{0}, MoveLinear,clampMin,origVelW={1},lenSq={2}", | ||
1018 | ControllingPrim.LocalID, origVelW, newVelocityLengthSq); | ||
1015 | VehicleVelocity = Vector3.Zero; | 1019 | VehicleVelocity = Vector3.Zero; |
1020 | } | ||
1016 | 1021 | ||
1017 | VDetailLog("{0}, MoveLinear,done,isColl={1},newVel={2}", ControllingPrim.LocalID, ControllingPrim.HasSomeCollision, VehicleVelocity ); | 1022 | VDetailLog("{0}, MoveLinear,done,isColl={1},newVel={2}", ControllingPrim.LocalID, ControllingPrim.HasSomeCollision, VehicleVelocity ); |
1018 | 1023 | ||
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs index 834228e..860193f 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs | |||
@@ -147,6 +147,8 @@ public static class BSParam | |||
147 | // Vehicle parameters | 147 | // Vehicle parameters |
148 | public static float VehicleMaxLinearVelocity { get; private set; } | 148 | public static float VehicleMaxLinearVelocity { get; private set; } |
149 | public static float VehicleMaxLinearVelocitySquared { get; private set; } | 149 | public static float VehicleMaxLinearVelocitySquared { get; private set; } |
150 | public static float VehicleMinLinearVelocity { get; private set; } | ||
151 | public static float VehicleMinLinearVelocitySquared { get; private set; } | ||
150 | public static float VehicleMaxAngularVelocity { get; private set; } | 152 | public static float VehicleMaxAngularVelocity { get; private set; } |
151 | public static float VehicleMaxAngularVelocitySq { get; private set; } | 153 | public static float VehicleMaxAngularVelocitySq { get; private set; } |
152 | public static float VehicleAngularDamping { get; private set; } | 154 | public static float VehicleAngularDamping { get; private set; } |
@@ -538,7 +540,7 @@ public static class BSParam | |||
538 | (s,o) => { s.PE.SetContactProcessingThreshold(o.PhysBody, ContactProcessingThreshold); } ), | 540 | (s,o) => { s.PE.SetContactProcessingThreshold(o.PhysBody, ContactProcessingThreshold); } ), |
539 | 541 | ||
540 | new ParameterDefn<float>("TerrainImplementation", "Type of shape to use for terrain (0=heightmap, 1=mesh)", | 542 | new ParameterDefn<float>("TerrainImplementation", "Type of shape to use for terrain (0=heightmap, 1=mesh)", |
541 | (float)BSTerrainPhys.TerrainImplementation.Mesh ), | 543 | (float)BSTerrainPhys.TerrainImplementation.Heightmap ), |
542 | new ParameterDefn<int>("TerrainMeshMagnification", "Number of times the 256x256 heightmap is multiplied to create the terrain mesh" , | 544 | new ParameterDefn<int>("TerrainMeshMagnification", "Number of times the 256x256 heightmap is multiplied to create the terrain mesh" , |
543 | 2 ), | 545 | 2 ), |
544 | new ParameterDefn<float>("TerrainFriction", "Factor to reduce movement against terrain surface" , | 546 | new ParameterDefn<float>("TerrainFriction", "Factor to reduce movement against terrain surface" , |
@@ -598,6 +600,10 @@ public static class BSParam | |||
598 | 1000.0f, | 600 | 1000.0f, |
599 | (s) => { return (float)VehicleMaxLinearVelocity; }, | 601 | (s) => { return (float)VehicleMaxLinearVelocity; }, |
600 | (s,v) => { VehicleMaxLinearVelocity = v; VehicleMaxLinearVelocitySquared = v * v; } ), | 602 | (s,v) => { VehicleMaxLinearVelocity = v; VehicleMaxLinearVelocitySquared = v * v; } ), |
603 | new ParameterDefn<float>("VehicleMinLinearVelocity", "Maximum velocity magnitude that can be assigned to a vehicle", | ||
604 | 0.001f, | ||
605 | (s) => { return (float)VehicleMinLinearVelocity; }, | ||
606 | (s,v) => { VehicleMinLinearVelocity = v; VehicleMinLinearVelocitySquared = v * v; } ), | ||
601 | new ParameterDefn<float>("VehicleMaxAngularVelocity", "Maximum rotational velocity magnitude that can be assigned to a vehicle", | 607 | new ParameterDefn<float>("VehicleMaxAngularVelocity", "Maximum rotational velocity magnitude that can be assigned to a vehicle", |
602 | 12.0f, | 608 | 12.0f, |
603 | (s) => { return (float)VehicleMaxAngularVelocity; }, | 609 | (s) => { return (float)VehicleMaxAngularVelocity; }, |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs index 15b7090..edec949 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs | |||
@@ -376,18 +376,19 @@ public class BSPrim : BSPhysObject | |||
376 | { | 376 | { |
377 | bool ret = false; | 377 | bool ret = false; |
378 | 378 | ||
379 | uint wayOutThere = Constants.RegionSize * Constants.RegionSize; | 379 | int wayOverThere = -1000; |
380 | int wayOutThere = 10000; | ||
380 | // There have been instances of objects getting thrown way out of bounds and crashing | 381 | // There have been instances of objects getting thrown way out of bounds and crashing |
381 | // the border crossing code. | 382 | // the border crossing code. |
382 | if ( RawPosition.X < -Constants.RegionSize || RawPosition.X > wayOutThere | 383 | if ( RawPosition.X < wayOverThere || RawPosition.X > wayOutThere |
383 | || RawPosition.Y < -Constants.RegionSize || RawPosition.Y > wayOutThere | 384 | || RawPosition.Y < wayOverThere || RawPosition.X > wayOutThere |
384 | || RawPosition.Z < -Constants.RegionSize || RawPosition.Z > wayOutThere) | 385 | || RawPosition.Z < wayOverThere || RawPosition.X > wayOutThere) |
385 | { | 386 | { |
386 | RawPosition = new OMV.Vector3(10, 10, 50); | 387 | RawPosition = new OMV.Vector3(10, 10, 50); |
387 | ZeroMotion(inTaintTime); | 388 | ZeroMotion(inTaintTime); |
388 | ret = true; | 389 | ret = true; |
389 | } | 390 | } |
390 | if (RawVelocity.LengthSquared() > BSParam.MaxLinearVelocity) | 391 | if (RawVelocity.LengthSquared() > BSParam.MaxLinearVelocitySquared) |
391 | { | 392 | { |
392 | RawVelocity = Util.ClampV(RawVelocity, BSParam.MaxLinearVelocity); | 393 | RawVelocity = Util.ClampV(RawVelocity, BSParam.MaxLinearVelocity); |
393 | ret = true; | 394 | ret = true; |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs index b3dfa41..2d2e55f 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs | |||
@@ -208,8 +208,17 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters | |||
208 | Name = EngineType + "/" + RegionName; | 208 | Name = EngineType + "/" + RegionName; |
209 | } | 209 | } |
210 | 210 | ||
211 | // Old version of initialization that assumes legacy sized regions (256x256) | ||
211 | public override void Initialise(IMesher meshmerizer, IConfigSource config) | 212 | public override void Initialise(IMesher meshmerizer, IConfigSource config) |
212 | { | 213 | { |
214 | m_log.ErrorFormat("{0} WARNING WARNING WARNING! BulletSim initialized without region extent specification. Terrain will be messed up."); | ||
215 | Vector3 regionExtent = new Vector3( Constants.RegionSize, Constants.RegionSize, Constants.RegionSize); | ||
216 | Initialise(meshmerizer, config, regionExtent); | ||
217 | |||
218 | } | ||
219 | |||
220 | public override void Initialise(IMesher meshmerizer, IConfigSource config, Vector3 regionExtent) | ||
221 | { | ||
213 | mesher = meshmerizer; | 222 | mesher = meshmerizer; |
214 | _taintOperations = new List<TaintCallbackEntry>(); | 223 | _taintOperations = new List<TaintCallbackEntry>(); |
215 | _postTaintOperations = new Dictionary<string, TaintCallbackEntry>(); | 224 | _postTaintOperations = new Dictionary<string, TaintCallbackEntry>(); |
@@ -226,6 +235,14 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters | |||
226 | // Set default values for physics parameters plus any overrides from the ini file | 235 | // Set default values for physics parameters plus any overrides from the ini file |
227 | GetInitialParameterValues(config); | 236 | GetInitialParameterValues(config); |
228 | 237 | ||
238 | // Force some parameters to values depending on other configurations | ||
239 | // Only use heightmap terrain implementation if terrain larger than legacy size | ||
240 | if ((uint)regionExtent.X > Constants.RegionSize || (uint)regionExtent.Y > Constants.RegionSize) | ||
241 | { | ||
242 | m_log.WarnFormat("{0} Forcing terrain implementation to heightmap for large region", LogHeader); | ||
243 | BSParam.TerrainImplementation = (float)BSTerrainPhys.TerrainImplementation.Heightmap; | ||
244 | } | ||
245 | |||
229 | // Get the connection to the physics engine (could be native or one of many DLLs) | 246 | // Get the connection to the physics engine (could be native or one of many DLLs) |
230 | PE = SelectUnderlyingBulletEngine(BulletEngineName); | 247 | PE = SelectUnderlyingBulletEngine(BulletEngineName); |
231 | 248 | ||
@@ -250,13 +267,13 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters | |||
250 | // a child in a mega-region. | 267 | // a child in a mega-region. |
251 | // Bullet actually doesn't care about the extents of the simulated | 268 | // Bullet actually doesn't care about the extents of the simulated |
252 | // area. It tracks active objects no matter where they are. | 269 | // area. It tracks active objects no matter where they are. |
253 | Vector3 worldExtent = new Vector3(Constants.RegionSize, Constants.RegionSize, Constants.RegionHeight); | 270 | Vector3 worldExtent = regionExtent; |
254 | 271 | ||
255 | World = PE.Initialize(worldExtent, Params, m_maxCollisionsPerFrame, ref m_collisionArray, m_maxUpdatesPerFrame, ref m_updateArray); | 272 | World = PE.Initialize(worldExtent, Params, m_maxCollisionsPerFrame, ref m_collisionArray, m_maxUpdatesPerFrame, ref m_updateArray); |
256 | 273 | ||
257 | Constraints = new BSConstraintCollection(World); | 274 | Constraints = new BSConstraintCollection(World); |
258 | 275 | ||
259 | TerrainManager = new BSTerrainManager(this); | 276 | TerrainManager = new BSTerrainManager(this, worldExtent); |
260 | TerrainManager.CreateInitialGroundPlaneAndTerrain(); | 277 | TerrainManager.CreateInitialGroundPlaneAndTerrain(); |
261 | 278 | ||
262 | // Put some informational messages into the log file. | 279 | // Put some informational messages into the log file. |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSShapes.cs b/OpenSim/Region/Physics/BulletSPlugin/BSShapes.cs index 006a9c1..fbe320b 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSShapes.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSShapes.cs | |||
@@ -71,7 +71,7 @@ public abstract class BSShape | |||
71 | lastReferenced = DateTime.Now; | 71 | lastReferenced = DateTime.Now; |
72 | } | 72 | } |
73 | 73 | ||
74 | // Called when this shape is being used again. | 74 | // Called when this shape is done being used. |
75 | protected virtual void DecrementReference() | 75 | protected virtual void DecrementReference() |
76 | { | 76 | { |
77 | referenceCount--; | 77 | referenceCount--; |
@@ -866,6 +866,8 @@ public class BSShapeHull : BSShape | |||
866 | public class BSShapeCompound : BSShape | 866 | public class BSShapeCompound : BSShape |
867 | { | 867 | { |
868 | private static string LogHeader = "[BULLETSIM SHAPE COMPOUND]"; | 868 | private static string LogHeader = "[BULLETSIM SHAPE COMPOUND]"; |
869 | public static Dictionary<string, BSShapeCompound> CompoundShapes = new Dictionary<string, BSShapeCompound>(); | ||
870 | |||
869 | public BSShapeCompound(BulletShape pShape) : base(pShape) | 871 | public BSShapeCompound(BulletShape pShape) : base(pShape) |
870 | { | 872 | { |
871 | } | 873 | } |
@@ -873,7 +875,9 @@ public class BSShapeCompound : BSShape | |||
873 | { | 875 | { |
874 | // Base compound shapes are not shared so this returns a raw shape. | 876 | // Base compound shapes are not shared so this returns a raw shape. |
875 | // A built compound shape can be reused in linksets. | 877 | // A built compound shape can be reused in linksets. |
876 | return new BSShapeCompound(CreatePhysicalCompoundShape(physicsScene)); | 878 | BSShapeCompound ret = new BSShapeCompound(CreatePhysicalCompoundShape(physicsScene)); |
879 | CompoundShapes.Add(ret.AddrString, ret); | ||
880 | return ret; | ||
877 | } | 881 | } |
878 | public override BSShape GetReference(BSScene physicsScene, BSPhysObject prim) | 882 | public override BSShape GetReference(BSScene physicsScene, BSPhysObject prim) |
879 | { | 883 | { |
@@ -911,10 +915,21 @@ public class BSShapeCompound : BSShape | |||
911 | BulletShape childShape = physicsScene.PE.RemoveChildShapeFromCompoundShapeIndex(physShapeInfo, ii); | 915 | BulletShape childShape = physicsScene.PE.RemoveChildShapeFromCompoundShapeIndex(physShapeInfo, ii); |
912 | DereferenceAnonCollisionShape(physicsScene, childShape); | 916 | DereferenceAnonCollisionShape(physicsScene, childShape); |
913 | } | 917 | } |
918 | |||
919 | lock (CompoundShapes) | ||
920 | CompoundShapes.Remove(physShapeInfo.AddrString); | ||
914 | physicsScene.PE.DeleteCollisionShape(physicsScene.World, physShapeInfo); | 921 | physicsScene.PE.DeleteCollisionShape(physicsScene.World, physShapeInfo); |
915 | } | 922 | } |
916 | } | 923 | } |
917 | } | 924 | } |
925 | public static bool TryGetCompoundByPtr(BulletShape pShape, out BSShapeCompound outCompound) | ||
926 | { | ||
927 | lock (CompoundShapes) | ||
928 | { | ||
929 | string addr = pShape.AddrString; | ||
930 | return CompoundShapes.TryGetValue(addr, out outCompound); | ||
931 | } | ||
932 | } | ||
918 | private static BulletShape CreatePhysicalCompoundShape(BSScene physicsScene) | 933 | private static BulletShape CreatePhysicalCompoundShape(BSScene physicsScene) |
919 | { | 934 | { |
920 | BulletShape cShape = physicsScene.PE.CreateCompoundShape(physicsScene.World, false); | 935 | BulletShape cShape = physicsScene.PE.CreateCompoundShape(physicsScene.World, false); |
@@ -926,10 +941,13 @@ public class BSShapeCompound : BSShape | |||
926 | private void DereferenceAnonCollisionShape(BSScene physicsScene, BulletShape pShape) | 941 | private void DereferenceAnonCollisionShape(BSScene physicsScene, BulletShape pShape) |
927 | { | 942 | { |
928 | // TODO: figure a better way to go through all the shape types and find a possible instance. | 943 | // TODO: figure a better way to go through all the shape types and find a possible instance. |
944 | physicsScene.DetailLog("{0},BSShapeCompound.DereferenceAnonCollisionShape,shape={1}", | ||
945 | BSScene.DetailLogZero, pShape); | ||
929 | BSShapeMesh meshDesc; | 946 | BSShapeMesh meshDesc; |
930 | if (BSShapeMesh.TryGetMeshByPtr(pShape, out meshDesc)) | 947 | if (BSShapeMesh.TryGetMeshByPtr(pShape, out meshDesc)) |
931 | { | 948 | { |
932 | meshDesc.Dereference(physicsScene); | 949 | meshDesc.Dereference(physicsScene); |
950 | // physicsScene.DetailLog("{0},BSShapeCompound.DereferenceAnonCollisionShape,foundMesh,shape={1}", BSScene.DetailLogZero, pShape); | ||
933 | } | 951 | } |
934 | else | 952 | else |
935 | { | 953 | { |
@@ -937,13 +955,15 @@ public class BSShapeCompound : BSShape | |||
937 | if (BSShapeHull.TryGetHullByPtr(pShape, out hullDesc)) | 955 | if (BSShapeHull.TryGetHullByPtr(pShape, out hullDesc)) |
938 | { | 956 | { |
939 | hullDesc.Dereference(physicsScene); | 957 | hullDesc.Dereference(physicsScene); |
958 | // physicsScene.DetailLog("{0},BSShapeCompound.DereferenceAnonCollisionShape,foundHull,shape={1}", BSScene.DetailLogZero, pShape); | ||
940 | } | 959 | } |
941 | else | 960 | else |
942 | { | 961 | { |
943 | BSShapeConvexHull chullDesc; | 962 | BSShapeConvexHull chullDesc; |
944 | if (BSShapeConvexHull.TryGetHullByPtr(pShape, out chullDesc)) | 963 | if (BSShapeConvexHull.TryGetConvexHullByPtr(pShape, out chullDesc)) |
945 | { | 964 | { |
946 | chullDesc.Dereference(physicsScene); | 965 | chullDesc.Dereference(physicsScene); |
966 | // physicsScene.DetailLog("{0},BSShapeCompound.DereferenceAnonCollisionShape,foundConvexHull,shape={1}", BSScene.DetailLogZero, pShape); | ||
947 | } | 967 | } |
948 | else | 968 | else |
949 | { | 969 | { |
@@ -951,20 +971,23 @@ public class BSShapeCompound : BSShape | |||
951 | if (BSShapeGImpact.TryGetGImpactByPtr(pShape, out gImpactDesc)) | 971 | if (BSShapeGImpact.TryGetGImpactByPtr(pShape, out gImpactDesc)) |
952 | { | 972 | { |
953 | gImpactDesc.Dereference(physicsScene); | 973 | gImpactDesc.Dereference(physicsScene); |
974 | // physicsScene.DetailLog("{0},BSShapeCompound.DereferenceAnonCollisionShape,foundgImpact,shape={1}", BSScene.DetailLogZero, pShape); | ||
954 | } | 975 | } |
955 | else | 976 | else |
956 | { | 977 | { |
957 | // Didn't find it in the lists of specific types. It could be compound. | 978 | // Didn't find it in the lists of specific types. It could be compound. |
958 | if (physicsScene.PE.IsCompound(pShape)) | 979 | BSShapeCompound compoundDesc; |
980 | if (BSShapeCompound.TryGetCompoundByPtr(pShape, out compoundDesc)) | ||
959 | { | 981 | { |
960 | BSShapeCompound recursiveCompound = new BSShapeCompound(pShape); | 982 | compoundDesc.Dereference(physicsScene); |
961 | recursiveCompound.Dereference(physicsScene); | 983 | // physicsScene.DetailLog("{0},BSShapeCompound.DereferenceAnonCollisionShape,recursiveCompoundShape,shape={1}", BSScene.DetailLogZero, pShape); |
962 | } | 984 | } |
963 | else | 985 | else |
964 | { | 986 | { |
965 | // If none of the above, maybe it is a simple native shape. | 987 | // If none of the above, maybe it is a simple native shape. |
966 | if (physicsScene.PE.IsNativeShape(pShape)) | 988 | if (physicsScene.PE.IsNativeShape(pShape)) |
967 | { | 989 | { |
990 | // physicsScene.DetailLog("{0},BSShapeCompound.DereferenceAnonCollisionShape,assumingNative,shape={1}", BSScene.DetailLogZero, pShape); | ||
968 | BSShapeNative nativeShape = new BSShapeNative(pShape); | 991 | BSShapeNative nativeShape = new BSShapeNative(pShape); |
969 | nativeShape.Dereference(physicsScene); | 992 | nativeShape.Dereference(physicsScene); |
970 | } | 993 | } |
@@ -1021,6 +1044,8 @@ public class BSShapeConvexHull : BSShape | |||
1021 | convexShape = physicsScene.PE.BuildConvexHullShapeFromMesh(physicsScene.World, baseMesh.physShapeInfo); | 1044 | convexShape = physicsScene.PE.BuildConvexHullShapeFromMesh(physicsScene.World, baseMesh.physShapeInfo); |
1022 | convexShape.shapeKey = newMeshKey; | 1045 | convexShape.shapeKey = newMeshKey; |
1023 | ConvexHulls.Add(convexShape.shapeKey, retConvexHull); | 1046 | ConvexHulls.Add(convexShape.shapeKey, retConvexHull); |
1047 | physicsScene.DetailLog("{0},BSShapeConvexHull.GetReference,addingNewlyCreatedShape,shape={1}", | ||
1048 | BSScene.DetailLogZero, convexShape); | ||
1024 | } | 1049 | } |
1025 | 1050 | ||
1026 | // Done with the base mesh | 1051 | // Done with the base mesh |
@@ -1049,7 +1074,7 @@ public class BSShapeConvexHull : BSShape | |||
1049 | } | 1074 | } |
1050 | } | 1075 | } |
1051 | // Loop through all the known hulls and return the description based on the physical address. | 1076 | // Loop through all the known hulls and return the description based on the physical address. |
1052 | public static bool TryGetHullByPtr(BulletShape pShape, out BSShapeConvexHull outHull) | 1077 | public static bool TryGetConvexHullByPtr(BulletShape pShape, out BSShapeConvexHull outHull) |
1053 | { | 1078 | { |
1054 | bool ret = false; | 1079 | bool ret = false; |
1055 | BSShapeConvexHull foundDesc = null; | 1080 | BSShapeConvexHull foundDesc = null; |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSTerrainHeightmap.cs b/OpenSim/Region/Physics/BulletSPlugin/BSTerrainHeightmap.cs index 8888d6d..d70b2fb 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSTerrainHeightmap.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSTerrainHeightmap.cs | |||
@@ -58,7 +58,7 @@ public sealed class BSTerrainHeightmap : BSTerrainPhys | |||
58 | { | 58 | { |
59 | initialMap[ii] = BSTerrainManager.HEIGHT_INITIALIZATION; | 59 | initialMap[ii] = BSTerrainManager.HEIGHT_INITIALIZATION; |
60 | } | 60 | } |
61 | m_mapInfo = new BulletHMapInfo(id, initialMap); | 61 | m_mapInfo = new BulletHMapInfo(id, initialMap, regionSize.X, regionSize.Y); |
62 | m_mapInfo.minCoords = minTerrainCoords; | 62 | m_mapInfo.minCoords = minTerrainCoords; |
63 | m_mapInfo.maxCoords = maxTerrainCoords; | 63 | m_mapInfo.maxCoords = maxTerrainCoords; |
64 | m_mapInfo.terrainRegionBase = TerrainBase; | 64 | m_mapInfo.terrainRegionBase = TerrainBase; |
@@ -72,7 +72,7 @@ public sealed class BSTerrainHeightmap : BSTerrainPhys | |||
72 | Vector3 minCoords, Vector3 maxCoords) | 72 | Vector3 minCoords, Vector3 maxCoords) |
73 | : base(physicsScene, regionBase, id) | 73 | : base(physicsScene, regionBase, id) |
74 | { | 74 | { |
75 | m_mapInfo = new BulletHMapInfo(id, initialMap); | 75 | m_mapInfo = new BulletHMapInfo(id, initialMap, maxCoords.X - minCoords.X, maxCoords.Y - minCoords.Y); |
76 | m_mapInfo.minCoords = minCoords; | 76 | m_mapInfo.minCoords = minCoords; |
77 | m_mapInfo.maxCoords = maxCoords; | 77 | m_mapInfo.maxCoords = maxCoords; |
78 | m_mapInfo.minZ = minCoords.Z; | 78 | m_mapInfo.minZ = minCoords.Z; |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSTerrainManager.cs b/OpenSim/Region/Physics/BulletSPlugin/BSTerrainManager.cs index 441d2d3..3013077 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSTerrainManager.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSTerrainManager.cs | |||
@@ -111,9 +111,11 @@ public sealed class BSTerrainManager : IDisposable | |||
111 | private Vector3 m_worldMax; | 111 | private Vector3 m_worldMax; |
112 | private PhysicsScene MegaRegionParentPhysicsScene { get; set; } | 112 | private PhysicsScene MegaRegionParentPhysicsScene { get; set; } |
113 | 113 | ||
114 | public BSTerrainManager(BSScene physicsScene) | 114 | public BSTerrainManager(BSScene physicsScene, Vector3 regionSize) |
115 | { | 115 | { |
116 | m_physicsScene = physicsScene; | 116 | m_physicsScene = physicsScene; |
117 | DefaultRegionSize = regionSize; | ||
118 | |||
117 | m_terrains = new Dictionary<Vector3,BSTerrainPhys>(); | 119 | m_terrains = new Dictionary<Vector3,BSTerrainPhys>(); |
118 | 120 | ||
119 | // Assume one region of default size | 121 | // Assume one region of default size |
@@ -268,7 +270,7 @@ public sealed class BSTerrainManager : IDisposable | |||
268 | { | 270 | { |
269 | // There is already a terrain in this spot. Free the old and build the new. | 271 | // There is already a terrain in this spot. Free the old and build the new. |
270 | DetailLog("{0},BSTErrainManager.UpdateTerrain:UpdateExisting,call,id={1},base={2},minC={3},maxC={4}", | 272 | DetailLog("{0},BSTErrainManager.UpdateTerrain:UpdateExisting,call,id={1},base={2},minC={3},maxC={4}", |
271 | BSScene.DetailLogZero, id, terrainRegionBase, minCoords, minCoords); | 273 | BSScene.DetailLogZero, id, terrainRegionBase, minCoords, maxCoords); |
272 | 274 | ||
273 | // Remove old terrain from the collection | 275 | // Remove old terrain from the collection |
274 | m_terrains.Remove(terrainRegionBase); | 276 | m_terrains.Remove(terrainRegionBase); |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BulletSimData.cs b/OpenSim/Region/Physics/BulletSPlugin/BulletSimData.cs index 971ff9f..3425d9e 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BulletSimData.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BulletSimData.cs | |||
@@ -165,14 +165,15 @@ public class BulletConstraint | |||
165 | // than making copies. | 165 | // than making copies. |
166 | public class BulletHMapInfo | 166 | public class BulletHMapInfo |
167 | { | 167 | { |
168 | public BulletHMapInfo(uint id, float[] hm) { | 168 | public BulletHMapInfo(uint id, float[] hm, float pSizeX, float pSizeY) { |
169 | ID = id; | 169 | ID = id; |
170 | heightMap = hm; | 170 | heightMap = hm; |
171 | terrainRegionBase = OMV.Vector3.Zero; | 171 | terrainRegionBase = OMV.Vector3.Zero; |
172 | minCoords = new OMV.Vector3(100f, 100f, 25f); | 172 | minCoords = new OMV.Vector3(100f, 100f, 25f); |
173 | maxCoords = new OMV.Vector3(101f, 101f, 26f); | 173 | maxCoords = new OMV.Vector3(101f, 101f, 26f); |
174 | minZ = maxZ = 0f; | 174 | minZ = maxZ = 0f; |
175 | sizeX = sizeY = 256f; | 175 | sizeX = pSizeX; |
176 | sizeY = pSizeY; | ||
176 | } | 177 | } |
177 | public uint ID; | 178 | public uint ID; |
178 | public float[] heightMap; | 179 | public float[] heightMap; |
diff --git a/OpenSim/Region/Physics/Manager/PhysicsPluginManager.cs b/OpenSim/Region/Physics/Manager/PhysicsPluginManager.cs index 8ccfda5..9b06353 100644 --- a/OpenSim/Region/Physics/Manager/PhysicsPluginManager.cs +++ b/OpenSim/Region/Physics/Manager/PhysicsPluginManager.cs | |||
@@ -32,6 +32,7 @@ using System.Reflection; | |||
32 | using Nini.Config; | 32 | using Nini.Config; |
33 | using log4net; | 33 | using log4net; |
34 | using OpenSim.Framework; | 34 | using OpenSim.Framework; |
35 | using OpenMetaverse; | ||
35 | 36 | ||
36 | namespace OpenSim.Region.Physics.Manager | 37 | namespace OpenSim.Region.Physics.Manager |
37 | { | 38 | { |
@@ -66,7 +67,8 @@ namespace OpenSim.Region.Physics.Manager | |||
66 | /// <param name="meshEngineName"></param> | 67 | /// <param name="meshEngineName"></param> |
67 | /// <param name="config"></param> | 68 | /// <param name="config"></param> |
68 | /// <returns></returns> | 69 | /// <returns></returns> |
69 | public PhysicsScene GetPhysicsScene(string physEngineName, string meshEngineName, IConfigSource config, string regionName) | 70 | public PhysicsScene GetPhysicsScene(string physEngineName, string meshEngineName, |
71 | IConfigSource config, string regionName, Vector3 regionExtent) | ||
70 | { | 72 | { |
71 | if (String.IsNullOrEmpty(physEngineName)) | 73 | if (String.IsNullOrEmpty(physEngineName)) |
72 | { | 74 | { |
@@ -94,7 +96,7 @@ namespace OpenSim.Region.Physics.Manager | |||
94 | { | 96 | { |
95 | m_log.Info("[PHYSICS]: creating " + physEngineName); | 97 | m_log.Info("[PHYSICS]: creating " + physEngineName); |
96 | PhysicsScene result = _PhysPlugins[physEngineName].GetScene(regionName); | 98 | PhysicsScene result = _PhysPlugins[physEngineName].GetScene(regionName); |
97 | result.Initialise(meshEngine, config); | 99 | result.Initialise(meshEngine, config, regionExtent); |
98 | return result; | 100 | return result; |
99 | } | 101 | } |
100 | else | 102 | else |
diff --git a/OpenSim/Region/Physics/Manager/PhysicsScene.cs b/OpenSim/Region/Physics/Manager/PhysicsScene.cs index c93206d..71ad795 100644 --- a/OpenSim/Region/Physics/Manager/PhysicsScene.cs +++ b/OpenSim/Region/Physics/Manager/PhysicsScene.cs | |||
@@ -126,8 +126,17 @@ namespace OpenSim.Region.Physics.Manager | |||
126 | } | 126 | } |
127 | } | 127 | } |
128 | 128 | ||
129 | // Deprecated. Do not use this for new physics engines. | ||
129 | public abstract void Initialise(IMesher meshmerizer, IConfigSource config); | 130 | public abstract void Initialise(IMesher meshmerizer, IConfigSource config); |
130 | 131 | ||
132 | // For older physics engines that do not implement non-legacy region sizes. | ||
133 | // If the physics engine handles the region extent feature, it overrides this function. | ||
134 | public virtual void Initialise(IMesher meshmerizer, IConfigSource config, Vector3 regionExtent) | ||
135 | { | ||
136 | // If not overridden, call the old initialization entry. | ||
137 | Initialise(meshmerizer, config); | ||
138 | } | ||
139 | |||
131 | /// <summary> | 140 | /// <summary> |
132 | /// Add an avatar | 141 | /// Add an avatar |
133 | /// </summary> | 142 | /// </summary> |