This causes the model to behave oddly. The model lags behind where your camera is actually looking and the movement is jagged
Thats for you maybe, for me it works fine.
I assume that model is centered at origin and "pointing" in positive Z axis. Camera view matrix must be updated before you extract view matrix and use it for gun/hand final matrix.
Yeah, I see what you mean. It'll be easier to just draw the model in front of the camera.
>>>>>Thanks for both of you , vinn your code is great I will try it and post a reply okay , belfegor I try it before and did not work for me :/ sorry , by the way thank you .
Q1 : How to show just the model hand and the gun ?
Q2 : How to make the town hands catch the gun (not just one !) , is that should be done in modeling software or I can make this as transformation matrices based on View matrices ...
.etc ?
One: You normally make a model of just the hands and the gun, then draw it in front of the screen or on a render target.
Two: You want the same model to hold and use multiple weapons? It'll probably be easier to just model the hands onto the guns, and animate it from there. So you will have to use some modeling software. Blender is free, if you don't have anything to use.
I use two models, one is the third person model; I only use it in multiplayer or for shadows. The second is the first person view. Which is just the arms and weapons.
Here is a debug photo to help you visualize how the model looks and how to draw it.
Yeah , I got it , but for enemy models ? I can't do the same for them , so I can't just draw their hands ( Right vinn ?) . I see you just make a trick by drawing the Model hands ! and used person model to simulate shadows , but you don't draw the person model . Instead , you used him to draw shadow ? ( Right Vinn ?)
Q : OK but what about the ragDoll to simulate model when dies ?
Q2 : Second , Vinn in your post "http://www.gamedev.net/topic/639931-rendertargets-and-transparency/ " why did you use render target ? why just not draw the model with it's transformation matrices to rotate the hands ? is that hard implementation or what ?
Q3 : Can you Vinn summarize the process of rotating Model hand and the gun ?( as I am now a little bit confusing as I did not even think to draw just model hands , I am using skinned model sample from Microsoft and I do every thing for the model (sit , run , stop ...etc) and all I need is to rotate his hands and gun while his body just follow the camera by changing it's translation matrices )
Most of the time the ragdoll is tied in with the physics. BEPUPhysics is excellent and free. Take a look at their action figure and one armed man demos. They should solve your ragdoll problems.
As for the render target, I was going to use different rendering styles for the environment and weapons.
To move the hands, you would simply play the animation you want to use. So for example, when you press W to go forward (on the PC), you set the current playing animation to your walking animation. When you are idle, play the idle animation. It's less than ideal to draw an entire player's model, then put the camera behind the arms. The 3rd person model and the arms should be two different models.
So just to summarize:
1. Draw the arms on screen, in front of the camera.
2. Set the current animation based on player movement.
3. Play the animation.
Here is a pretty decent animation library: http://animationcomponents.codeplex.com/