Welcome to Scribd. Sign in or start your free trial to enjoy unlimited e-books, audiobooks & documents.Find out more
Standard view
Full view
of .
Look up keyword
Like this
0 of .
Results for:
No results containing your search query
P. 1
Www.ogre3d.org Tikiwiki Tiki-print.php Page Ref Id=273&Page=Intermediate Tutorial 1

Www.ogre3d.org Tikiwiki Tiki-print.php Page Ref Id=273&Page=Intermediate Tutorial 1

Ratings: (0)|Views: 47|Likes:
Published by David

More info:

Published by: David on Jun 16, 2012
Copyright:Attribution Non-commercial


Read on Scribd mobile: iPhone, iPad and Android.
download as PDF, TXT or read online from Scribd
See more
See less





 Animation, Walking Between Points, and Basic Quaternions
 Any problems you encounter during working with this tutorial should be posted in the
Help Forum
Table of contents
IntroductionPrerequisitesGetting StartedSetting up the SceneAnimationMoving the RobotAdditional InformationWalking on terrain (aka modifying the robots y-axis)My robot does not face to the direction at the beginning?Exercises for Further StudyEasy QuestionsIntermediate QuestionsDifficult QuestionsExpert Questions1. Definitions2. Fair Use Rights3. License Grant4. Restrictions5. Representations, Warranties and Disclaimer 6. Limitation on Liability.7. Termination8. Miscellaneous
In this tutorial we will be covering how to take an Entity, animate it, and have it walk between predefined points.This will also cover the basics of Quaternion rotation by showing how to keep the Entity facing the direction it ismoving. As you go through the demo you should be slowly adding code to your own project and watching theresults as we build it.You can see the final state of this tutorial
This tutorial will assume that you already know how to set up an Ogre project and make it compile successfully.This tutorial also makes use of the STL deque data structure. While no prior knowledge of how to use a dequeis required, you should at least know what templates are. If you are not familiar with STL, I would recommendpicking up STL Pocket Reference [ISBN 0-596-00556-3]. This will save you a lot of time in the future.You can read the first part of "STL Pocket Reference"
Getting Started
First, you need to create a new project (I called it ITutorial01) and add the following code:
ITutorial01 header 
1 de 15Página Intermediate Tutorial 1e21-05-2012http://www.ogre3d.org/tikiwiki/tiki-print.php?page_ref_id=273&page=Intermediate...
#ifndef __ITutorial01_h_ #define __ITutorial01_h_ #include "BaseApplication.h"#include <deque> class ITutorial01:public BaseApplication{ public:ITutorial01(void ); virtual ~ITutorial01(void );  protected :virtualvoid createScene(void ); virtualvoid createFrameListener(void ); virtual bool nextLocation(void ); virtual bool frameRenderingQueued (constOgre::FrameEvent&evt); Ogre::RealmDistance;
// The distance the object hasleft to travel
Ogre:: Vector3mDirection;
// The direction the object is moving 
Ogre:: Vector3mDestination;
// The destination the objectis moving towards
Ogre:: AnimationState* mAnimationState;
// The current animation stateof the object
Ogre::Entity* mEntity;
// The Entity we are animating 
Ogre::SceneNode* mNode;
// The SceneNode that theEntity is attached to 
std ::deque <Ogre:: Vector3mWalkList;
// The list of points we arewalking to 
Ogre::RealmWalkSpeed ;
// The speed at which theobject is moving 
};#endif // #ifndef __ITutorial01_h_ #include "ITutorial01.h"
ITutorial01::ITutorial01(void ) {
ITutorial01 implementation
2 de 15Página Intermediate Tutorial 1e21-05-2012http://www.ogre3d.org/tikiwiki/tiki-print.php?page_ref_id=273&page=Intermediate...
ITutorial01::~ITutorial01(void ) {}
void ITutorial01::createScene(void ) {}void ITutorial01::createFrameListener(void ){ BaseApplication::createFrameListener(); } bool ITutorial01::nextLocation(void ){ returntrue;}  bool ITutorial01::frameRenderingQueued (constOgre::FrameEvent&evt){ returnBaseApplication::frameRenderingQueued (evt); }#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32#define WIN32_LEAN_AND_MEAN#include "windows.h"#endif#ifdef __cplusplusextern"C"{#endif#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32INT WINAPI WinMain(HINSTANCE hInst,HINSTANCE,LPSTR strCmdLine,INT) #elseintmain(intargc,char*argv[]) #endif{
// Create application object
ITutorial01 app;try{app.go(); }catch(Ogre::Exception&e) { #if OGRE_PLATFORM == OGRE_PLATFORM_WIN32 MessageBox(NULL,e.getFullDescription().c_str(),"An exception has occured!",MB_OK |MB_ICONERROR |MB_TASKMODAL); #elsestd ::cerr<<"An exception has occured: "<< e.getFullDescription().c_str()<<std ::endl; #endif}
3 de 15Página Intermediate Tutorial 1e21-05-2012http://www.ogre3d.org/tikiwiki/tiki-print.php?page_ref_id=273&page=Intermediate...

You're Reading a Free Preview

/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->