Skeletal animation?

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
Uberbot
Posts: 31
Joined: Thu Dec 13, 2007 4:07 am

Skeletal animation?

Post by Uberbot »

Hi all,

I'm told that Irrlicht supports skeletal animation. My understanding of this is that I could export a rigged/skinned model from Blender into, say, .obj format. Then Irrlicht would allow me to move bones and deform the skin appropriately. I would then be able to move a player's arm, for example.

Are there any tutorials or sample code? If not, where should I start reading...?

TIA.
Valmond
Posts: 308
Joined: Thu Apr 12, 2007 3:26 pm

Post by Valmond »

Check out the tutorial N°1 for example, it contains a skinned and animated mesh.

There are some tweaking to be done to get the exporter right (well usually),
I use the 'pipeline b3d' exporter and it works like a charm (except it doesn't export specular settings).

[edit] That works for animated skinmeshes, maybe I misunderstood the question and you want to move the bones by code?
If you want to it's quite straightforward too.
hybrid
Admin
Posts: 14144
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Actually, Sydney is not a skeletal animated mesh. Instead use the ninja or dawrf from the SDK meshes. You cannot use .obj, though, because this is neither animated, nor using a skeleton. You have to use .b3d, .ms3d, or .x
If you want to move the bones programatically, you can read in the Wiki how to do that.
Uberbot
Posts: 31
Joined: Thu Dec 13, 2007 4:07 am

Post by Uberbot »

hybrid wrote:Actually, Sydney is not a skeletal animated mesh. Instead use the ninja or dawrf from the SDK meshes. You cannot use .obj, though, because this is neither animated, nor using a skeleton. You have to use .b3d, .ms3d, or .x
If you want to move the bones programatically, you can read in the Wiki how to do that.
I understood about Sydney; I've used that model elsewhere. Yes, I am wanting to move the actual bones by program. I'll search the wiki. Does anyone have a snippet of code, though?
kazymjir
Posts: 727
Joined: Sat Feb 20, 2010 4:05 pm
Location: Munich, Bayern

Post by kazymjir »

Hi Uberbot, here is everything you need:
http://www.irrlicht3d.org/wiki/index.ph ... tionSystem

edit:
i wrote little example for you, it is using ninja.b3d model from media from irrlicht examples

Code: Select all

#include <irrlicht.h>

using namespace irr;

using namespace core;
using namespace scene;
using namespace video;

#ifdef _IRR_WINDOWS_
#pragma comment(lib, "Irrlicht.lib")
#pragma comment(linker, "/subsystem:windows /ENTRY:mainCRTStartup")
#endif



int main()
{

	IrrlichtDevice *device =
		createDevice( video::EDT_OPENGL, dimension2d<u32>(800, 600));


	IVideoDriver* driver = device->getVideoDriver();
	ISceneManager* smgr = device->getSceneManager();

        smgr->addCameraSceneNode(0, vector3df(0,10,-10), vector3df(0,5,0));

        IAnimatedMesh* mesh = smgr->getMesh("./media/ninja.b3d");
	IAnimatedMeshSceneNode* node = smgr->addAnimatedMeshSceneNode(mesh);
	node->setMaterialFlag(EMF_LIGHTING, false);
	node->setMaterialTexture( 0, driver->getTexture("./media/nskinrd.jpg") );
        node->setRotation(vector3df(0,180,0)); // let ninja be in front to us

        node->setJointMode(EJUOR_CONTROL); // tell irrlicht that you want to control joint positions

        IBoneSceneNode* bone = node->getJointNode("Joint10"); // create IBoneSceneNode and select the desired bone
        
	while(device->run()) {
            bone->setRotation(bone->getRotation() + vector3df(1,0,0)); // rotate bone
            
            driver->beginScene();
            smgr->drawAll();
            driver->endScene();
	}


	device->drop();

	return 0;
}
Uberbot
Posts: 31
Joined: Thu Dec 13, 2007 4:07 am

Thank you!

Post by Uberbot »

Thank you. This is, INDEED, everything I need.

:D
Post Reply