diff options
Diffstat (limited to 'OpenSim/Region/Physics/ChOdePlugin/OdePlugin.cs')
-rw-r--r-- | OpenSim/Region/Physics/ChOdePlugin/OdePlugin.cs | 50 |
1 files changed, 39 insertions, 11 deletions
diff --git a/OpenSim/Region/Physics/ChOdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/ChOdePlugin/OdePlugin.cs index 353db44..b5b30ee 100644 --- a/OpenSim/Region/Physics/ChOdePlugin/OdePlugin.cs +++ b/OpenSim/Region/Physics/ChOdePlugin/OdePlugin.cs | |||
@@ -1536,7 +1536,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1536 | List<OdePrim> removeprims = null; | 1536 | List<OdePrim> removeprims = null; |
1537 | foreach (OdePrim chr in _activeprims) | 1537 | foreach (OdePrim chr in _activeprims) |
1538 | { | 1538 | { |
1539 | if (chr.Body != IntPtr.Zero && d.BodyIsEnabled(chr.Body) && (!chr.m_disabled)) | 1539 | if (chr.Body != IntPtr.Zero && d.BodyIsEnabled(chr.Body) && (!chr.m_disabled) && !chr.m_outofBounds) |
1540 | { | 1540 | { |
1541 | try | 1541 | try |
1542 | { | 1542 | { |
@@ -1736,6 +1736,23 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1736 | return newPrim; | 1736 | return newPrim; |
1737 | } | 1737 | } |
1738 | 1738 | ||
1739 | private PhysicsActor AddPrim(String name, Vector3 position, PhysicsActor parent, | ||
1740 | PrimitiveBaseShape pbs, uint localid, byte[] sdata) | ||
1741 | { | ||
1742 | Vector3 pos = position; | ||
1743 | |||
1744 | OdePrim newPrim; | ||
1745 | lock (OdeLock) | ||
1746 | { | ||
1747 | newPrim = new OdePrim(name, this, pos, parent, pbs, ode, localid, sdata); | ||
1748 | lock (_prims) | ||
1749 | _prims.Add(newPrim); | ||
1750 | } | ||
1751 | |||
1752 | return newPrim; | ||
1753 | } | ||
1754 | |||
1755 | |||
1739 | public void addActivePrim(OdePrim activatePrim) | 1756 | public void addActivePrim(OdePrim activatePrim) |
1740 | { | 1757 | { |
1741 | // adds active prim.. (ones that should be iterated over in collisions_optimized | 1758 | // adds active prim.. (ones that should be iterated over in collisions_optimized |
@@ -1762,6 +1779,17 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1762 | return result; | 1779 | return result; |
1763 | } | 1780 | } |
1764 | 1781 | ||
1782 | public override PhysicsActor AddPrimShape(string primName, PhysicsActor parent, PrimitiveBaseShape pbs, Vector3 position, | ||
1783 | uint localid, byte[] sdata) | ||
1784 | { | ||
1785 | PhysicsActor result; | ||
1786 | |||
1787 | result = AddPrim(primName, position, parent, | ||
1788 | pbs, localid, sdata); | ||
1789 | |||
1790 | return result; | ||
1791 | } | ||
1792 | |||
1765 | public override float TimeDilation | 1793 | public override float TimeDilation |
1766 | { | 1794 | { |
1767 | get { return m_timeDilation; } | 1795 | get { return m_timeDilation; } |
@@ -3410,17 +3438,17 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
3410 | public void SetTerrain(float[] heightMap, Vector3 pOffset) | 3438 | public void SetTerrain(float[] heightMap, Vector3 pOffset) |
3411 | { | 3439 | { |
3412 | 3440 | ||
3413 | uint regionsize = (uint) Constants.RegionSize; // visible region size eg. 256(M) | 3441 | int regionsize = (int) Constants.RegionSize; // visible region size eg. 256(M) |
3414 | 3442 | ||
3415 | uint heightmapWidth = regionsize + 1; // ODE map size 257 x 257 (Meters) (1 extra | 3443 | int heightmapWidth = regionsize + 2; // ODE map size 258 x 258 (Meters) (1 extra each side) |
3416 | uint heightmapHeight = regionsize + 1; | 3444 | int heightmapHeight = regionsize + 2; |
3417 | 3445 | ||
3418 | uint heightmapWidthSamples = (uint)regionsize + 2; // Sample file size, 258 x 258 samples | 3446 | int heightmapWidthSamples = (int)regionsize + 3; // to have 258m we need 259 samples |
3419 | uint heightmapHeightSamples = (uint)regionsize + 2; | 3447 | int heightmapHeightSamples = (int)regionsize + 3; |
3420 | 3448 | ||
3421 | // Array of height samples for ODE | 3449 | // Array of height samples for ODE |
3422 | float[] _heightmap; | 3450 | float[] _heightmap; |
3423 | _heightmap = new float[(heightmapWidthSamples * heightmapHeightSamples)]; // loaded samples 258 x 258 | 3451 | _heightmap = new float[(heightmapWidthSamples * heightmapHeightSamples)]; // loaded samples 259 x 259 |
3424 | 3452 | ||
3425 | // Other ODE parameters | 3453 | // Other ODE parameters |
3426 | const float scale = 1.0f; | 3454 | const float scale = 1.0f; |
@@ -3432,10 +3460,10 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
3432 | float hfmax = -2000f; | 3460 | float hfmax = -2000f; |
3433 | float minele = 0.0f; // Dont allow -ve heights | 3461 | float minele = 0.0f; // Dont allow -ve heights |
3434 | 3462 | ||
3435 | uint x = 0; | 3463 | int x = 0; |
3436 | uint y = 0; | 3464 | int y = 0; |
3437 | uint xx = 0; | 3465 | int xx = 0; |
3438 | uint yy = 0; | 3466 | int yy = 0; |
3439 | 3467 | ||
3440 | // load the height samples array from the heightMap | 3468 | // load the height samples array from the heightMap |
3441 | for ( x = 0; x < heightmapWidthSamples; x++) // 0 to 257 | 3469 | for ( x = 0; x < heightmapWidthSamples; x++) // 0 to 257 |