cherry12345
24-08-2009 11:26:12
Hi,
I have a one simple question:
1) There is any possiblity to use a PagedGeometry with Editable Terrain Manager? If yes, please share me with your code
I care about funcionality of both(PagedGeometry and Editable Terrain Manager).
Thanks for reading,
cherry12345
All you need is a function that returns the height of the ETM Terrain at a specific location. If ETM provides a function like that you can pass it to PG using the setHeightFunction() method. Read the documentation in your PG Docs folder, it has more details.
-Fish
neoranga974
26-08-2009 07:44:25
Hi,
Im doing it like this and it works :p, hope this can help. For info, u can use Etm with Newton too, if u search a bit on the forum u can find the generateTerrainCollision() function to get terrain vertex data into newton world.
Here is my code :
//PAGEDGEOMETRY
PagedGeometry *trees;
TreeLoader2D *treeLoader ;
Entity *tree1 ;
Ogre::Real getTerrainHeight(const float x, const float z, void *userData = NULL)
{
Ogre::Ray ray(Vector3(x, 5000.0f, z), Vector3::NEGATIVE_UNIT_Y);
std::pair<bool, Vector3> result = mTerrainInfo->rayIntersects(ray);
return result.second.y ;
}
treeLoader->setHeightFunction(&getTerrainHeight);