diff options
author | Melanie | 2012-12-18 09:44:10 +0000 |
---|---|---|
committer | Melanie | 2012-12-18 09:44:10 +0000 |
commit | b9939a46a19af74f79a492e3b9fb3f65d0de31cd (patch) | |
tree | b20ee4582458689096ff58770397c766c4ac36a8 | |
parent | Merge branch 'master' into careminster (diff) | |
parent | BulletSim: fix vehicles being shot in the air at border crossings because of ... (diff) | |
download | opensim-SC-b9939a46a19af74f79a492e3b9fb3f65d0de31cd.zip opensim-SC-b9939a46a19af74f79a492e3b9fb3f65d0de31cd.tar.gz opensim-SC-b9939a46a19af74f79a492e3b9fb3f65d0de31cd.tar.bz2 opensim-SC-b9939a46a19af74f79a492e3b9fb3f65d0de31cd.tar.xz |
Merge branch 'master' into careminster
Conflicts:
OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Framework/Util.cs | 8 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 18 | ||||
-rw-r--r-- | OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs | 12 | ||||
-rw-r--r-- | OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs | 7 | ||||
-rwxr-xr-x | OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs | 11 | ||||
-rwxr-xr-x | OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs | 64 | ||||
-rwxr-xr-x | OpenSim/Region/Physics/BulletSPlugin/BSLinksetConstraints.cs | 14 | ||||
-rwxr-xr-x | OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs | 9 | ||||
-rw-r--r-- | OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs | 58 | ||||
-rw-r--r-- | OpenSim/Region/Physics/BulletSPlugin/BSScene.cs | 19 | ||||
-rwxr-xr-x | OpenSim/Region/Physics/BulletSPlugin/BSTerrainManager.cs | 90 | ||||
-rwxr-xr-x | OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt | 34 |
12 files changed, 215 insertions, 129 deletions
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index 7d88604..d206fc1 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs | |||
@@ -1867,6 +1867,12 @@ namespace OpenSim.Framework | |||
1867 | /// </summary> | 1867 | /// </summary> |
1868 | public static void PrintCallStack() | 1868 | public static void PrintCallStack() |
1869 | { | 1869 | { |
1870 | PrintCallStack(m_log.DebugFormat); | ||
1871 | } | ||
1872 | |||
1873 | public delegate void DebugPrinter(string msg, params Object[] parm); | ||
1874 | public static void PrintCallStack(DebugPrinter printer) | ||
1875 | { | ||
1870 | StackTrace stackTrace = new StackTrace(true); // get call stack | 1876 | StackTrace stackTrace = new StackTrace(true); // get call stack |
1871 | StackFrame[] stackFrames = stackTrace.GetFrames(); // get method calls (frames) | 1877 | StackFrame[] stackFrames = stackTrace.GetFrames(); // get method calls (frames) |
1872 | 1878 | ||
@@ -1874,7 +1880,7 @@ namespace OpenSim.Framework | |||
1874 | foreach (StackFrame stackFrame in stackFrames) | 1880 | foreach (StackFrame stackFrame in stackFrames) |
1875 | { | 1881 | { |
1876 | MethodBase mb = stackFrame.GetMethod(); | 1882 | MethodBase mb = stackFrame.GetMethod(); |
1877 | m_log.DebugFormat("{0}.{1}:{2}", mb.DeclaringType, mb.Name, stackFrame.GetFileLineNumber()); // write method name | 1883 | printer("{0}.{1}:{2}", mb.DeclaringType, mb.Name, stackFrame.GetFileLineNumber()); // write method name |
1878 | } | 1884 | } |
1879 | } | 1885 | } |
1880 | 1886 | ||
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index b9f9c86..bc62d51 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |||
@@ -505,11 +505,19 @@ namespace OpenSim.Region.Framework.Scenes | |||
505 | 505 | ||
506 | if (Scene != null) | 506 | if (Scene != null) |
507 | { | 507 | { |
508 | // if ((Scene.TestBorderCross(val - Vector3.UnitX, Cardinals.E) || Scene.TestBorderCross(val + Vector3.UnitX, Cardinals.W) | 508 | if ( |
509 | // || Scene.TestBorderCross(val - Vector3.UnitY, Cardinals.N) || Scene.TestBorderCross(val + Vector3.UnitY, Cardinals.S)) | 509 | // (Scene.TestBorderCross(val - Vector3.UnitX, Cardinals.E) |
510 | // && !IsAttachmentCheckFull() && (!Scene.LoadingPrims)) | 510 | // || Scene.TestBorderCross(val + Vector3.UnitX, Cardinals.W) |
511 | if ((Scene.TestBorderCross(val, Cardinals.E) || Scene.TestBorderCross(val, Cardinals.W) | 511 | // || Scene.TestBorderCross(val - Vector3.UnitY, Cardinals.N) |
512 | || Scene.TestBorderCross(val, Cardinals.N) || Scene.TestBorderCross(val, Cardinals.S)) | 512 | // || Scene.TestBorderCross(val + Vector3.UnitY, Cardinals.S)) |
513 | // Experimental change for better border crossings. | ||
514 | // The commented out original lines above would, it seems, trigger | ||
515 | // a border crossing a little early or late depending on which | ||
516 | // direction the object was moving. | ||
517 | (Scene.TestBorderCross(val, Cardinals.E) | ||
518 | || Scene.TestBorderCross(val, Cardinals.W) | ||
519 | || Scene.TestBorderCross(val, Cardinals.N) | ||
520 | || Scene.TestBorderCross(val, Cardinals.S)) | ||
513 | && !IsAttachmentCheckFull() && (!Scene.LoadingPrims)) | 521 | && !IsAttachmentCheckFull() && (!Scene.LoadingPrims)) |
514 | { | 522 | { |
515 | IEntityTransferModule entityTransfer = m_scene.RequestModuleInterface<IEntityTransferModule>(); | 523 | IEntityTransferModule entityTransfer = m_scene.RequestModuleInterface<IEntityTransferModule>(); |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs index 0defb24..4dd6264 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs | |||
@@ -311,6 +311,15 @@ public sealed class BSCharacter : BSPhysObject | |||
311 | { | 311 | { |
312 | bool ret = false; | 312 | bool ret = false; |
313 | 313 | ||
314 | // TODO: check for out of bounds | ||
315 | if (!PhysicsScene.TerrainManager.IsWithinKnownTerrain(_position)) | ||
316 | { | ||
317 | // The character is out of the known/simulated area. | ||
318 | // Upper levels of code will handle the transition to other areas so, for | ||
319 | // the time, we just ignore the position. | ||
320 | return ret; | ||
321 | } | ||
322 | |||
314 | // If below the ground, move the avatar up | 323 | // If below the ground, move the avatar up |
315 | float terrainHeight = PhysicsScene.TerrainManager.GetTerrainHeightAtXYZ(_position); | 324 | float terrainHeight = PhysicsScene.TerrainManager.GetTerrainHeightAtXYZ(_position); |
316 | if (Position.Z < terrainHeight) | 325 | if (Position.Z < terrainHeight) |
@@ -329,7 +338,6 @@ public sealed class BSCharacter : BSPhysObject | |||
329 | } | 338 | } |
330 | } | 339 | } |
331 | 340 | ||
332 | // TODO: check for out of bounds | ||
333 | return ret; | 341 | return ret; |
334 | } | 342 | } |
335 | 343 | ||
@@ -700,7 +708,7 @@ public sealed class BSCharacter : BSPhysObject | |||
700 | } | 708 | } |
701 | 709 | ||
702 | // Tell the linkset about value changes | 710 | // Tell the linkset about value changes |
703 | Linkset.UpdateProperties(this); | 711 | Linkset.UpdateProperties(this, true); |
704 | 712 | ||
705 | // Avatars don't report their changes the usual way. Changes are checked for in the heartbeat loop. | 713 | // Avatars don't report their changes the usual way. Changes are checked for in the heartbeat loop. |
706 | // base.RequestPhysicsterseUpdate(); | 714 | // base.RequestPhysicsterseUpdate(); |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs b/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs index 82e829e..ef68471 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs | |||
@@ -871,8 +871,11 @@ namespace OpenSim.Region.Physics.BulletSPlugin | |||
871 | if (VehiclePosition.Z < GetTerrainHeight(VehiclePosition)) | 871 | if (VehiclePosition.Z < GetTerrainHeight(VehiclePosition)) |
872 | { | 872 | { |
873 | // TODO: correct position by applying force rather than forcing position. | 873 | // TODO: correct position by applying force rather than forcing position. |
874 | VehiclePosition += new Vector3(0f, 0f, GetTerrainHeight(VehiclePosition) + 2f); | 874 | Vector3 newPosition = VehiclePosition; |
875 | VDetailLog("{0}, MoveLinear,terrainHeight,terrainHeight={1},pos={2}", Prim.LocalID, GetTerrainHeight(VehiclePosition), VehiclePosition); | 875 | newPosition.Z = GetTerrainHeight(VehiclePosition) + 1f; |
876 | VehiclePosition = newPosition; | ||
877 | VDetailLog("{0}, MoveLinear,terrainHeight,terrainHeight={1},pos={2}", | ||
878 | Prim.LocalID, GetTerrainHeight(VehiclePosition), VehiclePosition); | ||
876 | } | 879 | } |
877 | return ret; | 880 | return ret; |
878 | } | 881 | } |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs b/OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs index ce0fbe6..2017fa5 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs | |||
@@ -38,6 +38,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin | |||
38 | // Each type of linkset will define the information needed for its type. | 38 | // Each type of linkset will define the information needed for its type. |
39 | public abstract class BSLinksetInfo | 39 | public abstract class BSLinksetInfo |
40 | { | 40 | { |
41 | public virtual void Clear() { } | ||
41 | } | 42 | } |
42 | 43 | ||
43 | public abstract class BSLinkset | 44 | public abstract class BSLinkset |
@@ -95,13 +96,6 @@ public abstract class BSLinkset | |||
95 | return BSPhysicsShapeType.SHAPE_UNKNOWN; | 96 | return BSPhysicsShapeType.SHAPE_UNKNOWN; |
96 | } | 97 | } |
97 | 98 | ||
98 | // Linksets move around the children so the linkset might need to compute the child position | ||
99 | public virtual OMV.Vector3 Position(BSPhysObject member) | ||
100 | { return member.RawPosition; } | ||
101 | public virtual OMV.Quaternion Orientation(BSPhysObject member) | ||
102 | { return member.RawOrientation; } | ||
103 | // TODO: does this need to be done for Velocity and RotationalVelocityy? | ||
104 | |||
105 | // We keep the prim's mass in the linkset structure since it could be dependent on other prims | 99 | // We keep the prim's mass in the linkset structure since it could be dependent on other prims |
106 | protected float m_mass; | 100 | protected float m_mass; |
107 | public float LinksetMass | 101 | public float LinksetMass |
@@ -258,8 +252,9 @@ public abstract class BSLinkset | |||
258 | 252 | ||
259 | // Called when a parameter update comes from the physics engine for any object | 253 | // Called when a parameter update comes from the physics engine for any object |
260 | // of the linkset is received. | 254 | // of the linkset is received. |
255 | // Passed flag is update came from physics engine (true) or the user (false). | ||
261 | // Called at taint-time!! | 256 | // Called at taint-time!! |
262 | public abstract void UpdateProperties(BSPhysObject physObject); | 257 | public abstract void UpdateProperties(BSPhysObject physObject, bool physicalUpdate); |
263 | 258 | ||
264 | // Routine used when rebuilding the body of the root of the linkset | 259 | // Routine used when rebuilding the body of the root of the linkset |
265 | // Destroy all the constraints have have been made to root. | 260 | // Destroy all the constraints have have been made to root. |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs b/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs index 2189468..4d4f712 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs | |||
@@ -28,6 +28,8 @@ using System; | |||
28 | using System.Collections.Generic; | 28 | using System.Collections.Generic; |
29 | using System.Text; | 29 | using System.Text; |
30 | 30 | ||
31 | using OpenSim.Framework; | ||
32 | |||
31 | using OMV = OpenMetaverse; | 33 | using OMV = OpenMetaverse; |
32 | 34 | ||
33 | namespace OpenSim.Region.Physics.BulletSPlugin | 35 | namespace OpenSim.Region.Physics.BulletSPlugin |
@@ -45,6 +47,11 @@ sealed class BSLinksetCompoundInfo : BSLinksetInfo | |||
45 | OffsetPos = p; | 47 | OffsetPos = p; |
46 | OffsetRot = r; | 48 | OffsetRot = r; |
47 | } | 49 | } |
50 | public override void Clear() | ||
51 | { | ||
52 | OffsetPos = OMV.Vector3.Zero; | ||
53 | OffsetRot = OMV.Quaternion.Identity; | ||
54 | } | ||
48 | public override string ToString() | 55 | public override string ToString() |
49 | { | 56 | { |
50 | StringBuilder buff = new StringBuilder(); | 57 | StringBuilder buff = new StringBuilder(); |
@@ -82,22 +89,22 @@ public sealed class BSLinksetCompound : BSLinkset | |||
82 | // its internal properties. | 89 | // its internal properties. |
83 | public override void Refresh(BSPhysObject requestor) | 90 | public override void Refresh(BSPhysObject requestor) |
84 | { | 91 | { |
85 | // External request for Refresh (from BSPrim) doesn't need to do anything | 92 | // Something changed so do the rebuilding thing |
86 | // InternalRefresh(requestor); | 93 | // ScheduleRebuild(); |
87 | } | 94 | } |
88 | 95 | ||
89 | // Schedule a refresh to happen after all the other taint processing. | 96 | // Schedule a refresh to happen after all the other taint processing. |
90 | private void InternalRefresh(BSPhysObject requestor) | 97 | private void ScheduleRebuild() |
91 | { | 98 | { |
92 | DetailLog("{0},BSLinksetCompound.Refresh,schedulingRefresh,requestor={1},rebuilding={2}", | 99 | DetailLog("{0},BSLinksetCompound.Refresh,schedulingRefresh,rebuilding={1}", |
93 | LinksetRoot.LocalID, requestor.LocalID, Rebuilding); | 100 | LinksetRoot.LocalID, Rebuilding); |
94 | // When rebuilding, it is possible to set properties that would normally require a rebuild. | 101 | // When rebuilding, it is possible to set properties that would normally require a rebuild. |
95 | // If already rebuilding, don't request another rebuild. | 102 | // If already rebuilding, don't request another rebuild. |
96 | if (!Rebuilding) | 103 | if (!Rebuilding) |
97 | { | 104 | { |
98 | PhysicsScene.PostTaintObject("BSLinksetCompound.Refresh", requestor.LocalID, delegate() | 105 | PhysicsScene.PostTaintObject("BSLinksetCompound.Refresh", LinksetRoot.LocalID, delegate() |
99 | { | 106 | { |
100 | if (IsRoot(requestor) && HasAnyChildren) | 107 | if (HasAnyChildren) |
101 | RecomputeLinksetCompound(); | 108 | RecomputeLinksetCompound(); |
102 | }); | 109 | }); |
103 | } | 110 | } |
@@ -117,8 +124,7 @@ public sealed class BSLinksetCompound : BSLinkset | |||
117 | { | 124 | { |
118 | // The root is going dynamic. Make sure mass is properly set. | 125 | // The root is going dynamic. Make sure mass is properly set. |
119 | m_mass = ComputeLinksetMass(); | 126 | m_mass = ComputeLinksetMass(); |
120 | if (HasAnyChildren) | 127 | ScheduleRebuild(); |
121 | InternalRefresh(LinksetRoot); | ||
122 | } | 128 | } |
123 | else | 129 | else |
124 | { | 130 | { |
@@ -147,8 +153,7 @@ public sealed class BSLinksetCompound : BSLinkset | |||
147 | DetailLog("{0},BSLinksetCompound.MakeStatic,call,IsRoot={1}", child.LocalID, IsRoot(child)); | 153 | DetailLog("{0},BSLinksetCompound.MakeStatic,call,IsRoot={1}", child.LocalID, IsRoot(child)); |
148 | if (IsRoot(child)) | 154 | if (IsRoot(child)) |
149 | { | 155 | { |
150 | if (HasAnyChildren) | 156 | ScheduleRebuild(); |
151 | InternalRefresh(LinksetRoot); | ||
152 | } | 157 | } |
153 | else | 158 | else |
154 | { | 159 | { |
@@ -164,22 +169,21 @@ public sealed class BSLinksetCompound : BSLinkset | |||
164 | return ret; | 169 | return ret; |
165 | } | 170 | } |
166 | 171 | ||
167 | // Called at taint-time!! | 172 | public override void UpdateProperties(BSPhysObject updated, bool physicalUpdate) |
168 | public override void UpdateProperties(BSPhysObject updated) | ||
169 | { | ||
170 | // Nothing to do for compound linksets on property updates | ||
171 | } | ||
172 | |||
173 | // The children move around in relationship to the root. | ||
174 | // Just grab the current values of wherever it is right now. | ||
175 | public override OMV.Vector3 Position(BSPhysObject member) | ||
176 | { | ||
177 | return BulletSimAPI.GetPosition2(member.PhysBody.ptr); | ||
178 | } | ||
179 | |||
180 | public override OMV.Quaternion Orientation(BSPhysObject member) | ||
181 | { | 173 | { |
182 | return BulletSimAPI.GetOrientation2(member.PhysBody.ptr); | 174 | // The user moving a child around requires the rebuilding of the linkset compound shape |
175 | // One problem is this happens when a border is crossed -- the simulator implementation | ||
176 | // is to store the position into the group which causes the move of the object | ||
177 | // but it also means all the child positions get updated. | ||
178 | // What would cause an unnecessary rebuild so we make sure the linkset is in a | ||
179 | // region before bothering to do a rebuild. | ||
180 | if (!IsRoot(updated) | ||
181 | && !physicalUpdate | ||
182 | && PhysicsScene.TerrainManager.IsWithinKnownTerrain(LinksetRoot.RawPosition)) | ||
183 | { | ||
184 | updated.LinksetInfo = null; | ||
185 | ScheduleRebuild(); | ||
186 | } | ||
183 | } | 187 | } |
184 | 188 | ||
185 | // Routine called when rebuilding the body of some member of the linkset. | 189 | // Routine called when rebuilding the body of some member of the linkset. |
@@ -261,8 +265,8 @@ public sealed class BSLinksetCompound : BSLinkset | |||
261 | 265 | ||
262 | DetailLog("{0},BSLinksetCompound.AddChildToLinkset,call,child={1}", LinksetRoot.LocalID, child.LocalID); | 266 | DetailLog("{0},BSLinksetCompound.AddChildToLinkset,call,child={1}", LinksetRoot.LocalID, child.LocalID); |
263 | 267 | ||
264 | // Cause constraints and assorted properties to be recomputed before the next simulation step. | 268 | // Rebuild the compound shape with the new child shape included |
265 | InternalRefresh(LinksetRoot); | 269 | ScheduleRebuild(); |
266 | } | 270 | } |
267 | return; | 271 | return; |
268 | } | 272 | } |
@@ -289,8 +293,8 @@ public sealed class BSLinksetCompound : BSLinkset | |||
289 | } | 293 | } |
290 | else | 294 | else |
291 | { | 295 | { |
292 | // Schedule a rebuild of the linkset before the next simulation tick. | 296 | // Rebuild the compound shape with the child removed |
293 | InternalRefresh(LinksetRoot); | 297 | ScheduleRebuild(); |
294 | } | 298 | } |
295 | } | 299 | } |
296 | return; | 300 | return; |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSLinksetConstraints.cs b/OpenSim/Region/Physics/BulletSPlugin/BSLinksetConstraints.cs index 732c084..8c36c31 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSLinksetConstraints.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSLinksetConstraints.cs | |||
@@ -78,23 +78,11 @@ public sealed class BSLinksetConstraints : BSLinkset | |||
78 | } | 78 | } |
79 | 79 | ||
80 | // Called at taint-time!! | 80 | // Called at taint-time!! |
81 | public override void UpdateProperties(BSPhysObject updated) | 81 | public override void UpdateProperties(BSPhysObject updated, bool inTaintTime) |
82 | { | 82 | { |
83 | // Nothing to do for constraints on property updates | 83 | // Nothing to do for constraints on property updates |
84 | } | 84 | } |
85 | 85 | ||
86 | // The children of the linkset are moved around by the constraints. | ||
87 | // Just grab the current values of wherever it is right now. | ||
88 | public override OMV.Vector3 Position(BSPhysObject member) | ||
89 | { | ||
90 | return BulletSimAPI.GetPosition2(member.PhysBody.ptr); | ||
91 | } | ||
92 | |||
93 | public override OMV.Quaternion Orientation(BSPhysObject member) | ||
94 | { | ||
95 | return BulletSimAPI.GetOrientation2(member.PhysBody.ptr); | ||
96 | } | ||
97 | |||
98 | // Routine called when rebuilding the body of some member of the linkset. | 86 | // Routine called when rebuilding the body of some member of the linkset. |
99 | // Destroy all the constraints have have been made to root and set | 87 | // Destroy all the constraints have have been made to root and set |
100 | // up to rebuild the constraints before the next simulation step. | 88 | // up to rebuild the constraints before the next simulation step. |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs index 6539b43..92a5f2f 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs | |||
@@ -214,7 +214,7 @@ public abstract class BSPhysObject : PhysicsActor | |||
214 | { | 214 | { |
215 | bool ret = true; | 215 | bool ret = true; |
216 | // If the 'no collision' call, force it to happen right now so quick collision_end | 216 | // If the 'no collision' call, force it to happen right now so quick collision_end |
217 | bool force = CollisionCollection.Count == 0; | 217 | bool force = (CollisionCollection.Count == 0); |
218 | 218 | ||
219 | // throttle the collisions to the number of milliseconds specified in the subscription | 219 | // throttle the collisions to the number of milliseconds specified in the subscription |
220 | if (force || (PhysicsScene.SimulationNowTime >= NextCollisionOkTime)) | 220 | if (force || (PhysicsScene.SimulationNowTime >= NextCollisionOkTime)) |
@@ -232,8 +232,10 @@ public abstract class BSPhysObject : PhysicsActor | |||
232 | // DetailLog("{0},{1}.SendCollisionUpdate,call,numCollisions={2}", LocalID, TypeName, CollisionCollection.Count); | 232 | // DetailLog("{0},{1}.SendCollisionUpdate,call,numCollisions={2}", LocalID, TypeName, CollisionCollection.Count); |
233 | base.SendCollisionUpdate(CollisionCollection); | 233 | base.SendCollisionUpdate(CollisionCollection); |
234 | 234 | ||
235 | // The collisionCollection structure is passed around in the simulator. | 235 | // The CollisionCollection instance is passed around in the simulator. |
236 | // Make sure we don't have a handle to that one and that a new one is used for next time. | 236 | // Make sure we don't have a handle to that one and that a new one is used for next time. |
237 | // This fixes an interesting 'gotcha'. If we call CollisionCollection.Clear() here, | ||
238 | // a race condition is created for the other users of this instance. | ||
237 | CollisionCollection = new CollisionEventUpdate(); | 239 | CollisionCollection = new CollisionEventUpdate(); |
238 | } | 240 | } |
239 | return ret; | 241 | return ret; |
@@ -251,7 +253,8 @@ public abstract class BSPhysObject : PhysicsActor | |||
251 | 253 | ||
252 | PhysicsScene.TaintedObject(TypeName+".SubscribeEvents", delegate() | 254 | PhysicsScene.TaintedObject(TypeName+".SubscribeEvents", delegate() |
253 | { | 255 | { |
254 | CurrentCollisionFlags = BulletSimAPI.AddToCollisionFlags2(PhysBody.ptr, CollisionFlags.BS_SUBSCRIBE_COLLISION_EVENTS); | 256 | if (PhysBody.HasPhysicalBody) |
257 | CurrentCollisionFlags = BulletSimAPI.AddToCollisionFlags2(PhysBody.ptr, CollisionFlags.BS_SUBSCRIBE_COLLISION_EVENTS); | ||
255 | }); | 258 | }); |
256 | } | 259 | } |
257 | else | 260 | else |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs index c9c9c2c..758d92b 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs | |||
@@ -279,9 +279,12 @@ public sealed class BSPrim : BSPhysObject | |||
279 | } | 279 | } |
280 | public override OMV.Vector3 Position { | 280 | public override OMV.Vector3 Position { |
281 | get { | 281 | get { |
282 | /* NOTE: this refetch is not necessary. The simulator knows about linkset children | ||
283 | * and does not fetch this position info for children. Thus this is commented out. | ||
282 | // child prims move around based on their parent. Need to get the latest location | 284 | // child prims move around based on their parent. Need to get the latest location |
283 | if (!Linkset.IsRoot(this)) | 285 | if (!Linkset.IsRoot(this)) |
284 | _position = Linkset.Position(this); | 286 | _position = Linkset.PositionGet(this); |
287 | */ | ||
285 | 288 | ||
286 | // don't do the GetObjectPosition for root elements because this function is called a zillion times. | 289 | // don't do the GetObjectPosition for root elements because this function is called a zillion times. |
287 | // _position = BulletSimAPI.GetObjectPosition2(PhysicsScene.World.ptr, BSBody.ptr); | 290 | // _position = BulletSimAPI.GetObjectPosition2(PhysicsScene.World.ptr, BSBody.ptr); |
@@ -289,21 +292,22 @@ public sealed class BSPrim : BSPhysObject | |||
289 | } | 292 | } |
290 | set { | 293 | set { |
291 | // If the position must be forced into the physics engine, use ForcePosition. | 294 | // If the position must be forced into the physics engine, use ForcePosition. |
295 | // All positions are given in world positions. | ||
292 | if (_position == value) | 296 | if (_position == value) |
293 | { | 297 | { |
298 | DetailLog("{0},BSPrim.setPosition,taint,positionNotChanging,pos={1},orient={2}", LocalID, _position, _orientation); | ||
294 | return; | 299 | return; |
295 | } | 300 | } |
296 | _position = value; | 301 | _position = value; |
297 | // TODO: what does it mean to set the position of a child prim?? Rebuild the constraint? | ||
298 | PositionSanityCheck(false); | 302 | PositionSanityCheck(false); |
303 | |||
304 | // A linkset might need to know if a component information changed. | ||
305 | Linkset.UpdateProperties(this, false); | ||
306 | |||
299 | PhysicsScene.TaintedObject("BSPrim.setPosition", delegate() | 307 | PhysicsScene.TaintedObject("BSPrim.setPosition", delegate() |
300 | { | 308 | { |
301 | // DetailLog("{0},BSPrim.SetPosition,taint,pos={1},orient={2}", LocalID, _position, _orientation); | 309 | DetailLog("{0},BSPrim.SetPosition,taint,pos={1},orient={2}", LocalID, _position, _orientation); |
302 | if (PhysBody.HasPhysicalBody) | 310 | ForcePosition = _position; |
303 | { | ||
304 | BulletSimAPI.SetTranslation2(PhysBody.ptr, _position, _orientation); | ||
305 | ActivateIfPhysical(false); | ||
306 | } | ||
307 | }); | 311 | }); |
308 | } | 312 | } |
309 | } | 313 | } |
@@ -314,9 +318,11 @@ public sealed class BSPrim : BSPhysObject | |||
314 | } | 318 | } |
315 | set { | 319 | set { |
316 | _position = value; | 320 | _position = value; |
317 | // PositionSanityCheck(); // Don't do this! Causes a loop and caller should know better. | 321 | if (PhysBody.HasPhysicalBody) |
318 | BulletSimAPI.SetTranslation2(PhysBody.ptr, _position, _orientation); | 322 | { |
319 | ActivateIfPhysical(false); | 323 | BulletSimAPI.SetTranslation2(PhysBody.ptr, _position, _orientation); |
324 | ActivateIfPhysical(false); | ||
325 | } | ||
320 | } | 326 | } |
321 | } | 327 | } |
322 | 328 | ||
@@ -327,6 +333,14 @@ public sealed class BSPrim : BSPhysObject | |||
327 | { | 333 | { |
328 | bool ret = false; | 334 | bool ret = false; |
329 | 335 | ||
336 | if (!PhysicsScene.TerrainManager.IsWithinKnownTerrain(_position)) | ||
337 | { | ||
338 | // The physical object is out of the known/simulated area. | ||
339 | // Upper levels of code will handle the transition to other areas so, for | ||
340 | // the time, we just ignore the position. | ||
341 | return ret; | ||
342 | } | ||
343 | |||
330 | float terrainHeight = PhysicsScene.TerrainManager.GetTerrainHeightAtXYZ(_position); | 344 | float terrainHeight = PhysicsScene.TerrainManager.GetTerrainHeightAtXYZ(_position); |
331 | OMV.Vector3 upForce = OMV.Vector3.Zero; | 345 | OMV.Vector3 upForce = OMV.Vector3.Zero; |
332 | if (RawPosition.Z < terrainHeight) | 346 | if (RawPosition.Z < terrainHeight) |
@@ -350,8 +364,6 @@ public sealed class BSPrim : BSPhysObject | |||
350 | } | 364 | } |
351 | } | 365 | } |
352 | 366 | ||
353 | // TODO: check for out of bounds | ||
354 | |||
355 | // The above code computes a force to apply to correct any out-of-bounds problems. Apply same. | 367 | // The above code computes a force to apply to correct any out-of-bounds problems. Apply same. |
356 | // TODO: This should be intergrated with a geneal physics action mechanism. | 368 | // TODO: This should be intergrated with a geneal physics action mechanism. |
357 | // TODO: This should be moderated with PID'ness. | 369 | // TODO: This should be moderated with PID'ness. |
@@ -551,18 +563,24 @@ public sealed class BSPrim : BSPhysObject | |||
551 | } | 563 | } |
552 | public override OMV.Quaternion Orientation { | 564 | public override OMV.Quaternion Orientation { |
553 | get { | 565 | get { |
566 | /* NOTE: this refetch is not necessary. The simulator knows about linkset children | ||
567 | * and does not fetch this position info for children. Thus this is commented out. | ||
554 | // Children move around because tied to parent. Get a fresh value. | 568 | // Children move around because tied to parent. Get a fresh value. |
555 | if (!Linkset.IsRoot(this)) | 569 | if (!Linkset.IsRoot(this)) |
556 | { | 570 | { |
557 | _orientation = Linkset.Orientation(this); | 571 | _orientation = Linkset.OrientationGet(this); |
558 | } | 572 | } |
573 | */ | ||
559 | return _orientation; | 574 | return _orientation; |
560 | } | 575 | } |
561 | set { | 576 | set { |
562 | if (_orientation == value) | 577 | if (_orientation == value) |
563 | return; | 578 | return; |
564 | _orientation = value; | 579 | _orientation = value; |
565 | // TODO: what does it mean if a child in a linkset changes its orientation? Rebuild the constraint? | 580 | |
581 | // A linkset might need to know if a component information changed. | ||
582 | Linkset.UpdateProperties(this, false); | ||
583 | |||
566 | PhysicsScene.TaintedObject("BSPrim.setOrientation", delegate() | 584 | PhysicsScene.TaintedObject("BSPrim.setOrientation", delegate() |
567 | { | 585 | { |
568 | if (PhysBody.HasPhysicalBody) | 586 | if (PhysBody.HasPhysicalBody) |
@@ -1427,14 +1445,14 @@ public sealed class BSPrim : BSPhysObject | |||
1427 | entprop.Velocity = _velocity; | 1445 | entprop.Velocity = _velocity; |
1428 | } | 1446 | } |
1429 | 1447 | ||
1430 | // remember the current and last set values | ||
1431 | LastEntityProperties = CurrentEntityProperties; | ||
1432 | CurrentEntityProperties = entprop; | ||
1433 | |||
1434 | OMV.Vector3 direction = OMV.Vector3.UnitX * _orientation; // DEBUG DEBUG DEBUG | 1448 | OMV.Vector3 direction = OMV.Vector3.UnitX * _orientation; // DEBUG DEBUG DEBUG |
1435 | DetailLog("{0},BSPrim.UpdateProperties,call,pos={1},orient={2},dir={3},vel={4},rotVel={5}", | 1449 | DetailLog("{0},BSPrim.UpdateProperties,call,pos={1},orient={2},dir={3},vel={4},rotVel={5}", |
1436 | LocalID, _position, _orientation, direction, _velocity, _rotationalVelocity); | 1450 | LocalID, _position, _orientation, direction, _velocity, _rotationalVelocity); |
1437 | 1451 | ||
1452 | // remember the current and last set values | ||
1453 | LastEntityProperties = CurrentEntityProperties; | ||
1454 | CurrentEntityProperties = entprop; | ||
1455 | |||
1438 | base.RequestPhysicsterseUpdate(); | 1456 | base.RequestPhysicsterseUpdate(); |
1439 | } | 1457 | } |
1440 | /* | 1458 | /* |
@@ -1448,7 +1466,7 @@ public sealed class BSPrim : BSPhysObject | |||
1448 | */ | 1466 | */ |
1449 | 1467 | ||
1450 | // The linkset implimentation might want to know about this. | 1468 | // The linkset implimentation might want to know about this. |
1451 | Linkset.UpdateProperties(this); | 1469 | Linkset.UpdateProperties(this, true); |
1452 | } | 1470 | } |
1453 | } | 1471 | } |
1454 | } | 1472 | } |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs index cf5bb57..7b44574 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs | |||
@@ -349,8 +349,6 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters | |||
349 | // make sure no stepping happens while we're deleting stuff | 349 | // make sure no stepping happens while we're deleting stuff |
350 | m_initialized = false; | 350 | m_initialized = false; |
351 | 351 | ||
352 | TerrainManager.ReleaseGroundPlaneAndTerrain(); | ||
353 | |||
354 | foreach (KeyValuePair<uint, BSPhysObject> kvp in PhysObjects) | 352 | foreach (KeyValuePair<uint, BSPhysObject> kvp in PhysObjects) |
355 | { | 353 | { |
356 | kvp.Value.Destroy(); | 354 | kvp.Value.Destroy(); |
@@ -370,6 +368,13 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters | |||
370 | Shapes = null; | 368 | Shapes = null; |
371 | } | 369 | } |
372 | 370 | ||
371 | if (TerrainManager != null) | ||
372 | { | ||
373 | TerrainManager.ReleaseGroundPlaneAndTerrain(); | ||
374 | TerrainManager.Dispose(); | ||
375 | TerrainManager = null; | ||
376 | } | ||
377 | |||
373 | // Anything left in the unmanaged code should be cleaned out | 378 | // Anything left in the unmanaged code should be cleaned out |
374 | BulletSimAPI.Shutdown2(World.ptr); | 379 | BulletSimAPI.Shutdown2(World.ptr); |
375 | 380 | ||
@@ -512,8 +517,9 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters | |||
512 | out updatedEntityCount, out updatedEntitiesPtr, out collidersCount, out collidersPtr); | 517 | out updatedEntityCount, out updatedEntitiesPtr, out collidersCount, out collidersPtr); |
513 | 518 | ||
514 | if (PhysicsLogging.Enabled) simTime = Util.EnvironmentTickCountSubtract(beforeTime); | 519 | if (PhysicsLogging.Enabled) simTime = Util.EnvironmentTickCountSubtract(beforeTime); |
515 | DetailLog("{0},Simulate,call, frame={1}, nTaints={2}, simTime={3}, substeps={4}, updates={5}, colliders={6}", | 520 | DetailLog("{0},Simulate,call, frame={1}, nTaints={2}, simTime={3}, substeps={4}, updates={5}, colliders={6}, objWColl={7}", |
516 | DetailLogZero, m_simulationStep, numTaints, simTime, numSubSteps, updatedEntityCount, collidersCount); | 521 | DetailLogZero, m_simulationStep, numTaints, simTime, numSubSteps, |
522 | updatedEntityCount, collidersCount, ObjectsWithCollisions.Count); | ||
517 | if (VehiclePhysicalLoggingEnabled) DumpVehicles(); // DEBUG | 523 | if (VehiclePhysicalLoggingEnabled) DumpVehicles(); // DEBUG |
518 | } | 524 | } |
519 | catch (Exception e) | 525 | catch (Exception e) |
@@ -568,6 +574,9 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters | |||
568 | 574 | ||
569 | // Objects that are done colliding are removed from the ObjectsWithCollisions list. | 575 | // Objects that are done colliding are removed from the ObjectsWithCollisions list. |
570 | // Not done above because it is inside an iteration of ObjectWithCollisions. | 576 | // Not done above because it is inside an iteration of ObjectWithCollisions. |
577 | // This complex collision processing is required to create an empty collision | ||
578 | // event call after all collisions have happened on an object. This enables | ||
579 | // the simulator to generate the 'collision end' event. | ||
571 | if (ObjectsWithNoMoreCollisions.Count > 0) | 580 | if (ObjectsWithNoMoreCollisions.Count > 0) |
572 | { | 581 | { |
573 | foreach (BSPhysObject po in ObjectsWithNoMoreCollisions) | 582 | foreach (BSPhysObject po in ObjectsWithNoMoreCollisions) |
@@ -592,7 +601,7 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters | |||
592 | 601 | ||
593 | ProcessPostStepTaints(); | 602 | ProcessPostStepTaints(); |
594 | 603 | ||
595 | // This causes the unmanaged code to output ALL the values found in ALL the objects in the world. | 604 | // The following causes the unmanaged code to output ALL the values found in ALL the objects in the world. |
596 | // Only enable this in a limited test world with few objects. | 605 | // Only enable this in a limited test world with few objects. |
597 | // BulletSimAPI.DumpAllInfo2(World.ptr); // DEBUG DEBUG DEBUG | 606 | // BulletSimAPI.DumpAllInfo2(World.ptr); // DEBUG DEBUG DEBUG |
598 | 607 | ||
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSTerrainManager.cs b/OpenSim/Region/Physics/BulletSPlugin/BSTerrainManager.cs index 5dbd8ce..3428b9c 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSTerrainManager.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSTerrainManager.cs | |||
@@ -67,7 +67,7 @@ public abstract class BSTerrainPhys : IDisposable | |||
67 | } | 67 | } |
68 | 68 | ||
69 | // ========================================================================================== | 69 | // ========================================================================================== |
70 | public sealed class BSTerrainManager | 70 | public sealed class BSTerrainManager : IDisposable |
71 | { | 71 | { |
72 | static string LogHeader = "[BULLETSIM TERRAIN MANAGER]"; | 72 | static string LogHeader = "[BULLETSIM TERRAIN MANAGER]"; |
73 | 73 | ||
@@ -122,6 +122,11 @@ public sealed class BSTerrainManager | |||
122 | MegaRegionParentPhysicsScene = null; | 122 | MegaRegionParentPhysicsScene = null; |
123 | } | 123 | } |
124 | 124 | ||
125 | public void Dispose() | ||
126 | { | ||
127 | ReleaseGroundPlaneAndTerrain(); | ||
128 | } | ||
129 | |||
125 | // Create the initial instance of terrain and the underlying ground plane. | 130 | // Create the initial instance of terrain and the underlying ground plane. |
126 | // This is called from the initialization routine so we presume it is | 131 | // This is called from the initialization routine so we presume it is |
127 | // safe to call Bullet in real time. We hope no one is moving prims around yet. | 132 | // safe to call Bullet in real time. We hope no one is moving prims around yet. |
@@ -327,6 +332,13 @@ public sealed class BSTerrainManager | |||
327 | return newTerrainPhys; | 332 | return newTerrainPhys; |
328 | } | 333 | } |
329 | 334 | ||
335 | // Return 'true' of this position is somewhere in known physical terrain space | ||
336 | public bool IsWithinKnownTerrain(Vector3 pos) | ||
337 | { | ||
338 | Vector3 terrainBaseXYZ; | ||
339 | BSTerrainPhys physTerrain; | ||
340 | return GetTerrainPhysicalAtXYZ(pos, out physTerrain, out terrainBaseXYZ); | ||
341 | } | ||
330 | 342 | ||
331 | // Given an X and Y, find the height of the terrain. | 343 | // Given an X and Y, find the height of the terrain. |
332 | // Since we could be handling multiple terrains for a mega-region, | 344 | // Since we could be handling multiple terrains for a mega-region, |
@@ -337,13 +349,13 @@ public sealed class BSTerrainManager | |||
337 | private float lastHeightTX = 999999f; | 349 | private float lastHeightTX = 999999f; |
338 | private float lastHeightTY = 999999f; | 350 | private float lastHeightTY = 999999f; |
339 | private float lastHeight = HEIGHT_INITIAL_LASTHEIGHT; | 351 | private float lastHeight = HEIGHT_INITIAL_LASTHEIGHT; |
340 | public float GetTerrainHeightAtXYZ(Vector3 loc) | 352 | public float GetTerrainHeightAtXYZ(Vector3 pos) |
341 | { | 353 | { |
342 | float tX = loc.X; | 354 | float tX = pos.X; |
343 | float tY = loc.Y; | 355 | float tY = pos.Y; |
344 | // You'd be surprized at the number of times this routine is called | 356 | // You'd be surprized at the number of times this routine is called |
345 | // with the same parameters as last time. | 357 | // with the same parameters as last time. |
346 | if (!m_terrainModified && lastHeightTX == tX && lastHeightTY == tY) | 358 | if (!m_terrainModified && (lastHeightTX == tX) && (lastHeightTY == tY)) |
347 | return lastHeight; | 359 | return lastHeight; |
348 | m_terrainModified = false; | 360 | m_terrainModified = false; |
349 | 361 | ||
@@ -351,23 +363,20 @@ public sealed class BSTerrainManager | |||
351 | lastHeightTY = tY; | 363 | lastHeightTY = tY; |
352 | float ret = HEIGHT_GETHEIGHT_RET; | 364 | float ret = HEIGHT_GETHEIGHT_RET; |
353 | 365 | ||
354 | int offsetX = ((int)(tX / (int)DefaultRegionSize.X)) * (int)DefaultRegionSize.X; | 366 | Vector3 terrainBaseXYZ; |
355 | int offsetY = ((int)(tY / (int)DefaultRegionSize.Y)) * (int)DefaultRegionSize.Y; | 367 | BSTerrainPhys physTerrain; |
356 | Vector3 terrainBaseXYZ = new Vector3(offsetX, offsetY, 0f); | 368 | if (GetTerrainPhysicalAtXYZ(pos, out physTerrain, out terrainBaseXYZ)) |
357 | |||
358 | lock (m_terrains) | ||
359 | { | 369 | { |
360 | BSTerrainPhys physTerrain; | 370 | ret = physTerrain.GetTerrainHeightAtXYZ(pos - terrainBaseXYZ); |
361 | if (m_terrains.TryGetValue(terrainBaseXYZ, out physTerrain)) | 371 | } |
362 | { | 372 | else |
363 | ret = physTerrain.GetTerrainHeightAtXYZ(loc - terrainBaseXYZ); | 373 | { |
364 | } | 374 | PhysicsScene.Logger.ErrorFormat("{0} GetTerrainHeightAtXY: terrain not found: region={1}, x={2}, y={3}", |
365 | else | 375 | LogHeader, PhysicsScene.RegionName, tX, tY); |
366 | { | 376 | DetailLog("{0},BSTerrainManager.GetTerrainHeightAtXYZ,terrainNotFound,pos={1},base={2}", |
367 | PhysicsScene.Logger.ErrorFormat("{0} GetTerrainHeightAtXY: terrain not found: region={1}, x={2}, y={3}", | 377 | BSScene.DetailLogZero, pos, terrainBaseXYZ); |
368 | LogHeader, PhysicsScene.RegionName, tX, tY); | ||
369 | } | ||
370 | } | 378 | } |
379 | |||
371 | lastHeight = ret; | 380 | lastHeight = ret; |
372 | return ret; | 381 | return ret; |
373 | } | 382 | } |
@@ -376,27 +385,36 @@ public sealed class BSTerrainManager | |||
376 | { | 385 | { |
377 | float ret = WATER_HEIGHT_GETHEIGHT_RET; | 386 | float ret = WATER_HEIGHT_GETHEIGHT_RET; |
378 | 387 | ||
379 | float tX = pos.X; | 388 | Vector3 terrainBaseXYZ; |
380 | float tY = pos.Y; | 389 | BSTerrainPhys physTerrain; |
390 | if (GetTerrainPhysicalAtXYZ(pos, out physTerrain, out terrainBaseXYZ)) | ||
391 | { | ||
392 | ret = physTerrain.GetWaterLevelAtXYZ(pos); | ||
393 | } | ||
394 | else | ||
395 | { | ||
396 | PhysicsScene.Logger.ErrorFormat("{0} GetWaterHeightAtXY: terrain not found: pos={1}, terrainBase={2}, height={3}", | ||
397 | LogHeader, PhysicsScene.RegionName, pos, terrainBaseXYZ, ret); | ||
398 | } | ||
399 | return ret; | ||
400 | } | ||
381 | 401 | ||
382 | Vector3 terrainBaseXYZ = Vector3.Zero; | 402 | // Given an address, return 'true' of there is a description of that terrain and output |
383 | terrainBaseXYZ.X = ((int)(tX / (int)DefaultRegionSize.X)) * (int)DefaultRegionSize.X; | 403 | // the descriptor class and the 'base' fo the addresses therein. |
384 | terrainBaseXYZ.Y = ((int)(tY / (int)DefaultRegionSize.Y)) * (int)DefaultRegionSize.Y; | 404 | private bool GetTerrainPhysicalAtXYZ(Vector3 pos, out BSTerrainPhys outPhysTerrain, out Vector3 outTerrainBase) |
405 | { | ||
406 | int offsetX = ((int)(pos.X / (int)DefaultRegionSize.X)) * (int)DefaultRegionSize.X; | ||
407 | int offsetY = ((int)(pos.Y / (int)DefaultRegionSize.Y)) * (int)DefaultRegionSize.Y; | ||
408 | Vector3 terrainBaseXYZ = new Vector3(offsetX, offsetY, 0f); | ||
385 | 409 | ||
410 | BSTerrainPhys physTerrain = null; | ||
386 | lock (m_terrains) | 411 | lock (m_terrains) |
387 | { | 412 | { |
388 | BSTerrainPhys physTerrain; | 413 | m_terrains.TryGetValue(terrainBaseXYZ, out physTerrain); |
389 | if (m_terrains.TryGetValue(terrainBaseXYZ, out physTerrain)) | ||
390 | { | ||
391 | ret = physTerrain.GetWaterLevelAtXYZ(pos); | ||
392 | } | ||
393 | else | ||
394 | { | ||
395 | PhysicsScene.Logger.ErrorFormat("{0} GetWaterHeightAtXY: terrain not found: region={1}, x={2}, y={3}", | ||
396 | LogHeader, PhysicsScene.RegionName, tX, tY); | ||
397 | } | ||
398 | } | 414 | } |
399 | return ret; | 415 | outTerrainBase = terrainBaseXYZ; |
416 | outPhysTerrain = physTerrain; | ||
417 | return (physTerrain != null); | ||
400 | } | 418 | } |
401 | 419 | ||
402 | // Although no one seems to check this, I do support combining. | 420 | // Although no one seems to check this, I do support combining. |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt b/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt index 7d6ace8..31dd790 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt +++ b/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt | |||
@@ -1,3 +1,16 @@ | |||
1 | CURRENT PRIORITIES | ||
2 | ================================================= | ||
3 | Eliminate all crashes (DONEish) | ||
4 | Editing/deleting physical linkset (DONE) | ||
5 | Border crossing of physical linkset (DONE) | ||
6 | Enable vehicle border crossings (at least as poorly as ODE) | ||
7 | Avatar created in previous region and not new region when crossing border | ||
8 | Vehicle recreated in new sim at small Z value (offset from root value?) | ||
9 | Calibrate turning radius | ||
10 | limitMotorUp calibration (more down?) | ||
11 | study PID motors (include 'efficiency' implementation | ||
12 | Add to avatar movement | ||
13 | |||
1 | CRASHES | 14 | CRASHES |
2 | ================================================= | 15 | ================================================= |
3 | 20121129.1411: editting/moving phys object across region boundries causes crash | 16 | 20121129.1411: editting/moving phys object across region boundries causes crash |
@@ -11,16 +24,18 @@ CRASHES | |||
11 | 24 | ||
12 | VEHICLES TODO LIST: | 25 | VEHICLES TODO LIST: |
13 | ================================================= | 26 | ================================================= |
27 | Border crossing with linked vehicle causes crash | ||
14 | Neb vehicle taking > 25ms of physics time!! | 28 | Neb vehicle taking > 25ms of physics time!! |
15 | Vehicles (Move smoothly) | 29 | Vehicles (Move smoothly) |
16 | Add vehicle collisions so IsColliding is properly reported. | 30 | Add vehicle collisions so IsColliding is properly reported. |
17 | Needed for banking, limitMotorUp, movementLimiting, ... | 31 | Needed for banking, limitMotorUp, movementLimiting, ... |
18 | Some vehicles should not be able to turn if no speed or off ground. | 32 | Some vehicles should not be able to turn if no speed or off ground. |
33 | Cannot edit/move a vehicle being ridden: it jumps back to the origional position. | ||
19 | Neb car jiggling left and right | 34 | Neb car jiggling left and right |
20 | Happens on terrain and any other mesh object. Flat cubes are much smoother. | 35 | Happens on terrain and any other mesh object. Flat cubes are much smoother. |
21 | This has been reduced but not eliminated. | 36 | This has been reduced but not eliminated. |
22 | Light cycle falling over when driving | 37 | Light cycle falling over when driving |
23 | For limitMotorUp, use raycast down to find if vehicle is in the air. | 38 | Implement referenceFrame for all the motion routines. |
24 | Angular motion around Z moves the vehicle in world Z and not vehicle Z in ODE. | 39 | Angular motion around Z moves the vehicle in world Z and not vehicle Z in ODE. |
25 | Verify that angular motion specified around Z moves in the vehicle coordinates. | 40 | Verify that angular motion specified around Z moves in the vehicle coordinates. |
26 | Verify llGetVel() is returning a smooth and good value for vehicle movement. | 41 | Verify llGetVel() is returning a smooth and good value for vehicle movement. |
@@ -31,12 +46,13 @@ Should vehicle angular/linear movement friction happen after all the components | |||
31 | After getting off a vehicle, the root prim is phantom (can be walked through) | 46 | After getting off a vehicle, the root prim is phantom (can be walked through) |
32 | Need to force a position update for the root prim after compound shape destruction | 47 | Need to force a position update for the root prim after compound shape destruction |
33 | Linkset explosion after three "rides" on Nebadon lite vehicle (LinksetConstraint) | 48 | Linkset explosion after three "rides" on Nebadon lite vehicle (LinksetConstraint) |
34 | Implement referenceFrame for all the motion routines. | 49 | For limitMotorUp, use raycast down to find if vehicle is in the air. |
35 | Cannot edit/move a vehicle being ridden: it jumps back to the origional position. | 50 | Remove vehicle angular velocity zeroing in BSPrim.UpdateProperties(). |
36 | Border crossing with linked vehicle causes crash | 51 | A kludge that isn't fixing the real problem of Bullet adding extra motion. |
37 | 52 | ||
38 | BULLETSIM TODO LIST: | 53 | BULLETSIM TODO LIST: |
39 | ================================================= | 54 | ================================================= |
55 | Revisit CollisionMargin. Builders notice the 0.04 spacing between prims. | ||
40 | Avatar height off after unsitting (floats off ground) | 56 | Avatar height off after unsitting (floats off ground) |
41 | Editting appearance then moving restores. | 57 | Editting appearance then moving restores. |
42 | Must not be initializing height when recreating capsule after unsit. | 58 | Must not be initializing height when recreating capsule after unsit. |
@@ -64,11 +80,16 @@ Implement ShapeCollection.Dispose() | |||
64 | Implement water as a plain so raycasting and collisions can happen with same. | 80 | Implement water as a plain so raycasting and collisions can happen with same. |
65 | Add osGetPhysicsEngineName() so scripters can tell whether BulletSim or ODE | 81 | Add osGetPhysicsEngineName() so scripters can tell whether BulletSim or ODE |
66 | Also osGetPhysicsEngineVerion() maybe. | 82 | Also osGetPhysicsEngineVerion() maybe. |
83 | Linkset.Position and Linkset.Orientation requre rewrite to properly return | ||
84 | child position. LinksetConstraint acts like it's at taint time!! | ||
67 | 85 | ||
68 | LINKSETS | 86 | LINKSETS |
69 | ====================================================== | 87 | ====================================================== |
70 | Linksets should allow collisions to individual children | 88 | Linksets should allow collisions to individual children |
71 | Add LocalID to children shapes in LinksetCompound and create events for individuals | 89 | Add LocalID to children shapes in LinksetCompound and create events for individuals |
90 | LinksetCompound: when one of the children changes orientation (like tires | ||
91 | turning on a vehicle, the whole compound object is rebuilt. Optimize this | ||
92 | so orientation/position of individual children can change without a rebuild. | ||
72 | Verify/think through scripts in children of linksets. What do they reference | 93 | Verify/think through scripts in children of linksets. What do they reference |
73 | and return when getting position, velocity, ... | 94 | and return when getting position, velocity, ... |
74 | Confirm constraint linksets still work after making all the changes for compound linksets. | 95 | Confirm constraint linksets still work after making all the changes for compound linksets. |
@@ -140,6 +161,11 @@ Remove HeightmapInfo from terrain specification | |||
140 | Since C++ code does not need terrain height, this structure et al are not needed. | 161 | Since C++ code does not need terrain height, this structure et al are not needed. |
141 | Add floating motor for BS_FLOATS_ON_WATER so prim and avatar will | 162 | Add floating motor for BS_FLOATS_ON_WATER so prim and avatar will |
142 | bob at the water level. BSPrim.PositionSanityCheck(). | 163 | bob at the water level. BSPrim.PositionSanityCheck(). |
164 | Should taints check for existance or activeness of target? | ||
165 | When destroying linksets/etc, taints can be generated for objects that are | ||
166 | actually gone when the taint happens. Crashes don't happen because the taint closure | ||
167 | keeps the object from being freed, but that is just an accident. | ||
168 | Possibly have and 'active' flag that is checked by the taint processor? | ||
143 | 169 | ||
144 | THREADING | 170 | THREADING |
145 | ================================================= | 171 | ================================================= |