Changeset 128 for code/branches/main_reto/src
- Timestamp:
- Oct 30, 2007, 11:43:48 PM (17 years ago)
- Location:
- code/branches/main_reto/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
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
Note: See TracChangeset
for help on using the changeset viewer.