aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Physics/OdePlugin/ODEPrim.cs')
-rw-r--r--OpenSim/Region/Physics/OdePlugin/ODEPrim.cs28
1 files changed, 25 insertions, 3 deletions
diff --git a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
index d70819e..93ba29e 100644
--- a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
+++ b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
@@ -140,15 +140,20 @@ namespace OpenSim.Region.Physics.OdePlugin
140 { 140 {
141 if (((_size.X / 2f) > 0f)) 141 if (((_size.X / 2f) > 0f))
142 { 142 {
143
144
145 _parent_scene.waitForSpaceUnlock(m_targetSpace);
143 prim_geom = d.CreateSphere(m_targetSpace, _size.X / 2); 146 prim_geom = d.CreateSphere(m_targetSpace, _size.X / 2);
144 } 147 }
145 else 148 else
146 { 149 {
150 _parent_scene.waitForSpaceUnlock(m_targetSpace);
147 prim_geom = d.CreateBox(m_targetSpace, _size.X, _size.Y, _size.Z); 151 prim_geom = d.CreateBox(m_targetSpace, _size.X, _size.Y, _size.Z);
148 } 152 }
149 } 153 }
150 else 154 else
151 { 155 {
156 _parent_scene.waitForSpaceUnlock(m_targetSpace);
152 prim_geom = d.CreateBox(m_targetSpace, _size.X, _size.Y, _size.Z); 157 prim_geom = d.CreateBox(m_targetSpace, _size.X, _size.Y, _size.Z);
153 } 158 }
154 } 159 }
@@ -166,7 +171,7 @@ namespace OpenSim.Region.Physics.OdePlugin
166 //} 171 //}
167 else 172 else
168 { 173 {
169 174 _parent_scene.waitForSpaceUnlock(m_targetSpace);
170 prim_geom = d.CreateBox(m_targetSpace, _size.X, _size.Y, _size.Z); 175 prim_geom = d.CreateBox(m_targetSpace, _size.X, _size.Y, _size.Z);
171 } 176 }
172 } 177 }
@@ -190,6 +195,12 @@ namespace OpenSim.Region.Physics.OdePlugin
190 } 195 }
191 } 196 }
192 197
198 /// <summary>
199 /// Nasty, however without this you get
200 /// 'invalid operation for locked space' when things are really loaded down
201 /// </summary>
202 /// <param name="space"></param>
203
193 public override int PhysicsActorType 204 public override int PhysicsActorType
194 { 205 {
195 get { return (int) ActorTypes.Prim; } 206 get { return (int) ActorTypes.Prim; }
@@ -375,6 +386,7 @@ namespace OpenSim.Region.Physics.OdePlugin
375 3*sizeof (int)); 386 3*sizeof (int));
376 d.GeomTriMeshDataPreprocess(_triMeshData); 387 d.GeomTriMeshDataPreprocess(_triMeshData);
377 388
389 _parent_scene.waitForSpaceUnlock(m_targetSpace);
378 prim_geom = d.CreateTriMesh(m_targetSpace, _triMeshData, parent_scene.triCallback, null, null); 390 prim_geom = d.CreateTriMesh(m_targetSpace, _triMeshData, parent_scene.triCallback, null, null);
379 391
380 if (IsPhysical && Body == (IntPtr) 0) 392 if (IsPhysical && Body == (IntPtr) 0)
@@ -427,6 +439,8 @@ namespace OpenSim.Region.Physics.OdePlugin
427 int[] arrayitem = _parent_scene.calculateSpaceArrayItemFromPos(_position); 439 int[] arrayitem = _parent_scene.calculateSpaceArrayItemFromPos(_position);
428 m_targetSpace = _parent_scene.recalculateSpaceForGeom(prim_geom, _position, m_targetSpace); 440 m_targetSpace = _parent_scene.recalculateSpaceForGeom(prim_geom, _position, m_targetSpace);
429 d.GeomSetPosition(prim_geom, _position.X, _position.Y, _position.Z); 441 d.GeomSetPosition(prim_geom, _position.X, _position.Y, _position.Z);
442
443 _parent_scene.waitForSpaceUnlock(m_targetSpace);
430 d.SpaceAdd(m_targetSpace, prim_geom); 444 d.SpaceAdd(m_targetSpace, prim_geom);
431 } 445 }
432 446
@@ -486,6 +500,7 @@ namespace OpenSim.Region.Physics.OdePlugin
486 } 500 }
487 if (d.SpaceQuery(m_targetSpace, prim_geom)) 501 if (d.SpaceQuery(m_targetSpace, prim_geom))
488 { 502 {
503 _parent_scene.waitForSpaceUnlock(m_targetSpace);
489 d.SpaceRemove(m_targetSpace, prim_geom); 504 d.SpaceRemove(m_targetSpace, prim_geom);
490 } 505 }
491 d.GeomDestroy(prim_geom); 506 d.GeomDestroy(prim_geom);
@@ -510,17 +525,20 @@ namespace OpenSim.Region.Physics.OdePlugin
510 { 525 {
511 if (((_size.X / 2f) > 0f) && ((_size.X / 2f) < 1000)) 526 if (((_size.X / 2f) > 0f) && ((_size.X / 2f) < 1000))
512 { 527 {
528 _parent_scene.waitForSpaceUnlock(m_targetSpace);
513 prim_geom = d.CreateSphere(m_targetSpace, _size.X / 2); 529 prim_geom = d.CreateSphere(m_targetSpace, _size.X / 2);
514 } 530 }
515 else 531 else
516 { 532 {
517 OpenSim.Framework.Console.MainLog.Instance.Verbose("PHYSICS", "Failed to load a sphere bad size"); 533 OpenSim.Framework.Console.MainLog.Instance.Verbose("PHYSICS", "Failed to load a sphere bad size");
534 _parent_scene.waitForSpaceUnlock(m_targetSpace);
518 prim_geom = d.CreateBox(m_targetSpace, _size.X, _size.Y, _size.Z); 535 prim_geom = d.CreateBox(m_targetSpace, _size.X, _size.Y, _size.Z);
519 } 536 }
520 537
521 } 538 }
522 else 539 else
523 { 540 {
541 _parent_scene.waitForSpaceUnlock(m_targetSpace);
524 prim_geom = d.CreateBox(m_targetSpace, _size.X, _size.Y, _size.Z); 542 prim_geom = d.CreateBox(m_targetSpace, _size.X, _size.Y, _size.Z);
525 } 543 }
526 } 544 }
@@ -538,7 +556,7 @@ namespace OpenSim.Region.Physics.OdePlugin
538 //} 556 //}
539 else 557 else
540 { 558 {
541 559 _parent_scene.waitForSpaceUnlock(m_targetSpace);
542 prim_geom = d.CreateBox(m_targetSpace, _size.X, _size.Y, _size.Z); 560 prim_geom = d.CreateBox(m_targetSpace, _size.X, _size.Y, _size.Z);
543 } 561 }
544 //prim_geom = d.CreateBox(m_targetSpace, _size.X, _size.Y, _size.Z); 562 //prim_geom = d.CreateBox(m_targetSpace, _size.X, _size.Y, _size.Z);
@@ -557,10 +575,12 @@ namespace OpenSim.Region.Physics.OdePlugin
557 { 575 {
558 if (_size.X == _size.Y && _size.Y == _size.Z && _size.X == _size.Z) 576 if (_size.X == _size.Y && _size.Y == _size.Z && _size.X == _size.Z)
559 { 577 {
578 _parent_scene.waitForSpaceUnlock(m_targetSpace);
560 prim_geom = d.CreateSphere(m_targetSpace, _size.X / 2); 579 prim_geom = d.CreateSphere(m_targetSpace, _size.X / 2);
561 } 580 }
562 else 581 else
563 { 582 {
583 _parent_scene.waitForSpaceUnlock(m_targetSpace);
564 prim_geom = d.CreateBox(m_targetSpace, _size.X, _size.Y, _size.Z); 584 prim_geom = d.CreateBox(m_targetSpace, _size.X, _size.Y, _size.Z);
565 } 585 }
566 } 586 }
@@ -578,7 +598,7 @@ namespace OpenSim.Region.Physics.OdePlugin
578 //} 598 //}
579 else 599 else
580 { 600 {
581 601 _parent_scene.waitForSpaceUnlock(m_targetSpace);
582 prim_geom = d.CreateBox(m_targetSpace, _size.X, _size.Y, _size.Z); 602 prim_geom = d.CreateBox(m_targetSpace, _size.X, _size.Y, _size.Z);
583 } 603 }
584 d.GeomSetPosition(prim_geom, _position.X, _position.Y, _position.Z); 604 d.GeomSetPosition(prim_geom, _position.X, _position.Y, _position.Z);
@@ -630,11 +650,13 @@ namespace OpenSim.Region.Physics.OdePlugin
630 } 650 }
631 else 651 else
632 { 652 {
653 _parent_scene.waitForSpaceUnlock(m_targetSpace);
633 prim_geom = d.CreateBox(m_targetSpace, _size.X, _size.Y, _size.Z); 654 prim_geom = d.CreateBox(m_targetSpace, _size.X, _size.Y, _size.Z);
634 } 655 }
635 } 656 }
636 else 657 else
637 { 658 {
659 _parent_scene.waitForSpaceUnlock(m_targetSpace);
638 prim_geom = d.CreateBox(m_targetSpace, _size.X, _size.Y, _size.Z); 660 prim_geom = d.CreateBox(m_targetSpace, _size.X, _size.Y, _size.Z);
639 } 661 }
640 if (IsPhysical && Body == (IntPtr) 0) 662 if (IsPhysical && Body == (IntPtr) 0)