Hey have you ever seen in those games where the player moves around a 2d tree like in the early nitendo games and it seems to follow him well this is a simple snippet for that. Its not full source but it is a fun small code snippet and can save a bit of processing for trees in the distance that cannot be reached. Or For the Rotation of a portal and or enemy to face the player.
/////////// Game While Loop /////////////
while (device->run())// While Device is Running Do..
{
driver->beginScene(true, true, SColor(221,122,212,221));// Start The Scene
smgr->drawAll();// Draw all Scene Manager
guienv->drawAll();// Draw All Gui Environment
vector3df portalrot = player_node->getRotation();
portalrot.X = 0; // This stops it rotating on the X Axis
portalrot.Z = 0; // This stops it rotating on the Z Axis
portal_node->setRotation(portalrot); // Opps Forgot to add this
driver->endScene();
}
device->drop();
return 0;
Comments on the code are thanked.
Last edited by dejai on Fri Oct 12, 2007 2:40 pm, edited 1 time in total.
vector3df portalrot is initialised to be a copy of the node's rotation, it is not a reference to it. Changing the values in portalrot will have no effect on the node itself.
Urgh, no, I get what you mean, but you can't use the existing Irrlicht billboard for trees or anything more complex than really simple effects. Shudder.