From 8bc72ad9f9282dc152c82744f7528174809d5ba7 Mon Sep 17 00:00:00 2001 From: Daniel Buckmaster Date: Thu, 13 Jun 2013 10:15:48 +1000 Subject: [PATCH] Fixed GroundCover placement on rotated TerrainBlocks. --- Engine/source/T3D/fx/groundCover.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Engine/source/T3D/fx/groundCover.cpp b/Engine/source/T3D/fx/groundCover.cpp index 53c910c3c..1d0c2f9fd 100644 --- a/Engine/source/T3D/fx/groundCover.cpp +++ b/Engine/source/T3D/fx/groundCover.cpp @@ -1225,14 +1225,17 @@ GroundCoverCell* GroundCover::_generateCell( const Point2I& index, flipBB *= -1.0f; PROFILE_START( GroundCover_TerrainRayCast ); - hit = terrainBlock->getNormalHeightMaterial( Point2F( cp.x - pos.x, cp.y - pos.y ), + // Transform billboard point into terrain's frame of reference. + Point3F pp = Point3F(cp.x, cp.y, 0); + terrainBlock->getWorldTransform().mulP(pp); + hit = terrainBlock->getNormalHeightMaterial( Point2F ( pp.x, pp.y ), &normal, &h, matName ); + PROFILE_END(); // GroundCover_TerrainRayCast // TODO: When did we loose the world space elevation when // getting the terrain height? h += pos.z + mZOffset; - PROFILE_END(); // GroundCover_TerrainRayCast if ( !hit || h > typeMaxElevation || h < typeMinElevation || ( typeLayer[0] && !typeInvertLayer && matName != typeLayer ) || ( typeLayer[0] && typeInvertLayer && matName == typeLayer ) )