weapon+md2 model???

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.
Post Reply
freestyle
Posts: 4
Joined: Wed Mar 10, 2004 6:13 pm

weapon+md2 model???

Post by freestyle »

how can i put the weapon in the hand of a md2 model???
and can u tell me that how i can change the weapons in game?
thx
jordanXXX
Posts: 13
Joined: Sun Apr 25, 2004 4:28 am

Post by jordanXXX »

I wanna know ....:)

who can help us ?

md3 ???
Electron
Posts: 874
Joined: Sun Mar 14, 2004 12:05 am
Location: Massachusetts USA

Post by Electron »

I do not know if this is possible with .md2, I can't think of a way. Is easy with .x, .ms3d, or .md3(though this is not natively supported by Irrlicht :( )
Guest

Post by Guest »

So overall, would .x handling be easier in the environment, i.e. holding stuff, movement...etc? I'm debating whether or not to use md2's or .x models for my game.
Electron
Posts: 874
Joined: Sun Mar 14, 2004 12:05 am
Location: Massachusetts USA

Post by Electron »

Well, .x is a more up to date format than the somewhat old .md2 and I definitely think holding stuff would be much easier with .x. One thing to be aware of though is that .x uses skeletal animation (as opposed to morph animation used by .md2 or .md3) whcih gives it greater flexibility (well Irrlicht can't take advantage of this yet, but it is possible to manipulate the skelton in real-time for ragdolls). However, the flexibility of a skeletal animation system has a downside, vertices are generally computed in real time (the .x file does not store verties for every frame), meaning increased CPU time. Another downside to .x, though not with the format itself, is that there does not seem tobe a wealth of free tools that export .x, at least not with bones and weights. CharacterFX (which is $15 I think and is supposed to be good for animation) I believe has .x export. Blender can export .x to some extent, but not yet with bones and weights (I'm not sure if it can export any animation at all since I thought skeletal animation had to be done with bones and weights, but I'm not too sure on that). My hopes are on blender, a bones and weights .x export is supposedly in the works, I jsut hope it doesn't take too long. Too bad gmax doesn't have a .x export and that the TrueX plugin for Truespace doesn't work with the free version 3 of Truespace (that's what I heard anyway). I too have been thinking a lot lately about what model format to use, hence the rambling.
arras
Posts: 1622
Joined: Mon Apr 05, 2004 8:35 am
Location: Slovakia
Contact:

Post by arras »

Character FX works fine exporting x files with animation.
Another program which have good x export is Milkshape ...it doesnt have weighted wertices yet.
Masdus
Posts: 186
Joined: Tue Aug 26, 2003 1:13 pm
Location: Australia

Post by Masdus »

with md2 models you cannot simply attach a weapon to the model in the game. The weapon needs to be part of the model when you make it in your modeling program.
Electron
Posts: 874
Joined: Sun Mar 14, 2004 12:05 am
Location: Massachusetts USA

Post by Electron »

Which is of course rather limiting
Domarius
Posts: 178
Joined: Thu Mar 11, 2004 9:51 am
Location: Brisbane, QLD, Australia

Post by Domarius »

Which leaves you with the options of;

Modelling a 'generic weapon' that your character holds, to represent all weapons, or

Making some system where you can put a weapon in their hands using code - like making it so their hold the gun dead still as they do their run or walk animation, then you could just set the gun to their position, with an offset.
guest1

Post by guest1 »

the way they did it in Quake3 -- I dunno about the other ones, is they used a single triangle to define the location of where the gun will be attached. This is rather difficult to code because it requires you to (during the model load) go through and get the mesh buffer for every frame, find that polygon (it'll be the only one with a certain size and a 90 right angle) and get the position of it, and then also grab the vector of the two vertexes and convert that to a euler angle to setRotation on your model (also setPosition) -- all of these rotations and positions need to be set in an array, so when you set the frame for animation, you're also going to set the position and the rotation of the gun based on the corrisponding one in the array.

Hope this helps.
keless
Posts: 805
Joined: Mon Dec 15, 2003 10:37 pm
Location: Los Angeles, California, USA

Post by keless »

However, the flexibility of a skeletal animation system has a downside, vertices are generally computed in real time (the .x file does not store verties for every frame), meaning increased CPU time.
This isnt so much an issue with modern video cards-- typically this is handled on the video card using an ARB function (in OGL) or some other name in DirectX. Depends on how Niko implemented it in Irrlicht as to whether or not Irrlicht can take advantage of this however.
a screen cap is worth 0x100000 DWORDS
puh
Posts: 356
Joined: Tue Aug 26, 2003 3:53 pm

Post by puh »

As far as I know the only function in Irrlicht used for attaching weapon is:
irr::scene::IAnimatedMeshMS3D::getMatrixOfJoint
irr::scene::IAnimatedMeshX::getMatrixOfJoint
From API: Returns a pointer to a transformation matrix of a part of the mesh based on a frame time. This is used for being able to attach objects to parts of animated meshes. For example a weapon to an animated hand.
Post Reply