IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Ogre Discussion :

Problème animation


Sujet :

Ogre

  1. #1
    Futur Membre du Club
    Inscrit en
    Janvier 2007
    Messages
    5
    Détails du profil
    Informations forums :
    Inscription : Janvier 2007
    Messages : 5
    Points : 5
    Points
    5
    Par défaut Problème animation
    Ce code source est conctruit pour que le robot marche entre deux points, mais quand je l'ai testé j'ai constaté que le robot est entrain de marcher mais il ne ce deplace pas. le code source :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    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
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
     
    #include "ExampleApplication.h"
     
    #include <deque>
    using namespace std;
     
    class MoveDemoListener : public ExampleFrameListener
    {
    public:
     
        MoveDemoListener(RenderWindow* win, Camera* cam, SceneNode *sn,
            Entity *ent, deque<Vector3> &walk)
            : ExampleFrameListener(win, cam, false, false), mNode(sn), mEntity(ent), mWalkList( walk )
        {
    		// Set idle animation
            mAnimationState = ent->getAnimationState( "Walk" );
            mAnimationState->setLoop( true );
            mAnimationState->setEnabled( true );
        } // MoveDemoListener
     
        /* This function is called to start the object moving to the next position
           in mWalkList.
        */
        bool nextLocation( )
        {
            return true;
        } // nextLocation( )
     
        bool frameStarted(const FrameEvent &evt)
        {
    		mAnimationState->addTime( evt.timeSinceLastFrame );
            return ExampleFrameListener::frameStarted(evt);
        }
    protected:
        Real mDistance;                  // The distance the object has left to travel
        Vector3 mDirection;              // The direction the object is moving
        Vector3 mDestination;            // The destination the object is moving towards
     
        AnimationState *mAnimationState; // The current animation state of the object
     
        Entity *mEntity;                 // The Entity we are animating
        SceneNode *mNode;                // The SceneNode that the Entity is attached to
        std::deque<Vector3> mWalkList;   // The list of points we are walking to
     
        Real mWalkSpeed;                 // The speed at which the object is moving
    };
     
     
    class MoveDemoApplication : public ExampleApplication
    {
    protected:
    public:
        MoveDemoApplication()
        {
     
        }
     
        ~MoveDemoApplication() 
        {
        }
    protected:
        Entity *mEntity;                // The entity of the object we are animating
        SceneNode *mNode;               // The SceneNode of the object we are moving
        std::deque<Vector3> mWalkList;  // A deque containing the waypoints
     
        void createScene(void)
        {
    		mSceneMgr->setAmbientLight( ColourValue( 1.0f, 1.0f, 1.0f ) );
    		// Create the entity
            mEntity = mSceneMgr->createEntity( "Robot", "robot.mesh" );
     
            // Create the scene node
            mNode = mSceneMgr->getRootSceneNode( )->
                createChildSceneNode( "RobotNode", Vector3( 0.0f, 0.0f, 25.0f ) );
            mNode->attachObject( mEntity );
    		// Create the walking list
            mWalkList.push_back( Vector3( 550.0f,  0.0f,  50.0f  ) );
            mWalkList.push_back( Vector3(-100.0f,  0.0f, -200.0f ) );
    		// Create objects so we can see movement
            Entity *ent;
            SceneNode *node;
     
            ent = mSceneMgr->createEntity( "Knot1", "knot.mesh" );
            node = mSceneMgr->getRootSceneNode( )->createChildSceneNode( "Knot1Node",
                Vector3(  0.0f, -10.0f,  25.0f ) );
            node->attachObject( ent );
            node->setScale( 0.1f, 0.1f, 0.1f );
     
            ent = mSceneMgr->createEntity( "Knot2", "knot.mesh" );
            node = mSceneMgr->getRootSceneNode( )->createChildSceneNode( "Knot2Node",
                Vector3( 550.0f, -10.0f,  50.0f ) );
            node->attachObject( ent );
            node->setScale( 0.1f, 0.1f, 0.1f );
     
            ent = mSceneMgr->createEntity( "Knot3", "knot.mesh" );
            node = mSceneMgr->getRootSceneNode( )->createChildSceneNode( "Knot3Node",
                Vector3(-100.0f, -10.0f,-200.0f ) );
            node->attachObject( ent );
            node->setScale( 0.1f, 0.1f, 0.1f );
    		// Set the camera to look at our handywork
            mCamera->setPosition( 90.0f, 280.0f, 535.0f );
            mCamera->pitch( Degree(-30.0f) );
            mCamera->yaw( Degree(-15.0f) );
        }
     
        void createFrameListener(void)
        {
            mFrameListener= new MoveDemoListener(mWindow, mCamera, mNode, mEntity, mWalkList);
            mFrameListener->showDebugOverlay(true);
            mRoot->addFrameListener(mFrameListener);
        }
     
    };
     
     
    #if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
    #define WIN32_LEAN_AND_MEAN
    #include "windows.h"
     
     
    INT WINAPI WinMain( HINSTANCE hInst, HINSTANCE, LPSTR strCmdLine, INT )
    #else
    int main(int argc, char **argv)
    #endif
    {
        // Create application object
        MoveDemoApplication app;
     
        try {
            app.go();
        } catch( Exception& e ) {
    #if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
            MessageBox( NULL, e.getFullDescription().c_str(), "An exception has occured!",
                MB_OK | MB_ICONERROR | MB_TASKMODAL);
    #else
            fprintf(stderr, "An exception has occured: %s\n",
                    e.getFullDescription().c_str());
    #endif
        }
     
     
        return 0;
    }
    aidez moi pour que je puisse le deplacé
    merciiiii

  2. #2
    Membre confirmé
    Avatar de gusgus
    Profil pro
    Inscrit en
    Janvier 2005
    Messages
    500
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Janvier 2005
    Messages : 500
    Points : 641
    Points
    641
    Par défaut
    Salut.
    C'est facile.Tu n'a pas bien lu le tuto et une bonne partie du code se trouvant dans createscene() devrait se trouver dans frameStarted

  3. #3
    Futur Membre du Club
    Inscrit en
    Janvier 2007
    Messages
    5
    Détails du profil
    Informations forums :
    Inscription : Janvier 2007
    Messages : 5
    Points : 5
    Points
    5
    Par défaut
    salut gusgus,
    je voudrai vraiment que vous me precisez quelle partie du code si c possible
    merci d'avance

  4. #4
    Membre confirmé
    Avatar de gusgus
    Profil pro
    Inscrit en
    Janvier 2005
    Messages
    500
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Janvier 2005
    Messages : 500
    Points : 641
    Points
    641
    Par défaut
    En faite je me suis tromper:tu t'est arreter a la moitier du tuto,c'est pour sa que sa marche pa.

  5. #5
    Membre régulier
    Profil pro
    Inscrit en
    Février 2006
    Messages
    156
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Février 2006
    Messages : 156
    Points : 95
    Points
    95
    Par défaut
    Sinon,va voir le tutos de Xadec (sur le site officielle ) , tiens voila l'addresse

    http://artis.imag.fr/Membres/Xavier....tutorial3.html

    Si tu lis bien tu peut reproduire la même chose pour l'animation de la lampe mais tu le fait pour bonhomme .

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. Problème animation sur des forums
    Par °°° Zen-Spirit °°° dans le forum Flash
    Réponses: 5
    Dernier message: 16/07/2007, 20h31
  2. Problème anim flash avec IE
    Par jultoys dans le forum Flash
    Réponses: 1
    Dernier message: 15/05/2007, 16h18
  3. Problème animation sprite
    Par Edouard Kaiser dans le forum OpenGL
    Réponses: 16
    Dernier message: 28/11/2005, 21h03

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo