Changeset 128
- Timestamp:
- Oct 30, 2007, 11:43:48 PM (17 years ago)
- Location:
- code/branches/main_reto
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/main_reto/include/OrxonoxShip.h
r127 r128 12 12 virtual ~OrxonoxShip(); 13 13 14 /*void setThrust(float); 15 void setSideThrust(float);*/ 14 virtual bool initialise(); 16 15 17 virtual bool initialise(); 16 void setThrust(const Real); 17 void setSideThrust(const Real); 18 void setYaw(const Radian); 19 void setPitch(const Radian); 20 void setRoll(const Radian); 21 22 bool tick(unsigned long, float); 18 23 19 24 protected: … … 21 26 SceneNode *mRootNode; 22 27 Entity *mShip; 28 29 Vector3 speed; 30 float thrust, sideThrust, baseThrust; 23 31 }; 24 32 -
code/branches/main_reto/src/OrxonoxShip.cpp
r127 r128 2 2 3 3 4 OrxonoxShip::OrxonoxShip(SceneManager *mSceneMgr, SceneNode *mNode) : mSceneMgr(mSceneMgr), mRootNode(mNode) 4 OrxonoxShip::OrxonoxShip(SceneManager *mSceneMgr, SceneNode *mNode) 5 : mSceneMgr(mSceneMgr), mRootNode(mNode), speed(Vector3(0, 0, 0)), baseThrust(100) 5 6 { 6 7 } … … 19 20 // create the "space ship" (currently a fish..) 20 21 mShip = mSceneMgr->createEntity("Ship", "fish.mesh"); 21 mRootNode->setScale(Vector3(10, 10, 10)); 22 mRootNode->attachObject(mShip); 22 SceneNode *fishNode = mRootNode->createChildSceneNode("fishNode"); 23 fishNode->yaw(Degree(-90)); 24 fishNode->attachObject(mShip); 25 fishNode->setScale(Vector3(10, 10, 10)); 23 26 24 27 return true; 25 28 } 29 30 31 void OrxonoxShip::setThrust(const Real value) 32 { 33 thrust = value * baseThrust; 34 } 35 36 void OrxonoxShip::setSideThrust(const Real value) 37 { 38 sideThrust = value; 39 } 40 41 void OrxonoxShip::setYaw(const Radian value) 42 { 43 mRootNode->yaw(value); 44 } 45 46 void OrxonoxShip::setPitch(const Radian value) 47 { 48 mRootNode->pitch(value); 49 } 50 51 void OrxonoxShip::setRoll(const Radian value) 52 { 53 mRootNode->roll(value); 54 } 55 56 57 bool OrxonoxShip::tick(unsigned long time, float deltaTime) 58 { 59 speed += (mRootNode->getLocalAxes() * Vector3(0, 0, 1)).normalisedCopy() * thrust * deltaTime; 60 61 mRootNode->translate(speed * deltaTime); 62 63 return true; 64 } -
code/branches/main_reto/src/RunManager.cpp
r127 r128 284 284 // 2nd mouse button - slide, otherwise rotate 285 285 const MouseState &ms = mMouse->getMouseState(); 286 if( ms.buttonDown( MB_Right ) ) 287 { 288 mTranslateVector.x += ms.X.rel * 0.13; 289 mTranslateVector.y -= ms.Y.rel * 0.13; 290 } 291 else 292 { 293 mRotX = Degree(-ms.X.rel * 0.13); 294 mRotY = Degree(-ms.Y.rel * 0.13); 295 } 286 mRotX = Degree(-ms.X.rel * 0.13); 287 mRotY = Degree(-ms.Y.rel * 0.13); 288 289 mShip->setYaw(mRotX); 290 mShip->setPitch(mRotY); 296 291 297 292 return true; … … 304 299 // Note that YAW direction is around a fixed axis (freelook style) rather than a natural YAW 305 300 //(e.g. airplane) 306 mCamera->yaw(mRotX); 307 mCamera->pitch(mRotY); 308 mCamera->moveRelative(mTranslateVector); 301 //mCamera->yaw(mRotX); 302 //mCamera->pitch(mRotY); 303 //mCamera->moveRelative(mTranslateVector); 304 305 mShipNode->translate(mShipNode->getLocalAxes() * mTranslateVector); 309 306 } 310 307 -
code/branches/main_reto/weapon_framework/weapon_framework.vcproj
r127 r128 204 204 </File> 205 205 <File 206 RelativePath="..\ include\OrxonoxShip.cpp"206 RelativePath="..\src\OrxonoxShip.cpp" 207 207 > 208 208 </File>
Note: See TracChangeset
for help on using the changeset viewer.