Changeset 6918
- Timestamp:
- May 17, 2010, 4:36:18 PM (15 years ago)
- Location:
- code/branches/ai
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/ai/data/levels/pickup.oxw
r6891 r6918 23 23 ?> 24 24 25 <Template name=droneTemplate>26 <Drone name="meineDrohne" mass= "50" linearDamping = "0.9" angularDamping = "0.7">27 <attached>28 <Model scale="1" mesh="drone.mesh"/>29 </attached>30 <collisionShapes>31 <BoxCollisionShape position="0,0,0" halfExtents="1, 1, 1" />32 </collisionShapes>33 34 35 <weaponslots>36 <WeaponSlot position=" 0, 0,0" />37 </weaponslots>38 <weaponsets>39 <WeaponSet firemode=0 />40 </weaponsets>41 <weapons>42 <WeaponPack>43 <links>44 <DefaultWeaponmodeLink firemode=0 weaponmode=0 />45 </links>46 <Weapon>47 <attached>48 <Model mesh="hs-w01.mesh" roll="195" position="0,1,0" scale=2 />49 <Model mesh="hs-w01s.mesh" roll="195" position="0.1,0.5,0" scale=2 />50 </attached>51 <HsW01 mode=0 munitionpershot=0 delay=0.125 material="Flares/point_lensflare" muzzleoffset=" 0.7, 1.5,-4" />52 <HsW01 mode=0 munitionpershot=0 delay=0 material="Flares/point_lensflare" muzzleoffset="-0.9, 1.1,-4" />53 </Weapon>54 </WeaponPack>55 </weapons>56 57 58 </Drone>59 </Template>60 25 61 26 <PickupSpawner position="-100,0,-100" triggerDistance="10" respawnTime="30" maxSpawnedItems="10"> … … 64 29 </pickup> 65 30 </PickupSpawner> 66 67 68 31 69 32 <PickupSpawner position="-75,0,-100" triggerDistance="10" respawnTime="30" maxSpawnedItems="10"> -
code/branches/ai/data/levels/templates/pickup_representation_templates.oxt
r6524 r6918 107 107 </PickupCollection> 108 108 </Template> 109 109 110 111 <Template name=droneTemplate> 112 <Drone name="meineDrohne" mass= "50" linearDamping = "0.7" angularDamping = "0.9999999" primaryThrust_=250 auxilaryThrust_=250 rotationThrust_=50> 113 <attached> 114 <Model scale="1" mesh="drone.mesh"/> 115 </attached> 116 <collisionShapes> 117 <BoxCollisionShape position="0,0,0" halfExtents="1, 1, 1" /> 118 </collisionShapes> 119 <weaponslots> 120 <WeaponSlot position=" 0, 0,0" /> 121 </weaponslots> 122 <weaponsets> 123 <WeaponSet firemode=0 /> 124 </weaponsets> 125 <weapons> 126 <WeaponPack> 127 <links> 128 <DefaultWeaponmodeLink firemode=0 weaponmode=0 /> 129 </links> 130 <Weapon> 131 <attached> 132 <Model mesh="hs-w01.mesh" roll="195" position="0,1,0" scale=2 /> 133 <Model mesh="hs-w01s.mesh" roll="195" position="0.1,0.5,0" scale=2 /> 134 </attached> 135 <HsW01 mode=0 munitionpershot=0 delay=0.125 material="Flares/point_lensflare" muzzleoffset=" 0.7, 1.5,-4" /> 136 <HsW01 mode=0 munitionpershot=0 delay=0 material="Flares/point_lensflare" muzzleoffset="-0.9, 1.1,-4" /> 137 </Weapon> 138 </WeaponPack> 139 </weapons> 140 </Drone> 141 </Template> -
code/branches/ai/src/orxonox/controllers/ArtificialController.cc
r6891 r6918 36 36 #include "gametypes/TeamDeathmatch.h" 37 37 #include "controllers/WaypointPatrolController.h" 38 #include "controllers/DroneController.h" 38 39 #include "util/Math.h" 39 40 … … 348 349 void ArtificialController::searchNewTarget() 349 350 { 351 COUT(0) << "search new target - start" << std::endl; 350 352 if (!this->getControllableEntity()) 351 353 return; … … 372 374 } 373 375 } 376 COUT(0) << "search new target - end: " << this->target_ << std::endl; 374 377 } 375 378 -
code/branches/ai/src/orxonox/controllers/CMakeLists.txt
r6854 r6918 8 8 WaypointController.cc 9 9 WaypointPatrolController.cc 10 DroneController.cc 10 DroneController.cc 11 11 ) -
code/branches/ai/src/orxonox/controllers/DroneController.cc
r6891 r6918 47 47 DroneController::DroneController(BaseObject* creator) : ArtificialController(creator) 48 48 { 49 // - do any kind of initialisation50 51 // this checks that our creator really is a drone52 // and saves the pointer to the drone for the controlling commands53 54 55 49 RegisterObject(DroneController); 56 50 … … 86 80 87 81 const Vector3& locOwnerDir = getDrone()->getOrientation().UnitInverse()*(ownerPosition-dronePosition); //Vector from Drone To Owner out of drones local coordinate system 88 89 int distance = sqrt( (ownerPosition.x-dronePosition.x)*(ownerPosition.x-dronePosition.x) 90 + (ownerPosition.y-dronePosition.y)*(ownerPosition.y-dronePosition.y) 91 + (ownerPosition.z-dronePosition.z)*(ownerPosition.z-dronePosition.z)); //distance to Owner 92 93 if (distance > 500) { //TODO: variable implementation of maxdistance 94 drone_->moveUpDown(locOwnerDir.y); 95 drone_->moveFrontBack(-locOwnerDir.z); 96 drone_->moveRightLeft(locOwnerDir.x); 97 } 98 99 82 /* 83 int distance_square = (ownerPosition.x-dronePosition.x)*(ownerPosition.x-dronePosition.x) 84 + (ownerPosition.y-dronePosition.y)*(ownerPosition.y-dronePosition.y) 85 + (ownerPosition.z-dronePosition.z)*(ownerPosition.z-dronePosition.z); //distance to Owner squared 86 */ 100 87 random = rnd(maxrand); 101 88 if ( random < 30 && (!this->target_)) 102 89 this->searchNewTarget(); 103 104 105 this->aimAtTarget(); 106 drone_->fire(0); 90 /* 91 //face target 92 drone_->rotateYaw(-targetPosition_.x); 93 drone_->rotatePitch(targetPosition_.y); 94 */ 95 if (this->target_) 96 { 97 this->aimAtTarget(); 98 drone_->fire(0); 99 } 107 100 108 101 109 102 110 111 //COUT(0) << "Drone: " << dronePosition << endl;112 //COUT(0) << "Distance: " << distance << endl;103 /* 104 COUT(0) << "Drone: " << dronePosition << endl; 105 COUT(0) << "Distance: " << distance << endl; 113 106 COUT(0) << "locDrone: " << locOwnerDir << endl; 114 107 COUT(0) << "target: " << targetPosition_ << endl; 115 108 COUT(0) << "Owner: " << ownerPosition << endl; 116 109 COUT(0) << "Rand: " << random << endl; 117 110 */ 118 111 /* 119 112 // search enemy … … 171 164 Drone *myDrone = static_cast<Drone*>(this->getControllableEntity()); 172 165 173 if(myDrone != NULL) { 174 175 setTargetPosition(this->getControllableEntity()->getPosition()); 166 if ((this->getDrone()->getWorldPosition() - this->getOwner()->getWorldPosition()).squaredLength() > 150*150) { //TODO: variable implementation of maxdistance 167 this->moveToPosition(this->getOwner()->getWorldPosition()); 176 168 177 169 } -
code/branches/ai/src/orxonox/controllers/DroneController.h
r6891 r6918 47 47 Oli Scheuss 48 48 */ 49 class _OrxonoxExport DroneController : public ArtificialController 49 class _OrxonoxExport DroneController : public ArtificialController, public Tickable 50 50 { 51 51 public: -
code/branches/ai/src/orxonox/worldentities/Drone.cc
r6847 r6918 169 169 void Drone::rotateYaw(const Vector2& value) 170 170 { 171 this->localAngularAcceleration_.setY(this->localAngularAcceleration_.y() -value.x);171 this->localAngularAcceleration_.setY(this->localAngularAcceleration_.y() + value.x); 172 172 } 173 173
Note: See TracChangeset
for help on using the changeset viewer.