Changeset 6487
- Timestamp:
- Mar 7, 2010, 11:27:20 PM (15 years ago)
- Location:
- code/branches/tutorial
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/tutorial
- Property svn:mergeinfo changed
/code/branches/tutorial merged: 5841
- Property svn:mergeinfo changed
-
code/branches/tutorial/data/levels/tutorial.oxw
r6482 r6487 13 13 skybox = "Orxonox/skypanoramagen1" 14 14 > 15 16 <Drone name="meineDrohne" position="0,0,-10" primarythrust="80" auxilarythrust="10" rotationthrust="10" mass= "50" linearDamping = "0.9" angularDamping = "0.7">17 <attached>18 <Model scale="10" mesh="drone.mesh"/>19 </attached>20 <collisionShapes>21 <BoxCollisionShape position="0,0,0" halfExtents="10, 10, 10" />22 </collisionShapes>23 </Drone>24 25 15 26 16 <Light type=directional position="0,0,0" direction="0.253, 0.593, -0.765" diffuse="1.0, 0.9, 0.9, 1.0" specular="1.0, 0.9, 0.9, 1.0" /> -
code/branches/tutorial/src/orxonox/controllers/DroneController.cc
r6483 r6487 43 43 // - make sure to register the object in the factory 44 44 // - do any kind of initialisation 45 RegisterObject(DroneController);46 45 47 46 // this checks that our creator really is a drone … … 65 64 // Place your code here: 66 65 // - steering commands 67 static float totaltime = 0;68 totaltime += dt;69 66 Drone *myDrone = static_cast<Drone*>(this->getControllableEntity()); 70 if(totaltime<100)71 {72 myDrone->moveFrontBack( -sqrt(dt) );73 myDrone->rotatePitch(-dt);74 } 67 // you can use the following commands for steering 68 // - moveFrontBack, moveRightLeft, moveUpDown 69 // - rotatePitch, rotateYaw, rotateRoll 70 // - apply the to myDrone (e.g. myDrone->rotateYaw(..) ) 71 75 72 } 76 73 } -
code/branches/tutorial/src/orxonox/worldentities/Drone.cc
r6483 r6487 36 36 // put your code in here: 37 37 // create the factory for the drone 38 CreateFactory(Drone);39 38 40 39 /** … … 46 45 // put your code in here: 47 46 // - register the drone class to the core 48 // - create a new controller and pass our this pointer to it as creator49 47 this->myController_ = 0; 50 RegisterObject(Drone);51 48 52 49 this->localLinearAcceleration_.setValue(0, 0, 0); … … 58 55 this->setCollisionType(WorldEntity::Dynamic); 59 56 60 myController_ = new DroneController(static_cast<BaseObject*>(this)); 57 myController_ = new DroneController(static_cast<BaseObject*>(this)); //!< Creates a new controller and passes our this pointer to it as creator. 61 58 } 62 59 … … 80 77 SUPER(Drone, XMLPort, xmlelement, mode); 81 78 82 XMLPortParam(Drone, "primaryThrust", setPrimaryThrust, getPrimaryThrust, xmlelement, mode); 83 XMLPortParam(Drone, "auxilaryThrust", setAuxilaryThrust, getAuxilaryThrust, xmlelement, mode); 84 XMLPortParam(Drone, "rotationThrust", setRotationThrust, getRotationThrust, xmlelement, mode); 79 // put your code in here: 80 // make sure you add the variables primaryThrust_, auxilaryThrust_ and rotationThrust_ to xmlport 81 // make sure that the set- and get-functions exist. 82 // variables can be added by the following command 83 // XMLPortParam(Classname, "xml-attribute-name (i.e. variablename)", setFunction, getFunction, xmlelement, mode) 84 85 85 } 86 86 -
code/branches/tutorial/src/orxonox/worldentities/Drone.h
r6483 r6487 105 105 */ 106 106 inline void setPrimaryThrust( float thrust ) 107 { this->primaryThrust_=thrust; } 108 inline void setAuxilaryThrust( float thrust ) 109 { this->auxilaryThrust_=thrust; } 110 inline void setRotationThrust( float thrust ) 111 { this->rotationThrust_=thrust; } 107 { this->primaryThrust_=thrust; } 108 // place your set-functions here. 109 // - hint: auxiliary thrust, rotation thrust. 112 110 113 111 /** … … 117 115 inline float getPrimaryThrust() 118 116 { return this->primaryThrust_; } 119 inline float getAuxilaryThrust() 120 { return this->auxilaryThrust_; } 121 inline float getRotationThrust() 122 { return this->rotationThrust_; } 117 // place your get-functions here. 123 118 124 119 private:
Note: See TracChangeset
for help on using the changeset viewer.