[Orxonox-commit 6126] r10784 - in code/branches/hoverHS15: data/levels/templates src/modules/hover
bucyril at orxonox.net
bucyril at orxonox.net
Mon Nov 9 14:09:38 CET 2015
Author: bucyril
Date: 2015-11-09 14:09:38 +0100 (Mon, 09 Nov 2015)
New Revision: 10784
Modified:
code/branches/hoverHS15/data/levels/templates/spaceshipHover.oxt
code/branches/hoverHS15/src/modules/hover/HoverShip.cc
code/branches/hoverHS15/src/modules/hover/HoverShip.h
Log:
Finished hover ship control and resolved merge conflict
--this line, and those below, will be ignored--
M src/modules/hover/HoverShip.cc
M src/modules/hover/HoverShip.h
M data/levels/templates/spaceshipHover.oxt
Modified: code/branches/hoverHS15/data/levels/templates/spaceshipHover.oxt
===================================================================
--- code/branches/hoverHS15/data/levels/templates/spaceshipHover.oxt 2015-11-09 12:57:59 UTC (rev 10783)
+++ code/branches/hoverHS15/data/levels/templates/spaceshipHover.oxt 2015-11-09 13:09:38 UTC (rev 10784)
@@ -1,5 +1,6 @@
<Template name=spaceshiphover>
- <HoverShip
+ <SpaceShip
+ hudtemplate = spaceshiphud
camerapositiontemplate = spaceshiphovercameras
spawnparticlesource = "Orxonox/fairytwirl"
spawnparticleduration = 3
@@ -20,6 +21,8 @@
auxilaryThrust = 30
rotationThrust = 25
+ jumpBoost = 30
+
lift = 1;
stallSpeed = 220;
@@ -30,7 +33,7 @@
collisionType = "dynamic"
mass = 100
- linearDamping = 0.7
+ linearDamping = 0.2
angularDamping = 0.9999999
>
<engines>
@@ -55,7 +58,7 @@
<?lua
include("../includes/weaponSettingsPirate.oxi")
?>
- </HoverShip>
+ </SpaceShip>
</Template>
<Template name=spaceshiphovercameras defaults=0>
@@ -69,7 +72,7 @@
</SpaceShip>
</Template>
-<Template name=spaceshiphoverengine baseclass=MultiStateEngine>
+<Template name=spaceshiphoverengine baseclass=Engine>
<MultiStateEngine
boostfactor = 2
Modified: code/branches/hoverHS15/src/modules/hover/HoverShip.cc
===================================================================
--- code/branches/hoverHS15/src/modules/hover/HoverShip.cc 2015-11-09 12:57:59 UTC (rev 10783)
+++ code/branches/hoverHS15/src/modules/hover/HoverShip.cc 2015-11-09 13:09:38 UTC (rev 10784)
@@ -41,6 +41,8 @@
HoverShip::HoverShip(Context* context) : SpaceShip(context)
{
RegisterObject(HoverShip);
+ enableCollisionCallback();
+ isFloor_ = false;
}
void HoverShip::tick(float dt)
@@ -48,8 +50,8 @@
SUPER(HoverShip, tick, dt);
}
- /*void HoverShip::moveFrontBack(const Vector2& value)
- { this->steering_.z -= value.x; }
+ void HoverShip::moveFrontBack(const Vector2& value)
+ { this->steering_.z -= value.x; }
void HoverShip::moveRightLeft(const Vector2& value)
{ this->steering_.x += value.x; }
@@ -57,35 +59,77 @@
void HoverShip::moveUpDown(const Vector2& value)
{ this->steering_.y += value.x; }
- void HoverShip::rotateYaw(const Vector2& value) {}
- void HoverShip::rotatePitch(const Vector2& value) {}
- void HoverShip::rotateRoll(const Vector2& value) {}*/
+ void HoverShip::rotateYaw(const Vector2& value)
+ {
+ this->localAngularAcceleration_.setY(this->localAngularAcceleration_.y() + value.x);
+ Pawn::rotateYaw(value);
+ }
+
+ void HoverShip::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+ {
+ SUPER(HoverShip, XMLPort, xmlelement, mode);
+
+ XMLPortParam(HoverShip, "jumpBoost", setJumpBoost, getJumpBoost, xmlelement, mode);
+ }
+
+
+ void HoverShip::setJumpBoost(float jumpBoost)
+ {
+ this->jumpBoost_ = jumpBoost;
+ }
+
+
+ float HoverShip::getJumpBoost()
+ {
+ return jumpBoost_;
+ }
+
+ /**
+ @brief
+ Rotate in pitch direction.
+ Due to added left, can also lead to an additional up-down motion.
+ @param value
+ A vector whose first component specifies the magnitude of the rotation. Positive means pitch up, negative means pitch down.
+ */
+ void HoverShip::rotatePitch(const Vector2& value) { }
+
+ /**
+ @brief
+ Rotate in roll direction.
+ @param value
+ A vector whose first component specifies the magnitude of the rotation. Positive means roll left, negative means roll right.
+ */
+ void HoverShip::rotateRoll(const Vector2& value) { }
+
bool HoverShip::collidesAgainst(WorldEntity* otherObject, const btCollisionShape* cs, btManifoldPoint& contactPoint)
{
- orxout() << "collision" << endl;
+ SpaceShip::collidesAgainst(otherObject, cs, contactPoint);
+ //SUPER(HoverShip, collidesAgainst, otherObject, cs, contactPoint);
- /*if (contactPoint.m_normalWorldOnB.y() > 0.6)
+ if (contactPoint.m_normalWorldOnB.y() > 0.6
+ && this->getVelocity().y < 1) {
this->isFloor_ = true;
- else
+ } else {
this->isFloor_ = false;
+ }
- return false;*/
return false;
}
void HoverShip::boost(bool bBoost) {
- /*if (this->isFloor_)
+ if (bBoost && this->isFloor_)
{
- if (!this->thisTickBoost_)
- this->localVelocity_.y = jumpValue_;
- //this->physicalBody_->applyCentralImpulse(btVector3(0, jumpvalue, 0));
- this->thisTickBoost_ = true;
+ this->setVelocity(
+ this->getVelocity().x,
+ jumpBoost_,
+ this->getVelocity().z
+ );
this->isFloor_ = false;
- }*/
+ }
}
- /* Hover* HoverShip::getGame()
+ /*Hover* HoverShip::getGame()
{
if (game == NULL)
{
Modified: code/branches/hoverHS15/src/modules/hover/HoverShip.h
===================================================================
--- code/branches/hoverHS15/src/modules/hover/HoverShip.h 2015-11-09 12:57:59 UTC (rev 10783)
+++ code/branches/hoverHS15/src/modules/hover/HoverShip.h 2015-11-09 13:09:38 UTC (rev 10784)
@@ -34,12 +34,14 @@
#ifndef _HoverShip_H__
#define _HoverShip_H__
+#include <BulletCollision/NarrowPhaseCollision/btManifoldPoint.h>
#include "HoverPrereqs.h"
#include "core/XMLPort.h"
#include "worldentities/pawns/SpaceShip.h"
#include "graphics/Camera.h"
+#include "core/class/Super.h"
#include "Hover.h" // Is necessary for getGame function
@@ -47,13 +49,23 @@
{
class _HoverExport HoverShip : public SpaceShip
{
+ private:
+ float jumpBoost_;
+ bool isFloor_;
+
public:
HoverShip(Context* context);
virtual void tick(float dt);
- /*virtual void moveFrontBack(const Vector2& value);
+ virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+ virtual void setJumpBoost(float jumpBoost);
+
+ virtual float getJumpBoost();
+
+ virtual void moveFrontBack(const Vector2& value);
+
virtual void moveRightLeft(const Vector2& value);
virtual void moveUpDown(const Vector2& value);
@@ -62,7 +74,7 @@
virtual void rotatePitch(const Vector2& value);
- virtual void rotateRoll(const Vector2& value);*/
+ virtual void rotateRoll(const Vector2& value);
virtual bool collidesAgainst(WorldEntity* otherObject, const btCollisionShape* cs, btManifoldPoint& contactPoint);
More information about the Orxonox-commit
mailing list