[Orxonox-commit 1065] r5786 - in code/branches/tutorial: data/levels src/orxonox/controllers src/orxonox/worldentities
scheusso at orxonox.net
scheusso at orxonox.net
Fri Sep 25 16:16:38 CEST 2009
Author: scheusso
Date: 2009-09-25 16:16:38 +0200 (Fri, 25 Sep 2009)
New Revision: 5786
Modified:
code/branches/tutorial/data/levels/tutorial.oxw
code/branches/tutorial/src/orxonox/controllers/
code/branches/tutorial/src/orxonox/controllers/DroneController.cc
code/branches/tutorial/src/orxonox/worldentities/
code/branches/tutorial/src/orxonox/worldentities/Drone.cc
Log:
reverted r5766 since we forgot some adjustments to the code (i.e. remove xml hack)
Modified: code/branches/tutorial/data/levels/tutorial.oxw
===================================================================
--- code/branches/tutorial/data/levels/tutorial.oxw 2009-09-24 22:54:12 UTC (rev 5785)
+++ code/branches/tutorial/data/levels/tutorial.oxw 2009-09-25 14:16:38 UTC (rev 5786)
@@ -13,6 +13,16 @@
skybox = "Orxonox/skypanoramagen1"
>
+<Drone name="meineDrohne" position="0,0,-10" primarythrust="80" auxilarythrust="10" rotationthrust="10" mass= "50" linearDamping = "0.9" angularDamping = "0.7">
+ <attached>
+ <Model scale="10" mesh="drone.mesh"/>
+ </attached>
+ <collisionShapes>
+ <BoxCollisionShape position="0,0,0" halfExtents="10, 10, 10" />
+ </collisionShapes>
+</Drone>
+
+
<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" />
<Model mesh="hs-w01.mesh" scale=10 position="0,0,-100" />
Property changes on: code/branches/tutorial/src/orxonox/controllers
___________________________________________________________________
Modified: svn:mergeinfo
- /code/branches/libraries/src/orxonox/controllers:5612-5692
/code/branches/libraries2/src/orxonox/controllers:5703-5737
/code/branches/resource2/src/orxonox/controllers:3372-5694
/code/branches/tutorial/src/orxonox/objects/controllers:2761-2767
code/branches/buildsystem/src/orxonox/controllers:1874-2276,2278-2400
code/branches/buildsystem2/src/orxonox/controllers:2506-2658
code/branches/buildsystem3/src/orxonox/controllers:2662-2708
code/branches/ceguilua/src/orxonox/controllers:1802-1808
code/branches/core3/src/orxonox/controllers:1572-1739
code/branches/core4/src/orxonox/controllers:3221-3224,3227,3234-3238,3242,3244-3250,3252-3254,3256,3259-3261,3264-3265,3268-3275,3277-3278,3280,3284-3285,3287,3289-3294,3305,3309-3310
code/branches/gametypes/src/orxonox/controllers:2826-3031
code/branches/gcc43/src/orxonox/controllers:1580
code/branches/gui/src/orxonox/controllers:1635-1723,2795-2894
code/branches/input/src/orxonox/controllers:1629-1636
code/branches/lodfinal/src/orxonox/controllers:2372-2411
code/branches/map/src/orxonox/controllers:2801-3086,3089
code/branches/miniprojects/src/orxonox/controllers:2754-2824
code/branches/netp2/src/orxonox/controllers:2835-2988
code/branches/netp3/src/orxonox/controllers:2988-3082
code/branches/netp6/src/orxonox/controllers:3214-3302
code/branches/network/src/orxonox/controllers:2356
code/branches/network64/src/orxonox/controllers:2210-2355
code/branches/objecthierarchy/src/orxonox/controllers:1911-2085,2100,2110-2169
code/branches/objecthierarchy2/src/orxonox/controllers:2171-2479
code/branches/overlay/src/orxonox/controllers:2117-2385
code/branches/particles/src/orxonox/controllers:2829-3085
code/branches/pch/src/orxonox/controllers:3113-3194
code/branches/physics/src/orxonox/controllers:1912-2055,2107-2439
code/branches/physics_merge/src/orxonox/controllers:2436-2457
code/branches/pickups/src/orxonox/controllers:1926-2086,2127,2827-2915
code/branches/pickups2/src/orxonox/controllers:2107-2497,2915-3071
code/branches/presentation/src/orxonox/controllers:2369-2652,2654-2660
code/branches/questsystem/src/orxonox/controllers:1894-2088
code/branches/questsystem2/src/orxonox/controllers:2107-2259
code/branches/questsystem5/src/orxonox/controllers:2776-2905
code/branches/resource/src/orxonox/controllers:3327-3366
code/branches/script_trigger/src/orxonox/controllers:1295-1953,1955
code/branches/sound/src/orxonox/controllers:2829-3010
code/branches/weapon/src/orxonox/controllers:1925-2094
code/branches/weapon2/src/orxonox/controllers:2107-2488
code/branches/weapons/src/orxonox/controllers:2897-3051
code/branches/weaponsystem/src/orxonox/controllers:2742-2890
+ /code/branches/libraries/src/orxonox/controllers:5612-5692
/code/branches/libraries2/src/orxonox/controllers:5703-5733
/code/branches/resource2/src/orxonox/controllers:3372-5694
/code/branches/tutorial/src/orxonox/objects/controllers:2761-2765
code/branches/buildsystem/src/orxonox/controllers:1874-2276,2278-2400
code/branches/buildsystem2/src/orxonox/controllers:2506-2658
code/branches/buildsystem3/src/orxonox/controllers:2662-2708
code/branches/ceguilua/src/orxonox/controllers:1802-1808
code/branches/core3/src/orxonox/controllers:1572-1739
code/branches/core4/src/orxonox/controllers:3221-3224,3227,3234-3238,3242,3244-3250,3252-3254,3256,3259-3261,3264-3265,3268-3275,3277-3278,3280,3284-3285,3287,3289-3294,3305,3309-3310
code/branches/gametypes/src/orxonox/controllers:2826-3031
code/branches/gcc43/src/orxonox/controllers:1580
code/branches/gui/src/orxonox/controllers:1635-1723,2795-2894
code/branches/input/src/orxonox/controllers:1629-1636
code/branches/lodfinal/src/orxonox/controllers:2372-2411
code/branches/map/src/orxonox/controllers:2801-3086,3089
code/branches/miniprojects/src/orxonox/controllers:2754-2824
code/branches/netp2/src/orxonox/controllers:2835-2988
code/branches/netp3/src/orxonox/controllers:2988-3082
code/branches/netp6/src/orxonox/controllers:3214-3302
code/branches/network/src/orxonox/controllers:2356
code/branches/network64/src/orxonox/controllers:2210-2355
code/branches/objecthierarchy/src/orxonox/controllers:1911-2085,2100,2110-2169
code/branches/objecthierarchy2/src/orxonox/controllers:2171-2479
code/branches/overlay/src/orxonox/controllers:2117-2385
code/branches/particles/src/orxonox/controllers:2829-3085
code/branches/pch/src/orxonox/controllers:3113-3194
code/branches/physics/src/orxonox/controllers:1912-2055,2107-2439
code/branches/physics_merge/src/orxonox/controllers:2436-2457
code/branches/pickups/src/orxonox/controllers:1926-2086,2127,2827-2915
code/branches/pickups2/src/orxonox/controllers:2107-2497,2915-3071
code/branches/presentation/src/orxonox/controllers:2369-2652,2654-2660
code/branches/questsystem/src/orxonox/controllers:1894-2088
code/branches/questsystem2/src/orxonox/controllers:2107-2259
code/branches/questsystem5/src/orxonox/controllers:2776-2905
code/branches/resource/src/orxonox/controllers:3327-3366
code/branches/script_trigger/src/orxonox/controllers:1295-1953,1955
code/branches/sound/src/orxonox/controllers:2829-3010
code/branches/weapon/src/orxonox/controllers:1925-2094
code/branches/weapon2/src/orxonox/controllers:2107-2488
code/branches/weapons/src/orxonox/controllers:2897-3051
code/branches/weaponsystem/src/orxonox/controllers:2742-2890
Modified: code/branches/tutorial/src/orxonox/controllers/DroneController.cc
===================================================================
--- code/branches/tutorial/src/orxonox/controllers/DroneController.cc 2009-09-24 22:54:12 UTC (rev 5785)
+++ code/branches/tutorial/src/orxonox/controllers/DroneController.cc 2009-09-25 14:16:38 UTC (rev 5786)
@@ -38,9 +38,8 @@
// Place your code here:
// - make sure to register the object in the factory
// - do any kind of initialisation
+ RegisterObject(DroneController);
-
-
// this checks that our creator really is a drone
// and saves the pointer to the drone for the controlling commands
assert(dynamic_cast<Drone*>(creator)!=0);
@@ -55,11 +54,13 @@
{
// Place your code here:
// - steering commands
+ static float totaltime = 0;
+ totaltime += dt;
Drone *myDrone = static_cast<Drone*>(this->getControllableEntity());
- // you can use the following commands for steering
- // - moveFrontBack, moveRightLeft, moveUpDown
- // - rotatePitch, rotateYaw, rotateRoll
- // - apply the to myDrone (e.g. myDrone->rotateYaw(..) )
-
+ if(totaltime<100)
+ {
+ myDrone->moveFrontBack( -sqrt(dt) );
+ myDrone->rotatePitch(-dt);
+ }
}
}
Property changes on: code/branches/tutorial/src/orxonox/worldentities
___________________________________________________________________
Modified: svn:mergeinfo
- /code/branches/libraries/src/orxonox/worldentities:5612-5692
/code/branches/libraries2/src/orxonox/worldentities:5703-5737
/code/branches/resource2/src/orxonox/worldentities:3372-5694
/code/branches/tutorial/src/orxonox/objects/worldentities:2761-2767
code/branches/buildsystem/src/orxonox/worldentities:1874-2276,2278-2400
code/branches/buildsystem2/src/orxonox/worldentities:2506-2658
code/branches/buildsystem3/src/orxonox/worldentities:2662-2708
code/branches/ceguilua/src/orxonox/worldentities:1802-1808
code/branches/core3/src/orxonox/worldentities:1572-1739
code/branches/core4/src/orxonox/worldentities:3221-3224,3227,3234-3238,3242,3244-3250,3252-3254,3256,3259-3261,3264-3265,3268-3275,3277-3278,3280,3284-3285,3287,3289-3294,3305,3309-3310
code/branches/gametypes/src/orxonox/worldentities:2826-3031
code/branches/gcc43/src/orxonox/worldentities:1580
code/branches/gui/src/orxonox/worldentities:1635-1723,2795-2894
code/branches/input/src/orxonox/worldentities:1629-1636
code/branches/lodfinal/src/orxonox/worldentities:2372-2411
code/branches/map/src/orxonox/worldentities:2801-3086,3089
code/branches/miniprojects/src/orxonox/worldentities:2754-2824
code/branches/netp2/src/orxonox/worldentities:2835-2988
code/branches/netp3/src/orxonox/worldentities:2988-3082
code/branches/netp6/src/orxonox/worldentities:3214-3302
code/branches/network/src/orxonox/worldentities:2356
code/branches/network64/src/orxonox/worldentities:2210-2355
code/branches/objecthierarchy/src/orxonox/worldentities:1911-2085,2100,2110-2169
code/branches/objecthierarchy2/src/orxonox/worldentities:2171-2479
code/branches/overlay/src/orxonox/worldentities:2117-2385
code/branches/particles/src/orxonox/worldentities:2829-3085
code/branches/pch/src/orxonox/worldentities:3113-3194
code/branches/physics/src/orxonox/worldentities:1912-2055,2107-2439
code/branches/physics_merge/src/orxonox/worldentities:2436-2457
code/branches/pickups/src/orxonox/worldentities:1926-2086,2127,2827-2915
code/branches/pickups2/src/orxonox/worldentities:2107-2497,2915-3071
code/branches/presentation/src/orxonox/worldentities:2369-2652,2654-2660
code/branches/questsystem/src/orxonox/worldentities:1894-2088
code/branches/questsystem2/src/orxonox/worldentities:2107-2259
code/branches/questsystem5/src/orxonox/worldentities:2776-2905
code/branches/resource/src/orxonox/worldentities:3327-3366
code/branches/script_trigger/src/orxonox/worldentities:1295-1953,1955
code/branches/sound/src/orxonox/worldentities:2829-3010
code/branches/weapon/src/orxonox/worldentities:1925-2094
code/branches/weapon2/src/orxonox/worldentities:2107-2488
code/branches/weapons/src/orxonox/worldentities:2897-3051
code/branches/weaponsystem/src/orxonox/worldentities:2742-2890
+ /code/branches/libraries/src/orxonox/worldentities:5612-5692
/code/branches/libraries2/src/orxonox/worldentities:5703-5733
/code/branches/resource2/src/orxonox/worldentities:3372-5694
/code/branches/tutorial/src/orxonox/objects/worldentities:2761-2765
code/branches/buildsystem/src/orxonox/worldentities:1874-2276,2278-2400
code/branches/buildsystem2/src/orxonox/worldentities:2506-2658
code/branches/buildsystem3/src/orxonox/worldentities:2662-2708
code/branches/ceguilua/src/orxonox/worldentities:1802-1808
code/branches/core3/src/orxonox/worldentities:1572-1739
code/branches/core4/src/orxonox/worldentities:3221-3224,3227,3234-3238,3242,3244-3250,3252-3254,3256,3259-3261,3264-3265,3268-3275,3277-3278,3280,3284-3285,3287,3289-3294,3305,3309-3310
code/branches/gametypes/src/orxonox/worldentities:2826-3031
code/branches/gcc43/src/orxonox/worldentities:1580
code/branches/gui/src/orxonox/worldentities:1635-1723,2795-2894
code/branches/input/src/orxonox/worldentities:1629-1636
code/branches/lodfinal/src/orxonox/worldentities:2372-2411
code/branches/map/src/orxonox/worldentities:2801-3086,3089
code/branches/miniprojects/src/orxonox/worldentities:2754-2824
code/branches/netp2/src/orxonox/worldentities:2835-2988
code/branches/netp3/src/orxonox/worldentities:2988-3082
code/branches/netp6/src/orxonox/worldentities:3214-3302
code/branches/network/src/orxonox/worldentities:2356
code/branches/network64/src/orxonox/worldentities:2210-2355
code/branches/objecthierarchy/src/orxonox/worldentities:1911-2085,2100,2110-2169
code/branches/objecthierarchy2/src/orxonox/worldentities:2171-2479
code/branches/overlay/src/orxonox/worldentities:2117-2385
code/branches/particles/src/orxonox/worldentities:2829-3085
code/branches/pch/src/orxonox/worldentities:3113-3194
code/branches/physics/src/orxonox/worldentities:1912-2055,2107-2439
code/branches/physics_merge/src/orxonox/worldentities:2436-2457
code/branches/pickups/src/orxonox/worldentities:1926-2086,2127,2827-2915
code/branches/pickups2/src/orxonox/worldentities:2107-2497,2915-3071
code/branches/presentation/src/orxonox/worldentities:2369-2652,2654-2660
code/branches/questsystem/src/orxonox/worldentities:1894-2088
code/branches/questsystem2/src/orxonox/worldentities:2107-2259
code/branches/questsystem5/src/orxonox/worldentities:2776-2905
code/branches/resource/src/orxonox/worldentities:3327-3366
code/branches/script_trigger/src/orxonox/worldentities:1295-1953,1955
code/branches/sound/src/orxonox/worldentities:2829-3010
code/branches/weapon/src/orxonox/worldentities:1925-2094
code/branches/weapon2/src/orxonox/worldentities:2107-2488
code/branches/weapons/src/orxonox/worldentities:2897-3051
code/branches/weaponsystem/src/orxonox/worldentities:2742-2890
Modified: code/branches/tutorial/src/orxonox/worldentities/Drone.cc
===================================================================
--- code/branches/tutorial/src/orxonox/worldentities/Drone.cc 2009-09-24 22:54:12 UTC (rev 5785)
+++ code/branches/tutorial/src/orxonox/worldentities/Drone.cc 2009-09-25 14:16:38 UTC (rev 5786)
@@ -33,16 +33,17 @@
namespace orxonox
{
- // PLACE YOUR CODE HERE
+ // put your code in here:
// create the factory for the drone
CreateFactory(Drone);
Drone::Drone(BaseObject* creator) : ControllableEntity(creator)
{
- this->myController_ = 0;
- // PLACE YOUR CODE HERE
+ //put your code in here:
// - register the drone class to the core
// - create a new controller and pass our this pointer to it as creator
+ this->myController_ = 0;
+ RegisterObject(Drone);
this->localLinearAcceleration_.setValue(0, 0, 0);
this->localAngularAcceleration_.setValue(0, 0, 0);
@@ -69,29 +70,30 @@
// this calls the XMLPort function of the parent class
SUPER(Drone, XMLPort, xmlelement, mode);
- // PLACE YOUR CODE HERE
- // make sure you add the variables primaryThrust_, auxilaryThrust_ and rotationThrust_ to xmlport
- // variables can be added by the following command
- // XMLPortParamVariable(Class, "xml-attribute-name", variable_name, xmlelement, mode);
+ XMLPortParamVariable(Drone, "primaryThrust", primaryThrust_, xmlelement, mode);
+ XMLPortParamVariable(Drone, "auxilaryThrust", auxilaryThrust_, xmlelement, mode);
+ XMLPortParamVariable(Drone, "rotationThrust", rotationThrust_, xmlelement, mode);
}
void Drone::tick(float dt)
{
- // PLACE YOUR CODE HERE
- // make sure the tick function of the base class gets called here
+ SUPER(Drone, tick, dt);
- this->localLinearAcceleration_.setX(this->localLinearAcceleration_.x() * getMass() * this->auxilaryThrust_);
- this->localLinearAcceleration_.setY(this->localLinearAcceleration_.y() * getMass() * this->auxilaryThrust_);
- if (this->localLinearAcceleration_.z() > 0)
- this->localLinearAcceleration_.setZ(this->localLinearAcceleration_.z() * getMass() * this->auxilaryThrust_);
- else
- this->localLinearAcceleration_.setZ(this->localLinearAcceleration_.z() * getMass() * this->primaryThrust_);
- this->physicalBody_->applyCentralForce(physicalBody_->getWorldTransform().getBasis() * this->localLinearAcceleration_);
- this->localLinearAcceleration_.setValue(0, 0, 0);
-
- this->localAngularAcceleration_ *= this->getLocalInertia() * this->rotationThrust_;
- this->physicalBody_->applyTorque(physicalBody_->getWorldTransform().getBasis() * this->localAngularAcceleration_);
- this->localAngularAcceleration_.setValue(0, 0, 0);
+ //if (this->hasLocalController())
+ //{
+ this->localLinearAcceleration_.setX(this->localLinearAcceleration_.x() * getMass() * this->auxilaryThrust_);
+ this->localLinearAcceleration_.setY(this->localLinearAcceleration_.y() * getMass() * this->auxilaryThrust_);
+ if (this->localLinearAcceleration_.z() > 0)
+ this->localLinearAcceleration_.setZ(this->localLinearAcceleration_.z() * getMass() * this->auxilaryThrust_);
+ else
+ this->localLinearAcceleration_.setZ(this->localLinearAcceleration_.z() * getMass() * this->primaryThrust_);
+ this->physicalBody_->applyCentralForce(physicalBody_->getWorldTransform().getBasis() * this->localLinearAcceleration_);
+ this->localLinearAcceleration_.setValue(0, 0, 0);
+
+ this->localAngularAcceleration_ *= this->getLocalInertia() * this->rotationThrust_;
+ this->physicalBody_->applyTorque(physicalBody_->getWorldTransform().getBasis() * this->localAngularAcceleration_);
+ this->localAngularAcceleration_.setValue(0, 0, 0);
+ //}
}
More information about the Orxonox-commit
mailing list