how to get the ScenNode of ETL terrain' mesh

disney

10-05-2009 15:31:32

Hello! CABAListic
Recently , I try to use OgreNewt in ETL,
in oder to doing physical calculate, OgreNewt need the get the point of SceneNode which associate with the terrain mesh
Generally ,Ogrenewt take such way -----
.....
floor = mSceneMgr->createEntity("Floor", "simple_terrain.mesh" );
floornode = mSceneMgr->getRootSceneNode()->createChildSceneNode( "FloorNode" );
floornode->attachObject( floor );
floor->setMaterialName( "Simple/BeachStones" );
OgreNewt::Collision* col = new OgreNewt::CollisionPrimitives::TreeCollision( m_World, floornode, false );
......
the other way

......
TreeCollision( const World* world, int numVertices, Ogre::Vector3* vertices, Ogre::IndexData* indexData, bool optimize, FaceWinding fw = FW_DEFAULT);


/*!
\param world pointer to OgreNewt::World
\param numVertices number of vertices in the array.
\param vertices pointer to array of Ogre::Vector3 vertices (positions only)
\param indexData pointer to Ogre::IndexData for the mesh
\param optimize bool whether you want to optimize the collision or not.
*/

how to get the ScenNode of ETL terrain' mesh or indexData of ETL terrain' mesh
Can you show me the code here?

CABAListic

10-05-2009 15:43:18

ETL or ETM? I. e. did you use the version in svn or the one in the zip file?
In the first case you need to attach the terrain to a scene node, so you should already have it. ETM on the other hand creates one internally, it has the name TerrainName+"/Terrain", where TerrainName is the name you gave to the TerrainManager instance. Use the SceneManager to retrieve that node, but do not modify it in any way!

The vertex and index buffers, however, are entirely private and not accessible. You will have to construct the collision shape manually from the heightmap data. I can't help you with that, I've never used a physics library, sorry. But there are some posts about that in this forum.

disney

10-05-2009 18:33:07

I use ogitor with ETL ,
as your code
.......
mTerrain = new ET::Terrain("MyET", heights, Vector3(10, 60, 10));
SceneNode* terrainNode = mSceneMgr->getRootSceneNode()->createChildSceneNode(Vector3(0,0,0));
terrainNode->attachObject(mTerrain);
ET::Page* page = new ET::Page("MyETPage", mTerrain, 17, 65, true);
......
Is the mTerrain the Entity of mesh?

CABAListic

10-05-2009 18:43:25

No, ETL doesn't use Entities. mTerrain contains the heightmap data of the terrain though, so that's what you should use to construct your collision shape. page is the actual visual representation constructed from the heightmap, but as I said, its vertex and index buffers are private and not accessible.