Sign in to follow this  
lego666

Help - XNA model animation

Recommended Posts

I'm a very beginner to game programming, but i'm learning now how to program games..... but i have i very simple question about a thing in gaming... Rotation: lets suppose that we are making a 3d artillery game, the gun will turn(rotate ) left and right, and up and down..... and the gun is made by a model editor software, should the programmer include an animation of the gun (rotating it) in the design the then use it, or the gun will be static, and the programming code will make it rotate??? plzzz explain to me..... and thx.... ps: my first post [Edited by - Ravuya on March 26, 2009 1:42:35 PM]

Share this post


Link to post
Share on other sites
Almost always for something like this it will be rotated in code nowadays.

Consider also an FPS - you can see other players move their head as they walk and look around - animation can be blended with dynamic code-based movement/rotation.

Just to note: This forum is about designing the ideas and gameplay of games, rather than implementation details - Try the Beginners or Game Programming forums

Share this post


Link to post
Share on other sites
plz i want more help... my point is that the hole gun is static and is one object... lrts say this function rotate it
rotate.gun alpha ...like that...
it will all rotate while i need to to rotate only the main gun... suppose it on a tank... i need to rotate only the gun, note the tank... where there are one object.... is any trick for that? should i split them into two object.. plz explain more

Share this post


Link to post
Share on other sites
You create a skeleton for the mesh; you attach vertices to particular "bones". You rotate only the bones needed to rotate your gun. Typically for something like tanks, yes it's rotated in code because it's just a machine. non-machine characters are normally almost always aimed by blending between authored animations, with maybe a little bit of pure code-side touch-up to get the rotation precise.

Search for "skeletal animation"

-me

Share this post


Link to post
Share on other sites
Usually it's rotated by the code, because it would be a huge waste of space to have a separate rendering for all 360 degrees of a turret. It would depend on what you're programming in, but I would keep the turret as a separate object. When you draw it, pick it's coordinate relative to the base, and then you can rotate it freely.

Share this post


Link to post
Share on other sites
Quote:
plzz guys , can anyone send me a tutorial for that thing written above... just a simple tutorial...........
You might have a hard time finding a tutorial that specific. Most likely, you'll just need to piece together the information you need from different sources, which will probably involve some research. It can be hard work, but it's a more or less unavoidable part of the process of creating games (or any software, for that matter).

For the problem described, I'd recommend breaking it down into smaller tasks, e.g.:

1. Loading a 'turret' model and displaying it.
2. Making the model yaw and pitch in response to user input.

For a tank (composed of a body and a turret), you probably don't need anything as complex as skeletal animation; a simple transform hierarchy with two nodes will do.

If you get stuck on some particular aspect of the problem, you can always post here with specific questions.

Share this post


Link to post
Share on other sites
i understand now the basics of animation, because i'm beginner.... as i read there are 2 kind of animation, keyframe (i understand how it work and how to code it), and the skeletal animation (for this one i understand the basic of it, but for the code i didn't know how it work(code)).... plzz explain for me a little about skeletal animation...
i read in a book for xna that xna didn't make skeletal animation, but u can iclude them in...!!... how is this??

Share this post


Link to post
Share on other sites
Quote:
i understand now the basics of animation, because i'm beginner.... as i read there are 2 kind of animation, keyframe (i understand how it work and how to code it), and the skeletal animation (for this one i understand the basic of it, but for the code i didn't know how it work(code)).... plzz explain for me a little about skeletal animation...
i read in a book for xna that xna didn't make skeletal animation, but u can iclude them in...!!... how is this??
For your example of a tank with a turret, you don't need keyframe animation or skeletal animation; simple procedural animation will suffice. Have your requirements changed? Are you sure that you need to be worrying about advanced techniques such as skeletal animation?

I don't know anything about skeletal animation in XNA, but in general, skeletal animation is non-trivial to implement. There are plenty of good resources on the subject, but I don't know of any simple tutorials that'll just 'walk you through it' (maybe someone else does though...).

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this