[Orxonox-commit 6102] r10760 - in code/branches/hoverHS15: data/levels data/levels/templates src/modules/hover src/modules/invader
fvultier at orxonox.net
fvultier at orxonox.net
Mon Nov 2 18:01:56 CET 2015
Author: fvultier
Date: 2015-11-02 18:01:56 +0100 (Mon, 02 Nov 2015)
New Revision: 10760
Added:
code/branches/hoverHS15/data/levels/templates/spaceshipHover.oxt
Modified:
code/branches/hoverHS15/data/levels/Hover.oxw
code/branches/hoverHS15/src/modules/hover/Hover.cc
code/branches/hoverHS15/src/modules/hover/HoverShip.cc
code/branches/hoverHS15/src/modules/hover/HoverShip.h
code/branches/hoverHS15/src/modules/hover/HoverWall.cc
code/branches/hoverHS15/src/modules/invader/InvaderShip.cc
code/branches/hoverHS15/src/modules/invader/InvaderShip.h
Log:
2 problems fixed: The collidesAgainst function in the hovership get now properly called. The Hoverhalls have a collisionShape that works.
Modified: code/branches/hoverHS15/data/levels/Hover.oxw
===================================================================
--- code/branches/hoverHS15/data/levels/Hover.oxw 2015-11-02 15:48:27 UTC (rev 10759)
+++ code/branches/hoverHS15/data/levels/Hover.oxw 2015-11-02 17:01:56 UTC (rev 10760)
@@ -13,6 +13,7 @@
<?lua
include("templates/spaceshipPirate.oxt")
+ include("templates/spaceshipHover.oxt")
?>
<Level
@@ -74,7 +75,7 @@
<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"/>
- <SpawnPoint team=0 position="0,100,0" lookat="100,100,0" spawnclass=SpaceShip pawndesign=spaceshippirate />
+ <SpawnPoint team=0 position="0,100,0" lookat="100,100,0" spawnclass=HoverShip pawndesign=spaceshiphover />
</Scene>
</Level>
Added: code/branches/hoverHS15/data/levels/templates/spaceshipHover.oxt
===================================================================
--- code/branches/hoverHS15/data/levels/templates/spaceshipHover.oxt (rev 0)
+++ code/branches/hoverHS15/data/levels/templates/spaceshipHover.oxt 2015-11-02 17:01:56 UTC (rev 10760)
@@ -0,0 +1,104 @@
+<Template name=spaceshiphover>
+ <HoverShip
+ camerapositiontemplate = spaceshiphovercameras
+ spawnparticlesource = "Orxonox/fairytwirl"
+ spawnparticleduration = 3
+ explosionchunks = 6
+
+ health = 100
+ maxhealth = 200
+ initialhealth = 100
+
+ shieldhealth = 25
+ initialshieldhealth = 25
+ maxshieldhealth = 40
+ shieldabsorption = 0.6
+ reloadrate = 2
+ reloadwaittime = 0.5
+
+ primaryThrust = 100
+ auxilaryThrust = 30
+ rotationThrust = 25
+
+ lift = 1;
+ stallSpeed = 220;
+
+ boostPower = 10
+ boostPowerRate = 1
+ boostRate = 5
+ boostCooldownDuration = 10
+
+ collisionType = "dynamic"
+ mass = 100
+ linearDamping = 0.7
+ angularDamping = 0.9999999
+ >
+ <engines>
+ <MultiStateEngine position=" 0, 0, 0" template=spaceshiphoverengine />
+ </engines>
+ <attached>
+ <Model position="0,0,0" yaw=90 pitch=-90 roll=0 scale=4 mesh="pirate.mesh" />
+ <BlinkingBillboard position=" 12.7,-3.8,0" material="Examples/Flare" colour="1.0, 1.0, 1" amplitude=0.04 frequency=1 quadratic=1 />
+ <BlinkingBillboard position="-12.7,-3.8,0" material="Examples/Flare" colour="1.0, 1.0, 1" amplitude=0.04 frequency=1 quadratic=1 phase="90"/>
+ <BlinkingBillboard position=" 8.7,-0.5,2.5" material="Examples/Flare" colour="1.0, 1.0, 1" amplitude=0.04 frequency=1 quadratic=1 phase="30"/>
+ <BlinkingBillboard position="-8.7,-0.5,2.5" material="Examples/Flare" colour="1.0, 1.0, 1" amplitude=0.04 frequency=1 quadratic=1 phase="60"/>
+ </attached>
+ <collisionShapes>
+ <BoxCollisionShape position="0,0,0" halfExtents="10, 3, 5" />
+ <BoxCollisionShape position="13,-1.3,0" halfExtents="3, 1, 2" />
+ <BoxCollisionShape position="-13,-1.3,0" halfExtents="3, 1, 2" />
+ <BoxCollisionShape position="0,0,7" halfExtents="3, 2, 2" />
+ <BoxCollisionShape position="0,0.1,-11" halfExtents="2.2, 1.8, 6" />
+ <BoxCollisionShape position="0,0.1,-19" halfExtents="1.4, 1, 2" />
+ </collisionShapes>
+
+<?lua
+ include("../includes/weaponSettingsPirate.oxi")
+?>
+ </HoverShip>
+</Template>
+
+<Template name=spaceshiphovercameras defaults=0>
+ <SpaceShip>
+ <camerapositions>
+ <CameraPosition position="0,8, 60" drag=true mouselook=true />
+ <CameraPosition position="0,16, 120" drag=true mouselook=true />
+ <CameraPosition position="0,24,180" drag=true mouselook=true />
+ <CameraPosition position="0,60,10" pitch="-80" drag=true mouselook=true />
+ </camerapositions>
+ </SpaceShip>
+</Template>
+
+<Template name=spaceshiphoverengine baseclass=MultiStateEngine>
+ <MultiStateEngine
+ boostfactor = 2
+
+ speedfront = 150
+ speedback = 50
+ speedleftright = 50
+ speedupdown = 50
+
+ accelerationfront = 500
+ accelerationbrake = 500
+ accelerationback = 125
+ accelerationleftright = 125
+ accelerationupdown = 125
+ >
+ <EffectContainer condition="not idle">
+ <FadingBillboard mainstate=activity active=false scale=0.02 position=" 1.3, -4, -15" colour="1.0, 0.65, 0.2, 1.0" material="Examples/FlareZwei" turnontime=0.5 turnofftime=0.5 />
+ <FadingBillboard mainstate=activity active=false scale=0.02 position=" 0, -4, -15" colour="1.0, 0.65, 0.2, 1.0" material="Examples/FlareZwei" turnontime=0.5 turnofftime=0.5 />
+ <FadingBillboard mainstate=activity active=false scale=0.02 position="-1.3, -4, -15" colour="1.0, 0.65, 0.2, 1.0" material="Examples/FlareZwei" turnontime=0.5 turnofftime=0.5 />
+ </EffectContainer>
+ <EffectContainer condition="normal or boost">
+ <Backlight mainstate=activity active=false scale=0.4 name=bltest position=" 13, -4, 9.5" colour="1.0, 0.65, 0.2, 1.0" width=8 length=800 lifetime=1 elements=50 trailmaterial="Trail/backlighttrail" turnontime=1 turnofftime=1 material="Flares/ThrusterFlare1" />
+ <Backlight mainstate=activity active=false scale=0.4 name=bltest position="-13, -4, 9.5" colour="1.0, 0.65, 0.2, 1.0" width=8 length=800 lifetime=1 elements=50 trailmaterial="Trail/backlighttrail" turnontime=1 turnofftime=1 material="Flares/ThrusterFlare1" />
+ </EffectContainer>
+ <EffectContainer condition="boost">
+ <Backlight mainstate=activity active=false scale=0.4 name=bltest position=" 0, 5, 15.5" colour="1.0, 0.65, 0.2, 1.0" width=16 length=1600 lifetime=2 elements=50 trailmaterial="Trail/backlighttrail" turnontime=1 turnofftime=1 material="Flares/ThrusterFlare1" />
+ </EffectContainer>
+ <EffectContainer condition="brake">
+ <FadingBillboard mainstate=activity active=false scale=0.1 position=" 4.4, -5.5, 5" colour="0.8, 0.0, 0.0, 0.3" material="Examples/Flare" turnontime=0.5 turnofftime=0.5 />
+ <FadingBillboard mainstate=activity active=false scale=0.1 position="-4.4, -5.5, 5" colour="0.8, 0.0, 0.0, 0.3" material="Examples/Flare" turnontime=0.5 turnofftime=0.5 />
+ </EffectContainer>
+ </MultiStateEngine>
+</Template>
Modified: code/branches/hoverHS15/src/modules/hover/Hover.cc
===================================================================
--- code/branches/hoverHS15/src/modules/hover/Hover.cc 2015-11-02 15:48:27 UTC (rev 10759)
+++ code/branches/hoverHS15/src/modules/hover/Hover.cc 2015-11-02 17:01:56 UTC (rev 10760)
@@ -55,9 +55,11 @@
{
SUPER(Hover, tick, dt);
- if(firstTick){
+ if(firstTick)
+ {
firstTick = false;
new HoverWall(origin_->getContext(), 1, 2);
+ new HoverWall(origin_->getContext(), 2, 6);
}
Modified: code/branches/hoverHS15/src/modules/hover/HoverShip.cc
===================================================================
--- code/branches/hoverHS15/src/modules/hover/HoverShip.cc 2015-11-02 15:48:27 UTC (rev 10759)
+++ code/branches/hoverHS15/src/modules/hover/HoverShip.cc 2015-11-02 17:01:56 UTC (rev 10760)
@@ -48,7 +48,7 @@
SUPER(HoverShip, tick, dt);
}
- void HoverShip::moveFrontBack(const Vector2& value)
+ /*void HoverShip::moveFrontBack(const Vector2& value)
{ this->steering_.z -= value.x; }
void HoverShip::moveRightLeft(const Vector2& value)
@@ -59,10 +59,12 @@
void HoverShip::rotateYaw(const Vector2& value) {}
void HoverShip::rotatePitch(const Vector2& value) {}
- void HoverShip::rotateRoll(const Vector2& value) {}
+ void HoverShip::rotateRoll(const Vector2& value) {}*/
- bool HoverShip::collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint)
+ bool HoverShip::collidesAgainst(WorldEntity* otherObject, const btCollisionShape* cs, btManifoldPoint& contactPoint)
{
+ orxout() << "collision" << endl;
+
/*if (contactPoint.m_normalWorldOnB.y() > 0.6)
this->isFloor_ = true;
else
Modified: code/branches/hoverHS15/src/modules/hover/HoverShip.h
===================================================================
--- code/branches/hoverHS15/src/modules/hover/HoverShip.h 2015-11-02 15:48:27 UTC (rev 10759)
+++ code/branches/hoverHS15/src/modules/hover/HoverShip.h 2015-11-02 17:01:56 UTC (rev 10760)
@@ -52,7 +52,7 @@
virtual void tick(float dt);
- virtual void moveFrontBack(const Vector2& value);
+ /*virtual void moveFrontBack(const Vector2& value);
virtual void moveRightLeft(const Vector2& value);
@@ -62,9 +62,9 @@
virtual void rotatePitch(const Vector2& value);
- virtual void rotateRoll(const Vector2& value);
+ virtual void rotateRoll(const Vector2& value);*/
- virtual bool collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint);
+ virtual bool collidesAgainst(WorldEntity* otherObject, const btCollisionShape* cs, btManifoldPoint& contactPoint);
virtual void boost(bool bBoost);
Modified: code/branches/hoverHS15/src/modules/hover/HoverWall.cc
===================================================================
--- code/branches/hoverHS15/src/modules/hover/HoverWall.cc 2015-11-02 15:48:27 UTC (rev 10759)
+++ code/branches/hoverHS15/src/modules/hover/HoverWall.cc 2015-11-02 17:01:56 UTC (rev 10760)
@@ -49,31 +49,30 @@
HoverWall::HoverWall(Context* context) : StaticEntity(context)
{
RegisterObject(HoverWall);
- model_ = new Model(context);
- cs_ = new BoxCollisionShape(context);
- model_->setMeshSource("cube.mesh");
- model_->setScale3D(Vector3(100, 30, 2));
- model_->setPosition(Vector3(100,0,100));
- cs_->setPosition(Vector3(100,0,100));
- cs_->setHalfExtents(Vector3(100, 30, 2));
-
-
-
+ model_ = NULL;
+ cs_ = NULL;
}
HoverWall::HoverWall(Context* context, int x, int y) : StaticEntity(context)
{
RegisterObject(HoverWall);
+
model_ = new Model(context);
- cs_ = new BoxCollisionShape(context);
model_->setMeshSource("cube.mesh");
- model_->setScale3D(Vector3(50, 30, 2));
+ model_->setScale3D(Vector3(100, 30, 2));
model_->setPosition(Vector3(x*100-50,0,y*100-50));
- cs_->setPosition(Vector3(x*100-50,0,y*100-50));
- cs_->setHalfExtents(Vector3(50, 30, 2));
+ this->attach(model_);
+ this->enableCollisionCallback();
+ this->setCollisionResponse(true);
+ this->setCollisionType(Static);
+ cs_ = new BoxCollisionShape(context);
+ cs_->setHalfExtents(Vector3(100, 30, 2));
+ cs_->setPosition(Vector3(x*100-50,0,y*100-50));
+
+ this->attachCollisionShape(cs_);
}
/**
Modified: code/branches/hoverHS15/src/modules/invader/InvaderShip.cc
===================================================================
--- code/branches/hoverHS15/src/modules/invader/InvaderShip.cc 2015-11-02 15:48:27 UTC (rev 10759)
+++ code/branches/hoverHS15/src/modules/invader/InvaderShip.cc 2015-11-02 17:01:56 UTC (rev 10760)
@@ -138,7 +138,7 @@
{
isFireing = bBoost;
}
- inline bool InvaderShip::collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint)
+ inline bool InvaderShip::collidesAgainst(WorldEntity* otherObject, const btCollisionShape* cs, btManifoldPoint& contactPoint)
{
// orxout() << "touch!!! " << endl; //<< otherObject << " at " << contactPoint;
InvaderEnemy* enemy = orxonox_cast<InvaderEnemy*>(otherObject);
Modified: code/branches/hoverHS15/src/modules/invader/InvaderShip.h
===================================================================
--- code/branches/hoverHS15/src/modules/invader/InvaderShip.h 2015-11-02 15:48:27 UTC (rev 10759)
+++ code/branches/hoverHS15/src/modules/invader/InvaderShip.h 2015-11-02 17:01:56 UTC (rev 10760)
@@ -64,7 +64,7 @@
virtual void updateLevel();
- virtual inline bool collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint);
+ virtual inline bool collidesAgainst(WorldEntity* otherObject, const btCollisionShape* cs, btManifoldPoint& contactPoint);
protected:
virtual void death();
More information about the Orxonox-commit
mailing list