I have been looking into the forum which have some very good snippets of code and been very useful. I have tried searching for this issue, but come across a brick wall. I just want to say when I click on the left cursor key, rotate my object by -1 unit
Here is my code which I have
Code: Select all
// INCLUDES ///////////////////////////////////
#include <irrlicht.h>
#include "MastEventReceiver.cpp"
using namespace irr;
using namespace core;
using namespace video;
using namespace scene;
#pragma comment(lib, "Irrlicht.lib")
// irrlicht specific
IrrlichtDevice *device=0;
IVideoDriver *driver=0;
ISceneManager *smgr=0;
scene::ISceneNode* node = 0;
int main()
{
// create the device
MastEventReceiver receiver;
device = irr::createDevice(EDT_DIRECT3D9 ,dimension2d<s32>(800,600),32,false,true,false,&receiver);
driver = device->getVideoDriver();
smgr = device->getSceneManager();
device->setWindowCaption(L"Psionic Normal Mapping Test");
ILightSceneNode* light1 = smgr->addLightSceneNode();
light1->setPosition(vector3df(0,0,-100));
IAnimatedMesh* mesh = smgr->getMesh("freebeast//beast.b3d");
IMesh *tmesh = smgr->getMeshManipulator()->createMeshWithTangents(mesh->getMesh(0));
//scene::IAnimatedMeshSceneNode* scene = smgr->addAnimatedMeshSceneNode(mesh);
scene::ISceneNode* scene = smgr->addMeshSceneNode(tmesh);
//IAnimatedMeshSceneNode* node = smgr->addAnimatedMeshSceneNode( mesh );
scene->setMaterialTexture(0,driver->getTexture("freebeast//beast1.jpg") );
video::ITexture* NormalMap = driver->getTexture("freebeast//n_beast.png");
driver->makeNormalMapTexture(NormalMap,20.0f);
scene->setMaterialTexture(1,NormalMap);
scene->setMaterialType(video::EMT_NORMAL_MAP_TRANSPARENT_VERTEX_ALPHA );
// scene->setMD2Animation(EMAT_CROUCH_WALK);
tmesh->drop();
smgr->addCameraSceneNode(0, vector3df(0,50,-150), vector3df(0,5,0));
while(device->run())
{
receiver.endEventProcess();
if (receiver.keyDown(KEY_LEFT))
{
tmesh->setrotation(0,+1,0);
}
driver->beginScene(true, true,SColor(0,55,55,55));
smgr->drawAll();
driver->endScene();
receiver.startEventProcess();
}
device->drop();
return 0;
}
The reason for doing:
Code: Select all
IAnimatedMesh* mesh = smgr->getMesh("freebeast//beast.b3d");
IMesh *tmesh = smgr->getMeshManipulator()->createMeshWithTangents(mesh->getMesh(0));
Code: Select all
if (receiver.keyDown(KEY_LEFT))
{
tmesh->setrotation(0,+1,0);
}
Code: Select all
'class irr::scene::IMesh' has no member named 'setrotation'
Many thanks