weapon+md2 model???
weapon+md2 model???
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
and can u tell me that how i can change the weapons in game?
thx
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.
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.
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.
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.
Hope this helps.
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.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.
a screen cap is worth 0x100000 DWORDS
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.
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.