I have an animated mesh of a knight that I've exported from Blender in an .x file.
The knight can walk or stand still.
The still animation always look good.
The walk animation is ok with OpenGL, but not with Direct3D9.
There is a problem with the x axis.
All the bones with their local x axis pointing towards the negative global x axis have problems. Looks to me that they rotate around their local z axis...
Obviously, this is a bug, because simply switching to OpenGL solves the problem.
Maybe there's only a little mistake in a transformation matrix of the bones.
Any other idea about what may cause this problem?
[D3D][IAnimatedMesh] Incorrect joints anim
-
- Admin
- Posts: 3590
- Joined: Mon Oct 09, 2006 9:36 am
- Location: Scotland - gonnae no slag aff mah Engleesh
- Contact:
What version of Irrlicht, and can you make the model available?
Please upload candidate patches to the tracker.
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
-
- Posts: 59
- Joined: Thu May 01, 2008 1:20 am
- Location: New Caledonia (France - Pacific)
- Contact:
I tried with SVN trunk and 1.4.1 => same thing.
The .x and .blend files are here http://studentweb.usq.edu.au/home/w0062 ... 20anim.zip
Try this code and see what happens
The .x and .blend files are here http://studentweb.usq.edu.au/home/w0062 ... 20anim.zip
Try this code and see what happens
Code: Select all
#include <irrlicht.h>
using namespace irr;
using namespace core;
using namespace scene;
using namespace video;
using namespace io;
using namespace gui;
#ifdef _IRR_WINDOWS_
#pragma comment(lib, "Irrlicht.lib")
#endif
int main() {
IrrlichtDevice* device = createDevice(EDT_DIRECT3D9, dimension2d<s32>(640, 480)); // problem with D3D
//IrrlichtDevice* device = createDevice(EDT_OPENGL, dimension2d<s32>(640, 480)); // GL is ok
ISceneManager* smgr = device->getSceneManager();
IVideoDriver* driver = device->getVideoDriver();
// load an animated mesh
IAnimatedMesh* knightMesh = smgr->getMesh("C:\\model game tale knight v6.x"); // change the path
IAnimatedMeshSceneNode* knightNode = smgr->addAnimatedMeshSceneNode(knightMesh);
knightNode->setPosition(vector3df(0,0,-50));
knightNode->setScale(vector3df(2,2,2));
knightNode->setMaterialFlag(EMF_LIGHTING, false);
// here is the problem with the joint animations
knightNode->setFrameLoop(31,79); // walk => will look funny with D3D
//knightNode->setFrameLoop(1,24); // still => looks ok with both GL and D3D
// setup camera
ICameraSceneNode* cam = smgr->addCameraSceneNodeFPS();
cam->setTarget(knightNode->getPosition());
// main loop
SColor backgroundColor(255,128,128,150);
while( device->run() ) {
driver->beginScene(true, true, backgroundColor);
smgr->drawAll();
driver->endScene();
}
device->drop();
return EXIT_SUCCESS;
}