aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics
diff options
context:
space:
mode:
authorUbitUmarov2012-04-20 04:49:23 +0100
committerUbitUmarov2012-04-20 04:49:23 +0100
commit2c7f03592571292ea3a563addb1c8fa6af1f6c59 (patch)
tree4de43637d73236b4dabd69900f717305cfc2ecde /OpenSim/Region/Physics
parentubitODE - again avatar/terrain collision. Reduce new viewers interpolators ef... (diff)
downloadopensim-SC_OLD-2c7f03592571292ea3a563addb1c8fa6af1f6c59.zip
opensim-SC_OLD-2c7f03592571292ea3a563addb1c8fa6af1f6c59.tar.gz
opensim-SC_OLD-2c7f03592571292ea3a563addb1c8fa6af1f6c59.tar.bz2
opensim-SC_OLD-2c7f03592571292ea3a563addb1c8fa6af1f6c59.tar.xz
ubitODE: - Change triangles used in terrain height estimation
Diffstat (limited to 'OpenSim/Region/Physics')
-rw-r--r--OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs39
1 files changed, 28 insertions, 11 deletions
diff --git a/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs b/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs
index 9ca2d3f..72ac605 100644
--- a/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs
+++ b/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs
@@ -2007,7 +2007,7 @@ namespace OpenSim.Region.Physics.OdePlugin
2007 } 2007 }
2008 else // out world use external height 2008 else // out world use external height
2009 { 2009 {
2010 ix = regsize - 1; 2010 ix = regsize - 2;
2011 dx = 0; 2011 dx = 0;
2012 } 2012 }
2013 if (y < regsize - 1) 2013 if (y < regsize - 1)
@@ -2017,7 +2017,7 @@ namespace OpenSim.Region.Physics.OdePlugin
2017 } 2017 }
2018 else 2018 else
2019 { 2019 {
2020 iy = regsize - 1; 2020 iy = regsize - 2;
2021 dy = 0; 2021 dy = 0;
2022 } 2022 }
2023 } 2023 }
@@ -2034,7 +2034,7 @@ namespace OpenSim.Region.Physics.OdePlugin
2034 } 2034 }
2035 else // out world use external height 2035 else // out world use external height
2036 { 2036 {
2037 iy = regsize - 1; 2037 iy = regsize - 2;
2038 dy = 0; 2038 dy = 0;
2039 } 2039 }
2040 if (y < regsize - 1) 2040 if (y < regsize - 1)
@@ -2044,7 +2044,7 @@ namespace OpenSim.Region.Physics.OdePlugin
2044 } 2044 }
2045 else 2045 else
2046 { 2046 {
2047 ix = regsize - 1; 2047 ix = regsize - 2;
2048 dx = 0; 2048 dx = 0;
2049 } 2049 }
2050 } 2050 }
@@ -2057,18 +2057,35 @@ namespace OpenSim.Region.Physics.OdePlugin
2057 iy += ix; // all indexes have iy + ix 2057 iy += ix; // all indexes have iy + ix
2058 2058
2059 float[] heights = TerrainHeightFieldHeights[heightFieldGeom]; 2059 float[] heights = TerrainHeightFieldHeights[heightFieldGeom];
2060 /*
2061 if ((dx + dy) <= 1.0f)
2062 {
2063 h0 = ((float)heights[iy]); // 0,0 vertice
2064 h1 = (((float)heights[iy + 1]) - h0) * dx; // 1,0 vertice minus 0,0
2065 h2 = (((float)heights[iy + regsize]) - h0) * dy; // 0,1 vertice minus 0,0
2066 }
2067 else
2068 {
2069 h0 = ((float)heights[iy + regsize + 1]); // 1,1 vertice
2070 h1 = (((float)heights[iy + 1]) - h0) * (1 - dy); // 1,1 vertice minus 1,0
2071 h2 = (((float)heights[iy + regsize]) - h0) * (1 - dx); // 1,1 vertice minus 0,1
2072 }
2073 */
2074 h0 = ((float)heights[iy]); // 0,0 vertice
2060 2075
2061 if ((dx + dy) <= 1.0f) 2076 if ((dy > dx))
2062 { 2077 {
2063 h0 = ((float)heights[iy]); // 0,0 vertice 2078 iy += regsize;
2064 h1 = (((float)heights[iy + 1]) - h0) * dx; // 1,0 vertice minus 0,0 2079 h2 = (float)heights[iy]; // 0,1 vertice
2065 h2 = (((float)heights[iy + regsize]) - h0) * dy; // 0,1 vertice minus 0,0 2080 h1 = (h2 - h0) * dy; // 0,1 vertice minus 0,0
2081 h2 = ((float)heights[iy + 1] - h2) * dx; // 1,1 vertice minus 0,1
2066 } 2082 }
2067 else 2083 else
2068 { 2084 {
2069 h0 = ((float)heights[iy + regsize + 1]); // 1,1 vertice 2085 iy++;
2070 h1 = (((float)heights[iy + 1]) - h0) * (1 - dy); // 1,1 vertice minus 1,0 2086 h2 = (float)heights[iy]; // vertice 1,0
2071 h2 = (((float)heights[iy + regsize]) - h0) * (1 - dx); // 1,1 vertice minus 0,1 2087 h1 = (h2 - h0) * dx; // 1,0 vertice minus 0,0
2088 h2 = (((float)heights[iy + regsize]) - h2) * dy; // 1,1 vertice minus 1,0
2072 } 2089 }
2073 2090
2074 return h0 + h1 + h2; 2091 return h0 + h1 + h2;