Ms3d and MD2

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
cyberbobjr
Posts: 64
Joined: Mon Sep 08, 2003 8:21 am
Location: Paris, France

Ms3d and MD2

Post by cyberbobjr »

Hi,
It seem that we can get the bone (or joint or node) of a MS3D model with the function "getMS3DJointNode", but in the same, only MD2 model can be animated...
It is possible to get the advantage of animation with MD2 and the advantage of subnode (or bone or joint) of MS3D ?
Thanks for your help.
Regards.
cyb
niko
Site Admin
Posts: 1759
Joined: Fri Aug 22, 2003 4:44 am
Location: Vienna, Austria
Contact:

Post by niko »

Hm, I did not really understand your problem. Maybe I'm to tired.. :) What do you mean by advantage of animation?
cyberbobjr
Posts: 64
Joined: Mon Sep 08, 2003 8:21 am
Location: Paris, France

Post by cyberbobjr »

Can i play animation with MS3D model with a function like setMD2Animation ?
niko
Site Admin
Posts: 1759
Joined: Fri Aug 22, 2003 4:44 am
Location: Vienna, Austria
Contact:

Post by niko »

ok, thanks :)
No, only with setFrameLoop.
cyberbobjr
Posts: 64
Joined: Mon Sep 08, 2003 8:21 am
Location: Paris, France

Post by cyberbobjr »

Mmhhh... seem that MS3D's animations not being played by setFrameLoop. :cry:
niko
Site Admin
Posts: 1759
Joined: Fri Aug 22, 2003 4:44 am
Location: Vienna, Austria
Contact:

Post by niko »

Hm, I works fine here. Check if you set the correct frame loop. For example you could check how much frames there are in your ms3d file with getFrameCount ().
cyberbobjr
Posts: 64
Joined: Mon Sep 08, 2003 8:21 am
Location: Paris, France

Post by cyberbobjr »

Yes !
This is strange because i have get a model on the Net (ninja) and the text file tell me this :

Code: Select all

1-14	Walk (normal)
15-30	Stealth Walk
32-44	Punch and swipe sword
45-59	Swipe and spin sword
60-68	Overhead twohanded downswipe
69-72	Up to block position (play backwards to lower sword if you want)
73-83	Forward kick
84-93	Pick up from floor (or down to crouch at frame 87)
94-102	Jump
103-111	Jump without height (for programmer controlled jumps)
112-125	High jump to Sword Kill (Finish em off move??)
126-133	Side Kick
134-145	Spinning Sword attack (might wanna speed this up in game)
146-158	Backflip
159-165	Climb wall
166-173	Death 1 - Fall back onto ground
174-182	Death 2 - Fall forward onto ground
184-205	Idle 1 - Breathe heavily
206-250	Idle 2
251-300	Idle 3
But it seems that the number doesn't correspond ...
But it work, and i'm really happy because with this feature : getMS3DJointNode i can do localized damages (i check the transformed bounding box of the node) ! :D

thanks for all !
cyberbobjr
Posts: 64
Joined: Mon Sep 08, 2003 8:21 am
Location: Paris, France

Post by cyberbobjr »

Ok, i understand :

with getFrameCount i have 12000 frames...
and in the model i have 300 frames !?!?

with this calculation, i have found the correct range of frame :
1-14 Walk (normal)
15-30 Stealth Walk

range_walk_1 = (12000/300)*1
range_walk_2 = (12000/300)*14

range_stealthwalk_1 = (12000/300)*15
range_stealthwalk_2 = (12000/300)*30

etc...

How can you explain that ?
niko
Site Admin
Posts: 1759
Joined: Fri Aug 22, 2003 4:44 am
Location: Vienna, Austria
Contact:

Post by niko »

Ah, your're right, I forgot that. :)
The reason why the frame number is multiplied is because using only 300 frames, your animation would not be smooth at all. By multiplying the frame number with (for example here 40), it is getting smoother. By the factor 40, in this case. I should add a comment on this in the documentation. :)
cyberbobjr
Posts: 64
Joined: Mon Sep 08, 2003 8:21 am
Location: Paris, France

Post by cyberbobjr »

This calcul is in all case or only when number of frame is lower ?
niko
Site Admin
Posts: 1759
Joined: Fri Aug 22, 2003 4:44 am
Location: Vienna, Austria
Contact:

Post by niko »

no, in all cases
WhytWulf
Posts: 51
Joined: Mon Sep 08, 2003 11:14 am
Location: Australia, Tamworth, NSW
Contact:

Post by WhytWulf »

I just thought I'd have a go with ms3d modeling/animation.. I found out I suck :)
The problem is, I know I animated my ms3d file, I can scrub back and forth and see it animate in MShape. but when I load the mesh into irrlicht I just hmm.. no animations..

This is what I use to load the mesh

Code: Select all

scene::IAnimatedMesh* mesh = 0;
//	mesh = sm->getMesh(".\\Meshes\\Models\\test_soldier.md2");
mesh = sm->getMesh("wart.ms3d");
if (mesh)
{
model1 = sm->addAnimatedMeshSceneNode(mesh);
if (model1)
{
model1->setMaterialTexture(0, driver->getTexture("wart_2_working2.bmp"));
model1->setPosition(core::vector3df(100,40,-80));
model1->setScale(core::vector3df(1,1,1));
model1->setFrameLoop(1,31);
model1->setAnimationSpeed(15);
//	model1->setMD2Animation(scene::EMAT_SALUTE);
//	model1->setMaterialFlag(video::EMF_LIGHTING, false);
//	model1->setMaterialType(video::EMT_SPHERE_MAP);
model1->addShadowVolumeSceneNode();
The mesh and texture displays, but no animations...Ok one thing I did notice was when the mesh first displayed its frame 1 was all screwed up. the bones were a little stuffed up and in wrong place..

Ideas..??
Project Admin -
http://shadowrunonline.sourceforge.net

------------------------------------
There are 10 kinds of people, those that understand binary and those that don't.
cyberbobjr
Posts: 64
Joined: Mon Sep 08, 2003 8:21 am
Location: Paris, France

Post by cyberbobjr »

Hi,
Yep, it's the same problem i've with my mesh. the first frame is screwed up, but if you read my previous post, you'll see the solution ! :
get total numbers of frames with getFrameCount (ex : 12000)
divide the getFrameCount by the effective number of frames of your animation (ex : 12000/300 = 40)
multiply this factor (40) by the number of the frame you want to display (in your example : 40*1 and 40*31) and you'll get :

Code: Select all

model1->setFrameLoop(40,1240); 
That's all...
Soldier of infortune
Posts: 29
Joined: Fri Sep 19, 2003 8:36 am

Post by Soldier of infortune »

Hello !
Have you got a link to download a ms3d model with animation ?

Thanks !

I can convert Half-life model to ms3d model but I have got a problem to have animation in my model !
cyberbobjr
Posts: 64
Joined: Mon Sep 08, 2003 8:21 am
Location: Paris, France

Post by cyberbobjr »

Here you can find a ninja and a zombie :
http://www.insanesoftware.de/index.php? ... ources.php
Post Reply