Draw a tile on Floor

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
ansu832001
Posts: 95
Joined: Thu Mar 01, 2007 6:39 am

Draw a tile on Floor

Post by ansu832001 »

Can anyone help me on how to draw a Floor??it is ok even if iam able to draw a single tile
vitek
Bug Slayer
Posts: 3919
Joined: Mon Jan 16, 2006 10:52 am
Location: Corvallis, OR

Post by vitek »

Use the scene manager method addHillPlaneMesh to create a planar mesh. Create a mesh scene node from that.

Code: Select all

  core::dimension2df tileSize(10.f, 10.f);
  core::dimension2di tileCount(100, 100);
  f32 hillHeight = 0.f;
  core::dimension2df hillCount(0.f, 0.f);
  core::dimension2df textureRepeat;
  textureRepeat.Height = tileCount.Height / tileSize.Height;
  textureRepeat.Width  = tileCount.Width  / tileSize.Width;

  scene::IAnimatedMesh* mesh =
    smgr->addHillPlaneMesh("floor", tileSize, tileCount, 0, hillHeight, hillCount, textureRepeat);
  if (mesh)
  {
    scene::IMeshSceneNode* floor = smgr->addMeshSceneNode(mesh->getMesh(0));
    floor->setMaterialTexture(0, driver->getTexture("../../media/particlered.bmp"));
    floor->setMaterialFlag(video::EMF_LIGHTING, false);
  }
anandh
Posts: 61
Joined: Thu Sep 14, 2006 12:40 pm
Contact:

Post by anandh »

Code: Select all

sm->getSceneCollisionManager()->getCollisionPoint(
		line, metaSelector, end, triangle)
I'm trying to draw a addHillPlaneMesh at the intersection point (end).It's perfectly working.
can you brief how to rotate the plane to my triangle angle.
anandh
Posts: 61
Joined: Thu Sep 14, 2006 12:40 pm
Contact:

Post by anandh »

Code: Select all

sm->getSceneCollisionManager()->getCollisionPoint( 
      line, metaSelector, end, triangle) 
how to calculate angle of the triangle.
JP
Posts: 4526
Joined: Tue Sep 13, 2005 2:56 pm
Location: UK
Contact:

Post by JP »

Google it, look up aligning triangle to a normal or something and you should be able to find something.
Image Image Image
Post Reply