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 :

Mouvement d'un objet


Sujet :

Ogre

  1. #1
    Nouveau Candidat au Club
    Inscrit en
    Juin 2007
    Messages
    3
    Détails du profil
    Informations forums :
    Inscription : Juin 2007
    Messages : 3
    Points : 1
    Points
    1
    Par défaut Mouvement d'un objet
    Salut,
    J'ai utilisé l'exemple du tutorial sur le site d'Ogre avec un robot qui se déplace d'un point à un autre.
    http://www.ogre3d.org/wiki/index.php...ate_Tutorial_1

    Maintenant, je voudrais que le robot (l'Entité) se déplace mais en suivant une spline créé à partir des points prédéfinis...

    avez vous une idée au niveau du concept qu'il faut que je suive?

  2. #2
    Nouveau membre du Club
    Étudiant
    Inscrit en
    Mai 2007
    Messages
    21
    Détails du profil
    Informations personnelles :
    Âge : 38

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Mai 2007
    Messages : 21
    Points : 26
    Points
    26
    Par défaut
    Salut. Je croit que l'utilisation des Animation fera l'affaire.
    Une Animation est composée de Track qui est elle même composé de Frame , donc il faut donc crée une frame attaché à l'object qu'on veut bouger et puis definir les position de l'object dans les Frame (comme un cliché de film) et la position dans le temps de cette Frame.
    losque tu deplace un object d'un frame a une autre Ogre gére la tranlation il sufit seulement de montioné comment (SPLINE ou LINIEAR).
    Le code sera comme suit:
    Pour simplifier on suppose que l'animation sera declanche au début de la scéne , donc on la crée dans le constructeur du frame listener
    PS: Je suis l'exemple dans le tutorial 1 Intermediate.
    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
     
    //la variable mSceneMgr sera delarer avec mEntity et mNode
    MyFrameListener(RenderWindow* win, Camera* cam,SceneNode *sn,
    Entity *en,deque<Vector3> &walk,SceneManager *SMgr)
    		:ExampleFrameListener(win, cam,true,true),
    		mNode(sn),mEntity(en),mWalkList(walk),mSceneMgr(Smgr)
    {
     int TrackPos=0; //La position de la Frame dans le temps
       //On crée une animation
    Animation* Anim=GestScene->createAnimation(Noeud->getName() +"Move",4); 
    Anim->setInterpolationMode(Ogre::Animation::IM_SPLINE);
    //On crée des Track de l'animation
    NodeAnimationTrack *Track = Anim->createNodeTrack(0,Noeud);
    TransformKeyFrame  *TFrame =Track->createNodeKeyFrame(0);
    mDestination=Ogre:Vector3(0,0,0);
    do
    {
      TFrame->setTranslate(mDestination);
       TrackPos+=4;
      TFrame = Track->createNodeKeyFrame(TrackPos);
    //Si tu veux agrandire ou faire une rotation sur l'objet tu appele setRotation ou Set Scale pour agrandire l'objet
    }
    while( nextLocation( ))
     mAnimationStat=mSceneMgr->createAnimationState(Noeud->getName()+"Move");
    mAnimationStat->setEnabled(true);
    mAnimationStat->setLoop(false);
    };
    et dans FrameStarted tu fait (et bien sur si tu est dans le code du totorielle tu suprilme le code contenu dans cette methode) :
    if(mAnimStat->getTimePosition()<mAnimStat->getLength()) mAnimStat->addTime(evt.timeSinceLastFrame);

    J'ai ecrit directemnt ce code , il se peut qu'il y a des erreur de syntaxe ,en tous les cas verifie.

  3. #3
    Nouveau Candidat au Club
    Inscrit en
    Juin 2007
    Messages
    3
    Détails du profil
    Informations forums :
    Inscription : Juin 2007
    Messages : 3
    Points : 1
    Points
    1
    Par défaut
    merci sirus pour tes explications!!
    J'ai implémenté les lignes que tu m'as donné, ca fonctionne!

    Il me reste encore quelques questions:
    1) je n'arrive pas à faire marcher (walk) le robot. C'est à a dire qu'il se déplace en glissant...il ne fait pas de pas, je ne comprend pas bien où est ce que je dois implémenter ceci:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    // walking animation
         mAnimationState = mEntity->getAnimationState( "Walk" );
         mAnimationState->setLoop( true );
         mAnimationState->setEnabled( true );
    2) Je pense que la vitesse des pas ne sera pas adapté a la vitesse de déplacement?

    3) Et sinon enfaite j'ai vu qu'il existe un add-on nommé ODE ne serait-ce pas plus adapté pour faire marcher un bonhomme ?

    voici mon mon code:
    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
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
     
    #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, SceneManager *smgr)
            : ExampleFrameListener(win, cam, true, true), mNode(sn), mEntity(ent), mWalkList( walk ),mSceneMgr(smgr)
        {
        // Set default values for variables
            mWalkSpeed = 65.0f;
            mDirection = Vector3::ZERO;
     
    	//La position de la Frame dans le temps
    	int TrackPos=0;
     
     
    	//On crée une animation
    	Animation* anim = mSceneMgr->createAnimation(mNode->getName() +"Move",24);
    	anim->setInterpolationMode(Ogre::Animation::IM_SPLINE);
     
    	NodeAnimationTrack *track = anim->createNodeTrack(0, mNode);
    	TransformKeyFrame  *tframe = track->createNodeKeyFrame(0);
    	mDestination = Ogre::Vector3(-100.0f, 0.0f, 25.0f);
     
    	do
    	{
    	tframe->setTranslate(mDestination);
    	TrackPos+=4;
    	tframe = track->createNodeKeyFrame(TrackPos);
     
    	//rotation
    	Vector3 src = mNode->getOrientation( ) * Vector3::UNIT_X;
    	Ogre::Quaternion quat = src.getRotationTo( mDirection );
    	tframe->setRotation( quat );
     
    	} while( nextLocation( ));
     
     
    	mAnimationState = mSceneMgr->createAnimationState(mNode->getName()+"Move");
    	mAnimationState->setEnabled(true);
    	mAnimationState->setLoop(false);
     
      } // MoveDemoListener
     
        /* This function is called to start the object moving to the next position
           in mWalkList.
        */
        bool nextLocation( )
        {	
    		if ( mWalkList.empty() )
                return false;
     
    		mDestination = mWalkList.front( );  // this gets the front of the deque
            mWalkList.pop_front( );             // this removes the front of the deque
     
            mDirection = mDestination - mNode->getPosition( );
            mDistance = mDirection.normalise( );
     
            return true;
        } // nextLocation( )
     
        bool frameStarted(const FrameEvent &evt)
        {	
     
    		if(mAnimationState ->getTimePosition() < mAnimationState ->getLength()) 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
    	AnimationState *mAnimationWalk;  // 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
    	SceneManager *mSceneMgr;
    };
     
     
    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)
        {
    		// Set ambient light
    		mSceneMgr->setAmbientLight(ColourValue(0.5, 0.5, 0.5));
     
    		// Create a main light
    		Light* l = mSceneMgr->createLight("MainLight");
    		l->setPosition(-50,180,50);
     
    		// Create the entity
            mEntity = mSceneMgr->createEntity( "Robot", "ninja.mesh" );
     
    		mSceneMgr->setShadowTechnique(SHADOWTYPE_STENCIL_ADDITIVE);
     
     
     
            // 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(-50.0f, 0.0f,-100.0f ) );
            mWalkList.push_back( Vector3( 200.0f, 0.0f,50.0f  ) );
    		mWalkList.push_back( Vector3( 350.0f, 0.0f,  -150.0f  ) );
    		mWalkList.push_back( Vector3( 200.0f, 0.0f,50.0f  ) );
    		mWalkList.push_back( Vector3(-50.0f, 0.0f,-100.0f ) );
    		mWalkList.push_back( Vector3(-100.0f, 0.0f, 25.0f ) );
     
    		// Create objects so we can see movement
            Entity *ent;
            SceneNode *node;
     
            ent = mSceneMgr->createEntity( "Knot1", "knot.mesh" );
            node = mSceneMgr->getRootSceneNode( )->createChildSceneNode( "Knot1Node",
                Vector3(  -100.0f, 0.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( -50.0f, 0.0f,-100.0f ) );
            node->attachObject( ent );
            node->setScale( 0.1f, 0.1f, 0.1f );
     
            ent = mSceneMgr->createEntity( "Knot3", "knot.mesh" );
            node = mSceneMgr->getRootSceneNode( )->createChildSceneNode( "Knot3Node",
                Vector3(200.0f, 0.0f,50.0f ) );
            node->attachObject( ent );
            node->setScale( 0.1f, 0.1f, 0.1f );
     
    		ent = mSceneMgr->createEntity( "Knot4", "knot.mesh" );
            node = mSceneMgr->getRootSceneNode( )->createChildSceneNode( "Knot4Node",
                Vector3( 350.0f, 0.0f,  -150.0f ) );
            node->attachObject( ent );
            node->setScale( 0.1f, 0.1f, 0.1f );
     
    		// Set the camera
            mCamera->setPosition( 90.0f, 280.0f, 535.0f );
            mCamera->pitch( Degree(-20.0f) ); 
            mCamera->yaw( Degree(-7.0f) );
     
        }
     
        void createFrameListener(void)
        {
            mFrameListener= new MoveDemoListener(mWindow, mCamera, mNode, mEntity, mWalkList, mSceneMgr);
            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;
    }

  4. #4
    Nouveau membre du Club
    Étudiant
    Inscrit en
    Mai 2007
    Messages
    21
    Détails du profil
    Informations personnelles :
    Âge : 38

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Mai 2007
    Messages : 21
    Points : 26
    Points
    26
    Par défaut
    On fait il faux ajouter une autre animation qui va se charger de joueur l'animation walk.Dans ton code tu a ajouter une animation mais tu ne la pas utilisé "AnimationWolk" je l'utilise ici.
    Et lorseque le Ninja termine son parcour c'est à dire si la premiere animation c'est terminer on joue l'animation "idle1".
    voici le code complet
    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
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
     
    #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, SceneManager *smgr)
            : ExampleFrameListener(win, cam, true, true), mNode(sn), mEntity(ent), mWalkList( walk ),mSceneMgr(smgr)
        {
        // Set default values for variables
           // mWalkSpeed = 65.0f;
            mDirection = Vector3::ZERO;
     
    	//La position de la Frame dans le temps
    	int TrackPos=0;
     
     
    	//On crée une animation
    	Animation* anim = mSceneMgr->createAnimation(mNode->getName() +"Move",24);
    	anim->setInterpolationMode(Ogre::Animation::IM_SPLINE);
     
    	NodeAnimationTrack *track = anim->createNodeTrack(0, mNode);
    	TransformKeyFrame  *tframe = track->createNodeKeyFrame(0);
    	mDestination = Ogre::Vector3(-100.0f, 0.0f, 25.0f);
     
    	do
    	{
    	tframe->setTranslate(mDestination);
    	TrackPos+=4;
    	tframe = track->createNodeKeyFrame(TrackPos);
     
    	//rotation
    	Vector3 src = mNode->getOrientation( ) * Vector3::UNIT_X;
    	Ogre::Quaternion quat = src.getRotationTo( mDirection );
    	tframe->setRotation( quat );
     
    	} while( nextLocation( ));
     
     
    	mAnimationState = mSceneMgr->createAnimationState(mNode->getName()+"Move");
    	mAnimationState->setEnabled(true);
    	mAnimationState->setLoop(false);
     
    	//Cette animation c'est lanimation du robot en marche
    	mAnimationWalk = mEntity->getAnimationState( "Walk" );
    	mAnimationWalk->setLoop( true );
    	mAnimationWalk->setEnabled( true );
     
      } // MoveDemoListener
     
        /* This function is called to start the object moving to the next position
           in mWalkList.
        */
        bool nextLocation( )
        {	
    		if ( mWalkList.empty() )
                return false;
     
    		mDestination = mWalkList.front( );  // this gets the front of the deque
            mWalkList.pop_front( );             // this removes the front of the deque
            mDirection = mDestination - mNode->getPosition( );
     
            return true;
        } // nextLocation( )
     
        bool frameStarted(const FrameEvent &evt)
        {	
    		mAnimationWalk->addTime(evt.timeSinceLastFrame);
    		if(mAnimationState ->getTimePosition() < mAnimationState ->getLength()) mAnimationState -> addTime(evt.timeSinceLastFrame);
    		else
    		{
    			mAnimationWalk = mEntity->getAnimationState( "Idle1" );
    			mAnimationWalk->setLoop( true );					
    			mAnimationWalk->setEnabled( true ); 
    		}
    		return ExampleFrameListener::frameStarted(evt);
        }
     
    protected:
        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
    	AnimationState *mAnimationWalk;  // 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
     
    	SceneManager *mSceneMgr;
    };
     
     
    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)
        {
    		// Set ambient light
    		mSceneMgr->setAmbientLight(ColourValue(0.5, 0.5, 0.5));
     
    		// Create a main light
    		Light* l = mSceneMgr->createLight("MainLight");
    		l->setPosition(-50,180,50);
     
    		// Create the entity
            mEntity = mSceneMgr->createEntity( "Robot", "ninja.mesh" );
     
    		mSceneMgr->setShadowTechnique(SHADOWTYPE_STENCIL_ADDITIVE);
     
     
     
            // 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(-50.0f, 0.0f,-100.0f ) );
            mWalkList.push_back( Vector3( 200.0f, 0.0f,50.0f  ) );
    		mWalkList.push_back( Vector3( 350.0f, 0.0f,  -150.0f  ) );
    		mWalkList.push_back( Vector3( 200.0f, 0.0f,50.0f  ) );
    		mWalkList.push_back( Vector3(-50.0f, 0.0f,-100.0f ) );
    		mWalkList.push_back( Vector3(-100.0f, 0.0f, 25.0f ) );
     
    		// Create objects so we can see movement
            Entity *ent;
            SceneNode *node;
     
            ent = mSceneMgr->createEntity( "Knot1", "knot.mesh" );
            node = mSceneMgr->getRootSceneNode( )->createChildSceneNode( "Knot1Node",
                Vector3(  -100.0f, 0.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( -50.0f, 0.0f,-100.0f ) );
            node->attachObject( ent );
            node->setScale( 0.1f, 0.1f, 0.1f );
     
            ent = mSceneMgr->createEntity( "Knot3", "knot.mesh" );
            node = mSceneMgr->getRootSceneNode( )->createChildSceneNode( "Knot3Node",
                Vector3(200.0f, 0.0f,50.0f ) );
            node->attachObject( ent );
            node->setScale( 0.1f, 0.1f, 0.1f );
     
    		ent = mSceneMgr->createEntity( "Knot4", "knot.mesh" );
            node = mSceneMgr->getRootSceneNode( )->createChildSceneNode( "Knot4Node",
                Vector3( 350.0f, 0.0f,  -150.0f ) );
            node->attachObject( ent );
            node->setScale( 0.1f, 0.1f, 0.1f );
     
    		// Set the camera
            mCamera->setPosition( 90.0f, 280.0f, 535.0f );
            mCamera->pitch( Degree(-20.0f) ); 
            mCamera->yaw( Degree(-7.0f) );
     
        }
     
        void createFrameListener(void)
        {
            mFrameListener= new MoveDemoListener(mWindow, mCamera, mNode, mEntity, mWalkList, mSceneMgr);
            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;
    }

  5. #5
    Nouveau Candidat au Club
    Inscrit en
    Juin 2007
    Messages
    3
    Détails du profil
    Informations forums :
    Inscription : Juin 2007
    Messages : 3
    Points : 1
    Points
    1
    Par défaut
    salut,

    merci pour ton aide ca fonctionne bien.

    Je n'arrive pas à faire la rotation correctement...
    Faut il que je dérive la spline pour obtenir la direction ? c'est un peu compliké à mon avis mais je vois pas d'autre méthode...
    peut tu m'aider ?

    ce que j'ai pour l'instant (rotation en utilisant la direction):
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
     
    Vector3 src = mNode->getOrientation( ) * Vector3::UNIT_X;
    Ogre::Quaternion quat = src.getRotationTo( mDirection );
    tframe->setRotation( quat );

Discussions similaires

  1. mouvement d'un objet GLscene avec la souris
    Par essof_salhi dans le forum Débuter
    Réponses: 4
    Dernier message: 20/03/2014, 10h37
  2. Réponses: 1
    Dernier message: 06/05/2007, 11h10
  3. Réponses: 10
    Dernier message: 30/01/2007, 22h22
  4. Mouvement d'une lampe ou d'un objet
    Par black.out dans le forum OpenGL
    Réponses: 3
    Dernier message: 05/11/2006, 09h51
  5. suivre un objet en mouvement sur image
    Par jlf dans le forum Traitement du signal
    Réponses: 24
    Dernier message: 09/05/2005, 13h46

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