2D Plane in 3D (not a 2D overlay)

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
jestermax
Posts: 17
Joined: Mon Feb 26, 2007 4:36 pm

2D Plane in 3D (not a 2D overlay)

Post by jestermax »

Hey, i read a post on using billboards for 2D objects in 3D space but don't billboards ONLY face the camera?

I don't want a screen space 2d rectangle or a billboard (if billboards only face forward)

Is there a way to render a texture to a plane? I'm looking for something that renders a 2D object that i can scale/rotate as if it were a 3D mesh. In Ogre i used the Mesh Manager to create a plane and then just mapped a texture to it as it was an entity.
Is there a way to do something similar with Irrlicht?
vitek
Bug Slayer
Posts: 3919
Joined: Mon Jan 16, 2006 10:52 am
Location: Corvallis, OR

Post by vitek »

You can create a plane mesh using the addHillPlaneMesh() method provided by the scene manager. That will get you an IAnimatedMesh*. You will want to get an IMesh* from that, and then make an IMeshSceneNode with that.

Code: Select all

core::dimension2df tileSize(10.f, 10.f);
core::dimension2df tileCount(10, 10);

scene::IAnimatedMesh* am = smgr->addHillPlaneMesh("plane", tileSize, tileCount);
if (am)
{
  scene::IMeshSceneNode* msn = smgr->addMeshSceneNode(am->getMesh(0));
  // msn->setPosition(...);
  // msn->setScale(...);
  // msn->setRotation(...);
  msn->setTexture(0, driver->getTexture("../../media/water.jpg"));
  msn->setMaterialFlag(video::EMF_LIGHTING, false);
}
Post Reply