[Orxonox-commit 3750] r8430 - in code/branches/steering: data/levels/templates src/orxonox/worldentities src/orxonox/worldentities/pawns
mastalde at orxonox.net
mastalde at orxonox.net
Mon May 9 15:52:36 CEST 2011
Author: mastalde
Date: 2011-05-09 15:52:35 +0200 (Mon, 09 May 2011)
New Revision: 8430
Modified:
code/branches/steering/data/levels/templates/spaceshipAssff.oxt
code/branches/steering/src/orxonox/worldentities/MobileEntity.cc
code/branches/steering/src/orxonox/worldentities/pawns/SpaceShip.cc
code/branches/steering/src/orxonox/worldentities/pawns/SpaceShip.h
Log:
added lift_ and stallSpeed_ for better flight behavior
Modified: code/branches/steering/data/levels/templates/spaceshipAssff.oxt
===================================================================
--- code/branches/steering/data/levels/templates/spaceshipAssff.oxt 2011-05-09 13:38:24 UTC (rev 8429)
+++ code/branches/steering/data/levels/templates/spaceshipAssff.oxt 2011-05-09 13:52:35 UTC (rev 8430)
@@ -13,8 +13,11 @@
primaryThrust = 100;
auxilaryThrust = 30;
- rotationThrust = 25;
+ rotationThrust = 60;
+ lift = 0.2;
+ stallSpeed = 220;
+
collisionType = "dynamic"
mass = 100
linearDamping = 0.7
Modified: code/branches/steering/src/orxonox/worldentities/MobileEntity.cc
===================================================================
--- code/branches/steering/src/orxonox/worldentities/MobileEntity.cc 2011-05-09 13:38:24 UTC (rev 8429)
+++ code/branches/steering/src/orxonox/worldentities/MobileEntity.cc 2011-05-09 13:52:35 UTC (rev 8430)
@@ -83,6 +83,8 @@
this->linearVelocity_.z += this->linearAcceleration_.z * dt;
this->node_->translate(this->linearVelocity_ * dt);
+
+
// Angular part
// Note: angularVelocity_ is a Quaternion with w = 0 while angularAcceleration_ is a Vector3
this->angularVelocity_.x += angularAcceleration_.x * dt;
Modified: code/branches/steering/src/orxonox/worldentities/pawns/SpaceShip.cc
===================================================================
--- code/branches/steering/src/orxonox/worldentities/pawns/SpaceShip.cc 2011-05-09 13:38:24 UTC (rev 8429)
+++ code/branches/steering/src/orxonox/worldentities/pawns/SpaceShip.cc 2011-05-09 13:52:35 UTC (rev 8430)
@@ -35,7 +35,9 @@
#include "core/Template.h"
#include "core/XMLPort.h"
#include "items/Engine.h"
+#include "util/Debug.h"
+
namespace orxonox
{
const float orientationGain = 100;
@@ -51,7 +53,7 @@
this->localLinearAcceleration_.setValue(0, 0, 0);
this->localAngularAcceleration_.setValue(0, 0, 0);
- this->bBoost_ = false;
+ this->bBoost_ = false;
this->steering_ = Vector3::ZERO;
this->engine_ = 0;
@@ -62,6 +64,9 @@
this->boostCooldownDuration_ = 5.0;
this->bBoostCooldown_ = false;
+ this->lift_ = 0.2f;
+ this->stallSpeed = 220.0f;
+
this->bInvertYAxis_ = false;
this->setDestroyWhenPlayerLeft(true);
@@ -74,8 +79,12 @@
this->setConfigValues();
this->registerVariables();
- }
+
+
+
+}
+
SpaceShip::~SpaceShip()
{
if (this->isInitialized() && this->engine_)
@@ -94,6 +103,8 @@
XMLPortParamVariable(SpaceShip, "boostPowerRate", boostPowerRate_, xmlelement, mode);
XMLPortParamVariable(SpaceShip, "boostRate", boostRate_, xmlelement, mode);
XMLPortParamVariable(SpaceShip, "boostCooldownDuration", boostCooldownDuration_, xmlelement, mode);
+ XMLPortParamVariable(SpaceShip, "float", float_, xmlelement, mode);
+ XMLPortParamVariable(SpaceShip, "stallSpeed", stallSpeed_, xmlelement, mode);
}
void SpaceShip::registerVariables()
@@ -162,6 +173,9 @@
this->timer_.setTimer(this->boostCooldownDuration_, false, createExecutor(createFunctor(&SpaceShip::boostCooledDown, this)));
}
}
+
+COUT(1) << "Vel:" << this-> getLocalVelocity().z * -1 << endl;
+
}
}
@@ -174,18 +188,25 @@
{
this->localLinearAcceleration_.setZ(this->localLinearAcceleration_.z() - value.x);
this->steering_.z = -value.x;
+
}
void SpaceShip::moveRightLeft(const Vector2& value)
{
this->localLinearAcceleration_.setX(this->localLinearAcceleration_.x() + value.x);
this->steering_.x = value.x;
+
}
void SpaceShip::moveUpDown(const Vector2& value)
{
this->localLinearAcceleration_.setY(this->localLinearAcceleration_.y() + value.x);
this->steering_.y = value.x;
+
+
+
+
+
}
void SpaceShip::rotateYaw(const Vector2& value)
@@ -193,13 +214,22 @@
this->localAngularAcceleration_.setY(this->localAngularAcceleration_.y() + value.x);
Pawn::rotateYaw(value);
+
}
void SpaceShip::rotatePitch(const Vector2& value)
{
- this->localAngularAcceleration_.setX(this->localAngularAcceleration_.x() + value.x);
+ this->localAngularAcceleration_.setX(this->localAngularAcceleration_.x() + value.x * 0.8);
Pawn::rotatePitch(value);
+
+
+
+ if (abs(this-> getLocalVelocity().z) < stallSpeed) {this->moveUpDown(float_*value*sqrt(abs(this-> getLocalVelocity().z)));}
+
+
+
+
}
void SpaceShip::rotateRoll(const Vector2& value)
@@ -207,6 +237,7 @@
this->localAngularAcceleration_.setZ(this->localAngularAcceleration_.z() + value.x);
Pawn::rotateRoll(value);
+
}
void SpaceShip::fire()
Modified: code/branches/steering/src/orxonox/worldentities/pawns/SpaceShip.h
===================================================================
--- code/branches/steering/src/orxonox/worldentities/pawns/SpaceShip.h 2011-05-09 13:38:24 UTC (rev 8429)
+++ code/branches/steering/src/orxonox/worldentities/pawns/SpaceShip.h 2011-05-09 13:52:35 UTC (rev 8430)
@@ -88,6 +88,8 @@
float boostRate_;
float boostPowerRate_;
float boostCooldownDuration_;
+ float lift_;
+ float stallSpeed_;
Vector3 steering_;
float primaryThrust_;
float auxilaryThrust_;
@@ -95,12 +97,14 @@
btVector3 localLinearAcceleration_;
btVector3 localAngularAcceleration_;
+
+
private:
void registerVariables();
virtual bool isCollisionTypeLegal(WorldEntity::CollisionType type) const;
void loadEngineTemplate();
-
+
void boostCooledDown(void);
std::string enginetemplate_;
More information about the Orxonox-commit
mailing list