diff options
Diffstat (limited to 'OpenSim/Region/Physics')
-rw-r--r-- | OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs | 49 |
1 files changed, 38 insertions, 11 deletions
diff --git a/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs b/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs index 286c7f0..6c72324 100644 --- a/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs +++ b/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs | |||
@@ -302,6 +302,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
302 | 302 | ||
303 | // split static geometry collision into a grid as before | 303 | // split static geometry collision into a grid as before |
304 | private IntPtr[,] staticPrimspace; | 304 | private IntPtr[,] staticPrimspace; |
305 | private IntPtr[] staticPrimspaceOffRegion; | ||
305 | 306 | ||
306 | public Object OdeLock; | 307 | public Object OdeLock; |
307 | private static Object SimulationLock; | 308 | private static Object SimulationLock; |
@@ -551,6 +552,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
551 | // create all spaces now | 552 | // create all spaces now |
552 | int i, j; | 553 | int i, j; |
553 | IntPtr newspace; | 554 | IntPtr newspace; |
555 | |||
554 | for (i = 0; i < spaceGridMaxX; i++) | 556 | for (i = 0; i < spaceGridMaxX; i++) |
555 | for (j = 0; j < spaceGridMaxY; j++) | 557 | for (j = 0; j < spaceGridMaxY; j++) |
556 | { | 558 | { |
@@ -573,6 +575,29 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
573 | // let this now be real maximum values | 575 | // let this now be real maximum values |
574 | spaceGridMaxX--; | 576 | spaceGridMaxX--; |
575 | spaceGridMaxY--; | 577 | spaceGridMaxY--; |
578 | |||
579 | // create 4 off world spaces (x<0,x>max,y<0,y>max) | ||
580 | staticPrimspaceOffRegion = new IntPtr[4]; | ||
581 | |||
582 | for (i = 0; i < 4; i++) | ||
583 | { | ||
584 | newspace = d.HashSpaceCreate(StaticSpace); | ||
585 | d.GeomSetCategoryBits(newspace, (int)CollisionCategories.Space); | ||
586 | waitForSpaceUnlock(newspace); | ||
587 | d.SpaceSetSublevel(newspace, 2); | ||
588 | d.HashSpaceSetLevels(newspace, -2, 8); | ||
589 | d.GeomSetCategoryBits(newspace, (uint)(CollisionCategories.Space | | ||
590 | CollisionCategories.Geom | | ||
591 | CollisionCategories.Land | | ||
592 | CollisionCategories.Water | | ||
593 | CollisionCategories.Phantom | | ||
594 | CollisionCategories.VolumeDtc | ||
595 | )); | ||
596 | d.GeomSetCollideBits(newspace, 0); | ||
597 | |||
598 | staticPrimspaceOffRegion[i] = newspace; | ||
599 | } | ||
600 | |||
576 | m_lastframe = DateTime.UtcNow; | 601 | m_lastframe = DateTime.UtcNow; |
577 | } | 602 | } |
578 | 603 | ||
@@ -1650,20 +1675,22 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1650 | public IntPtr calculateSpaceForGeom(Vector3 pos) | 1675 | public IntPtr calculateSpaceForGeom(Vector3 pos) |
1651 | { | 1676 | { |
1652 | int x, y; | 1677 | int x, y; |
1653 | x = (int)(pos.X * spacesPerMeter); | ||
1654 | if (x < 0) | ||
1655 | x = 0; | ||
1656 | else if (x > spaceGridMaxX) | ||
1657 | x = spaceGridMaxX; | ||
1658 | 1678 | ||
1679 | if (pos.X < 0) | ||
1680 | return staticPrimspaceOffRegion[0]; | ||
1681 | |||
1682 | if (pos.Y < 0) | ||
1683 | return staticPrimspaceOffRegion[2]; | ||
1684 | |||
1685 | x = (int)(pos.X * spacesPerMeter); | ||
1686 | if (x > spaceGridMaxX) | ||
1687 | return staticPrimspaceOffRegion[1]; | ||
1688 | |||
1659 | y = (int)(pos.Y * spacesPerMeter); | 1689 | y = (int)(pos.Y * spacesPerMeter); |
1660 | if (y < 0) | 1690 | if (y > spaceGridMaxY) |
1661 | y = 0; | 1691 | return staticPrimspaceOffRegion[3]; |
1662 | else if (y >spaceGridMaxY) | ||
1663 | y = spaceGridMaxY; | ||
1664 | 1692 | ||
1665 | IntPtr tmpSpace = staticPrimspace[x, y]; | 1693 | return staticPrimspace[x, y]; |
1666 | return tmpSpace; | ||
1667 | } | 1694 | } |
1668 | 1695 | ||
1669 | #endregion | 1696 | #endregion |