[Orxonox-commit 5400] r10063 - in code/branches/turretFS14: data/levels src/modules/objects
muemart at orxonox.net
muemart at orxonox.net
Tue May 20 10:21:21 CEST 2014
Author: muemart
Date: 2014-05-20 10:21:20 +0200 (Tue, 20 May 2014)
New Revision: 10063
Modified:
code/branches/turretFS14/data/levels/turretTest.oxw
code/branches/turretFS14/src/modules/objects/Turret.cc
code/branches/turretFS14/src/modules/objects/Turret.h
Log:
Comment out all the raytest stuff. Needs more work and/or knowledge
Modified: code/branches/turretFS14/data/levels/turretTest.oxw
===================================================================
--- code/branches/turretFS14/data/levels/turretTest.oxw 2014-05-20 07:03:19 UTC (rev 10062)
+++ code/branches/turretFS14/data/levels/turretTest.oxw 2014-05-20 08:21:20 UTC (rev 10063)
@@ -51,37 +51,7 @@
<BoxCollisionShape radius="10" position="0,0,0" halfExtents="200, 200, 0"/>
</collisionShapes>
</SpaceShip>
-
-<Turret collisionType="dynamic" pitch=90 position="30,0,0">
- <attached>
- <Model position="0,0,0" mesh="turretSocketFront.mesh" scale3D="10,10,10" pitch=-90/>
- <Model position="0,0,0" mesh="turretSocketIn.mesh" scale3D="10,10,10" pitch=-90/>
- <Model position="0,0,0" mesh="turretSocketTop.mesh" scale3D="10,10,10" pitch=-90/>
- <Model position="0,0,0" mesh="turretSocketLeft.mesh" scale3D="10,10,10" pitch=-90/>
- <Model position="0,0,0" mesh="turretSocketRight.mesh" scale3D="10,10,10" pitch=-90/>
-
- <Turret position="0,0,-10" collisionType="dynamic" pitch=20 angularDamping=0.999999 mass=100 maxPitch=45 maxYaw=45 maxAttackRadius=2000 minAttackRadius=30>
- <attached>
- <Model position="0,0,0" pitch="-90" roll="0" mesh="turretHead.mesh" scale3D="10,10,10"/>
- </attached>
- <collisionShapes>
- <SphereCollisionShape radius="10" position = "0,0,0"/>
- </collisionShapes>
- <controller>
- <TurretController/>
- </controller>
- <?lua
- include("includes/weaponSettingsTurret.oxi")
- ?>
- </Turret>
- </attached>
- <controller>
- <TeamTargetProxy team=10/>
- </controller>
- </Turret>
-
-
</Scene>
</Level>
Modified: code/branches/turretFS14/src/modules/objects/Turret.cc
===================================================================
--- code/branches/turretFS14/src/modules/objects/Turret.cc 2014-05-20 07:03:19 UTC (rev 10062)
+++ code/branches/turretFS14/src/modules/objects/Turret.cc 2014-05-20 08:21:20 UTC (rev 10063)
@@ -62,15 +62,17 @@
this->rotation_ = Quaternion::IDENTITY;
this->setRadarVisibility(false);
+
+ //this->rayTest_ = this->getScene()->getSceneManager()->createRayQuery(Ogre::Ray());
}
/**
@brief
- Destructor. Nothing to see here.
+ Destructor. Destroys the rayTest_ element (if it was used) .
*/
Turret::~Turret()
{
-
+ //this->getScene()->getSceneManager()->destroyQuery(this->rayTest_);
}
/**
@@ -86,7 +88,7 @@
@return
The squared distance to the position. -1, if it's ouside of range
*/
- float Turret::isInRange(const WorldEntity* target ) const
+ float Turret::isInRange(const WorldEntity* target )
{
//Check distance
Vector3 distance = target->getWorldPosition() - this->getWorldPosition();
@@ -119,12 +121,12 @@
return -1.f;
}
- Ogre::SceneManager* scenemanager = this->getScene()->getSceneManager();
- Ogre::Ray ray = Ogre::Ray(this->getWorldPosition(), distance);
- Ogre::DefaultRaySceneQuery rayscenequery = Ogre::DefaultRaySceneQuery(scenemanager);
- rayscenequery.setRay(ray);
- //rayscenequery.execute();
+ //TODO: Finish this. Find a way to convert objects from Ogre to Orxonox
+ /*Ogre::Ray ray = Ogre::Ray(this->getWorldPosition(), distance);
+ this->rayTest_->setRay(ray);
+ Ogre::RaySceneQueryResult result = this->rayTest_->execute();*/
+
return distanceVal;
}
@@ -272,7 +274,7 @@
{
//Don't make the rotation instantaneous. Use an arbitrary interpolation, not that great...
//TODO: make the rotation better (constant velocity etc.). At the moment, the turret rotates
- // slower the closer it is to the destination
+ //slower the closer it is to the destination
Quaternion drot = Quaternion::nlerp(dt*this->rotationThrust_/20.f, Quaternion::IDENTITY, this->rotation_);
this->rotate(drot, WorldEntity::World);
this->rotation_ = Quaternion::IDENTITY;
Modified: code/branches/turretFS14/src/modules/objects/Turret.h
===================================================================
--- code/branches/turretFS14/src/modules/objects/Turret.h 2014-05-20 07:03:19 UTC (rev 10062)
+++ code/branches/turretFS14/src/modules/objects/Turret.h 2014-05-20 08:21:20 UTC (rev 10063)
@@ -36,6 +36,7 @@
#include "objects/ObjectsPrereqs.h"
#include "worldentities/pawns/Pawn.h"
+#include <OgreSceneQuery.h>
namespace orxonox
{
@@ -62,7 +63,7 @@
virtual void rotatePitch(const Vector2& value);
virtual void rotateYaw(const Vector2& value);
virtual void rotateRoll(const Vector2& value);
- virtual float isInRange(const WorldEntity* target) const;
+ virtual float isInRange(const WorldEntity* target);
virtual void aimAtPosition(const Vector3 &position);
virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
@@ -118,6 +119,7 @@
Ogre::Real maxPitch_; //!< The maxmium pitch the turret can have (on one side).
Ogre::Real maxYaw_; //!< The maxmium yaw the turret can have (on one side).
float rotationThrust_; //!< The velocity the turret rotates with.
+ Ogre::RaySceneQuery* rayTest_; //!< Used to perform a raytest, currently unused @see isInRange
};
}
More information about the Orxonox-commit
mailing list