Jump to content
  • Advertisement
Sign in to follow this  
MohammadAhmed

Skinned Animation problem

This topic is 2014 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello every one , 

I am using Microsoft skinned model sample  , and my problem is Transformation problem ( Rotation).

 

Q : How to rotate the skinned model around when the camera move , and how to show the skinned model hand ?.( I just use camera.translation to translate the model and it's okay but it's not rotated ?? ).

Q2 : I assign a gun for  the model hand , now how to rotate the model hand + gun ?

Share this post


Link to post
Share on other sites
Advertisement

You want hands and gun to follow camera like in FPS games?

 

// offset matrix of gun/hand to reposition it where you like
matrix offMat;
offMat.rotate(...);
offMat.translate(...);
 
// take camera view matrix and invert it
matrix viewInvMat = camera->view;
viewInvMat.inverse();
 
// final transform
matrix finalMat = offMat * viewInvMat;

Share this post


Link to post
Share on other sites

You want hands and gun to follow camera like in FPS games?

 

 

// offset matrix of gun/hand to reposition it where you like
matrix offMat;
offMat.rotate(...);
offMat.translate(...);
 
// take camera view matrix and invert it
matrix viewInvMat = camera->view;
viewInvMat.inverse();
 
// final transform
matrix finalMat = offMat * viewInvMat;

This causes the model to behave oddly. The model lags behind where your camera is actually looking and the movement is jagged. Maybe a render target would work? I had a problem with my model's alpha a little while ago; it has since been fixed. The source I posted in this thread (http://www.gamedev.net/topic/639931-rendertargets-and-transparency) covers pretty much everything you need (both the code, and the shader).

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

Thanks for both of you  , vinn smile.png your code is great I will try it and post a reply okay smile.png , 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 ?

Edited by mrmohadnan

Share this post


Link to post
Share on other sites

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 smile.png your code is great I will try it and post a reply okay smile.png , 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.

7fiYdph.png

Edited by vinnyhalts

Share this post


Link to post
Share on other sites

woooooow vin :)  I am so happy for your code and the result , I will post comments ok If I face any problem :) so pls check my post while you are here if you have time .

Share this post


Link to post
Share on other sites

 

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 smile.png your code is great I will try it and post a reply okay smile.png , 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.

7fiYdph.png

 


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 )

Edited by mrmohadnan

Share this post


Link to post
Share on other sites

 

 

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 smile.png your code is great I will try it and post a reply okay smile.png , 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.

7fiYdph.png


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/

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!