check X Y Z for max value

master
Christopher 2020-08-06 02:08:09 +02:00
parent cd72e7b701
commit 027d8749a1
1 changed files with 8 additions and 4 deletions

View File

@ -90,7 +90,8 @@ namespace Flocking
for( int y = 0; y < regionY; y++ ) { for( int y = 0; y < regionY; y++ ) {
int zMax = Convert.ToInt32(m_scene.GetGroundHeight( x, y )); int zMax = Convert.ToInt32(m_scene.GetGroundHeight( x, y ));
for( int z = 1; z < zMax; z++ ) { for( int z = 1; z < zMax; z++ ) {
m_flowMap[x,y,z] = 100f; if (x < regionX && y < regionY && z < zMax)
m_flowMap[x,y,z] = 100f;
} }
} }
} }
@ -100,7 +101,9 @@ namespace Flocking
if( entity is SceneObjectGroup ) { if( entity is SceneObjectGroup ) {
SceneObjectGroup sog = (SceneObjectGroup)entity; SceneObjectGroup sog = (SceneObjectGroup)entity;
//todo: ignore phantom if (sog.IsPhantom)
continue;
float fmaxX, fminX, fmaxY, fminY, fmaxZ, fminZ; float fmaxX, fminX, fmaxY, fminY, fmaxZ, fminZ;
int maxX, minX, maxY, minY, maxZ, minZ; int maxX, minX, maxY, minY, maxZ, minZ;
sog.GetAxisAlignedBoundingBoxRaw( out fminX, out fmaxX, out fminY, out fmaxY, out fminZ, out fmaxZ ); sog.GetAxisAlignedBoundingBoxRaw( out fminX, out fmaxX, out fminY, out fmaxY, out fminZ, out fmaxZ );
@ -115,7 +118,8 @@ namespace Flocking
for( int x = minX; x < maxX; x++ ) { for( int x = minX; x < maxX; x++ ) {
for( int y = minY; y < maxY; y++ ) { for( int y = minY; y < maxY; y++ ) {
for( int z = minZ; z < maxZ; z++ ) { for( int z = minZ; z < maxZ; z++ ) {
m_flowMap[x,y,z] = 100f; if(x < maxX && y < maxY && z < maxX)
m_flowMap[x,y,z] = 100f;
} }
} }
} }