Morphing Terrain Issues: Difference between revisions
m (→Work-arounds: spelling) |
m (typos & minor tidy) |
||
Line 1: | Line 1: | ||
== Synopsis == | |||
==Synopsis== | |||
Using the [[Env_terrainmorph]] does not update the collision hull. Tracing through the code leads you to engine->ApplyTerrainMod(), and the trail | Using the [[Env_terrainmorph]] does not update the collision hull. Tracing through the code leads you to engine->ApplyTerrainMod(), and the trail basically ends there for the SDK. Can anything be done to "fix" this? Morphable terrain isn't very useful when it doesn't modify the collisions. I heard there was an E3 Demo of Source and the ability to morph the terrain along with updating the collisions was shown, yet the functionality appears to be absent now. | ||
==Work-arounds== | == Work-arounds == | ||
The only work-around that exists is to add in a [[func_movelinear]] or other moving brush, and simply have that move under the terrain to make the brushes' shape match what the terrain is supposed to be. This is not, however, always practical. | The only work-around that exists is to add in a [[func_movelinear]] or other moving brush, and simply have that move under the terrain to make the brushes' shape match what the terrain is supposed to be. This is not, however, always practical. | ||
If the terrain represents snow, that the collision hulls are ''not'' updated can create a depth to your snow displacements. | If the terrain represents snow, that the collision hulls are ''not'' updated can create a depth to your snow displacements. | ||
==The | == The problem == | ||
The following is engine code that is included in the SDK in '''src\public\dispcoll_common.cpp''': | The following is engine code that is included in the SDK in '''src\public\dispcoll_common.cpp''': | ||
//----------------------------------------------------------------------------- | //----------------------------------------------------------------------------- | ||
Line 24: | Line 24: | ||
} | } | ||
// Setup/create the leaf nodes first so the | // Setup/create the leaf nodes first so the recursion can use this data to stop. | ||
AABBTree_CreateLeafs(); | AABBTree_CreateLeafs(); | ||
Line 34: | Line 34: | ||
'''#endif''' | '''#endif''' | ||
} | } | ||
[[Category: Developer Issues and Workarounds]] |
Revision as of 10:09, 14 February 2008
Synopsis
Using the Env_terrainmorph does not update the collision hull. Tracing through the code leads you to engine->ApplyTerrainMod(), and the trail basically ends there for the SDK. Can anything be done to "fix" this? Morphable terrain isn't very useful when it doesn't modify the collisions. I heard there was an E3 Demo of Source and the ability to morph the terrain along with updating the collisions was shown, yet the functionality appears to be absent now.
Work-arounds
The only work-around that exists is to add in a func_movelinear or other moving brush, and simply have that move under the terrain to make the brushes' shape match what the terrain is supposed to be. This is not, however, always practical.
If the terrain represents snow, that the collision hulls are not updated can create a depth to your snow displacements.
The problem
The following is engine code that is included in the SDK in src\public\dispcoll_common.cpp:
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CDispCollTree::ApplyTerrainMod( ITerrainMod *pMod ) { #if 0 int nVertCount = GetSize(); for ( int iVert = 0; iVert < nVertCount; ++iVert ) { pMod->ApplyMod( m_aVerts[iVert].m_vecPos, m_aVerts[iVert].m_vecOrigPos ); pMod->ApplyMod( m_aVerts[iVert].m_vecPos, m_aVerts[iVert].m_vecOrigPos ); } // Setup/create the leaf nodes first so the recursion can use this data to stop. AABBTree_CreateLeafs(); // Generate bounding boxes. AABBTree_GenerateBoxes(); // Create the bounding box of the displacement surface + the base face. AABBTree_CalcBounds(); #endif }