Précédent   Forum du club des développeurs et IT Pro > Applications > Développement 2D, 3D et Jeux > Moteurs de jeux vidéo > XNA
XNA Forum d'entraide sur le développement avec XNA
Partagez cette discussion sur d'autres réseaux sociaux : Viadeo Twitter Google Facebook Digg Delicious MySpace Yahoo
Réponse
 
Outils de la discussion
Publicité
'
Vieux 16/06/2012, 21h27   #1
xps1616
Invité de passage
 
Inscription : mars 2011
Messages : 38
Détails du profil
Informations forums :
Inscription : mars 2011
Messages : 38
Points : 4
Points : 4
Par défaut Animer un modele fbx

Bonjour,

Je cherche à pouvoir animer (lever la main, faire pivoter la tête ...) le personnage du modèle dude.fbx (http://create.msdn.com/en-US/educati.../skinned_model). Pour cela, j'ai créé le code suivant :

Code :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
 
 public void Load(ContentManager content)
        {
            // Load the tank model from the ContentManager.
            model = content.Load<Model>("dude");
 
            // Look up shortcut references to the bones we are going to animate.
            Head = model.Bones["Head"];
 
            // Store the original transform matrix for each animating bone.
            HeadTransform = Head.Transform;
 
            // Allocate the transform matrix array.
            boneTransforms = new Matrix[model.Bones.Count];
        }
 
 public void Draw(Matrix world, Matrix view, Matrix projection)
        {
            // Set the world matrix as the root transform of the model.
            model.Root.Transform = world;
 
            // Calculate matrices based on the current animation position.
            Matrix Rotation = Matrix.CreateRotationX(RotationValue);
 
            // Apply matrices to the relevant bones.
            Head.Transform = Rotation * HeadTransform;
 
            // Look up combined bone matrices for the entire model.
            model.CopyAbsoluteBoneTransformsTo(boneTransforms);
 
            // Draw the model.
            foreach (ModelMesh mesh in model.Meshes)
            {
                foreach (BasicEffect effect in mesh.Effects)
                {
                    effect.World = boneTransforms[mesh.ParentBone.Index];
                    effect.View = view;
                    effect.Projection = projection;
 
                    effect.EnableDefaultLighting();
                }
 
                mesh.Draw();
            }
        }
Je me suis servi de cet exemple qui fonctionne parfaitement, on peut animer le modele comme on le souhaite : http://create.msdn.com/en-US/educati...mple_animation

Cependant, le code que j'ai créé ne fonctionne pas et je ne trouve pas l'erreur. Le personnage est correctement affiché mais n'est pas animé. Pouvez vous m'aider ?

Je vous remercie par avance.

Bonne journée
xps1616 est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 12/03/2013, 16h43   #2
middle6
Membre du Club
 
Homme mehdi bugnard
Développeur .NET
Inscription : décembre 2010
Messages : 95
Détails du profil
Informations personnelles :
Nom : Homme mehdi bugnard
Localisation : Suisse

Informations professionnelles :
Activité : Développeur .NET

Informations forums :
Inscription : décembre 2010
Messages : 95
Points : 54
Points : 54
Peut on voir le coté de la fonction Update ? ( linker le code ) Le moment ou vous mettez à jour l’animation du joueur ?
middle6 est déconnecté   Envoyer un message privé Réponse avec citation 00
Réponse
Outils de la discussion

Navigation rapide


Fuseau horaire GMT +2. Il est actuellement 15h24.


 
 
 
 
Partenaires

Hébergement Web