The static mesh on the left behaves properly. The animated mesh on the right should have its top moving up and down, but the animated portion is set back to its original rotation instead.
The code I used is below. I don't know how to upload my test meshes, so you'll need to provide your own.
Code: Select all
#include <irrlicht.h>
// Quick test to show how IMeshManipulator::transform fails to transform animated .b3d meshes
using namespace irr;
using namespace core;
using namespace scene;
using namespace video;
using namespace io;
using namespace gui;
int main()
{
IrrlichtDevice *device = createDevice( video::EDT_SOFTWARE,
dimension2d<u32>(640, 480), 16, false, false, false, 0);
if (!device) {return 1;}
device->setWindowCaption(L"IMeshManipulator Bug Demonstration");
IVideoDriver* driver = device->getVideoDriver();
ISceneManager* smgr = device->getSceneManager();
// Non-animated node, with mesh manip
IAnimatedMesh* mesh = smgr->getMesh("NonAnim.b3d");
if (!mesh)
{
device->drop();
return 1;
}
matrix4 rotateMatrix;
rotateMatrix.buildRotateFromTo(vector3df(0,1,0), vector3df(0,0,1));
smgr->getMeshManipulator()->transform(mesh, rotateMatrix);
IAnimatedMeshSceneNode* node = smgr->addAnimatedMeshSceneNode(mesh, 0,
-1, vector3df(-5, 0, 0));
if (node) { node->setMaterialFlag(EMF_LIGHTING, false); }
// Animated node, with mesh manip. This fails to be properly manipulated.
mesh = smgr->getMesh("Animated.b3d");
if (!mesh)
{
device->drop();
return 1;
}
smgr->getMeshManipulator()->transform(mesh, rotateMatrix);
node = smgr->addAnimatedMeshSceneNode(mesh, 0, -1, vector3df(5, 0, 0));
if (node)
{
node->setMaterialFlag(EMF_LIGHTING, false);
node->setFrameLoop (0, 20);
}
ICameraSceneNode* cam = smgr->addCameraSceneNode(0, vector3df(0,15,5), vector3df(0,5,0));
cam->setUpVector(vector3df(0,0,1));
while(device->run())
{
driver->beginScene(true, true, SColor(255,100,101,140));
smgr->drawAll();
driver->endScene();
}
device->drop();
return 0;
}
Microsoft Windows 7 Home Premium Edition Service Pack 1 (Build 7601)