[Orxonox-commit 6603] r11243 - code/branches/QuestGuide_HS16/src/orxonox/worldentities
ooguz at orxonox.net
ooguz at orxonox.net
Mon Oct 24 16:01:12 CEST 2016
Author: ooguz
Date: 2016-10-24 16:01:11 +0200 (Mon, 24 Oct 2016)
New Revision: 11243
Added:
code/branches/QuestGuide_HS16/src/orxonox/worldentities/Waypointarrow.cc
code/branches/QuestGuide_HS16/src/orxonox/worldentities/Waypointarrow.h
Modified:
code/branches/QuestGuide_HS16/src/orxonox/worldentities/CMakeLists.txt
code/branches/QuestGuide_HS16/src/orxonox/worldentities/Waypoint.cc
code/branches/QuestGuide_HS16/src/orxonox/worldentities/Waypoint.h
Log:
Waypointarrow und Waypoint Klassen
Modified: code/branches/QuestGuide_HS16/src/orxonox/worldentities/CMakeLists.txt
===================================================================
--- code/branches/QuestGuide_HS16/src/orxonox/worldentities/CMakeLists.txt 2016-10-24 13:58:29 UTC (rev 11242)
+++ code/branches/QuestGuide_HS16/src/orxonox/worldentities/CMakeLists.txt 2016-10-24 14:01:11 UTC (rev 11243)
@@ -12,6 +12,7 @@
TeamSpawnPoint.cc
ExplosionPart.cc
Actionpoint.cc
+ Waypointarrow.cc
Waypoint.cc
)
Modified: code/branches/QuestGuide_HS16/src/orxonox/worldentities/Waypoint.cc
===================================================================
--- code/branches/QuestGuide_HS16/src/orxonox/worldentities/Waypoint.cc 2016-10-24 13:58:29 UTC (rev 11242)
+++ code/branches/QuestGuide_HS16/src/orxonox/worldentities/Waypoint.cc 2016-10-24 14:01:11 UTC (rev 11243)
@@ -12,10 +12,11 @@
Waypoint::Waypoint(Context* context) : StaticEntity(context)
{
RegisterObject(Waypoint);
-
- this->setPriority(Priority::VeryLow);
-
- this->registerVariables();
+ model = new Model(this->getContext());
+ model->setMeshSource("cube.mesh"); // Name of the arrow file for now bottle
+ model->setScale(3);
+ //model->setOrientation(Vector3(0,0,-1));
+ model->setPosition(this->getPosition()); // this is wrong, it has to be triggered
}
Waypoint::~Waypoint()
@@ -23,82 +24,17 @@
}
- void Waypoint::XMLPort(Element& xmlelement, XMLPort::Mode mode){
- SUPER(Waypoint, XMLPort, xmlelement, mode); // From the SpaceShip.cc file
+ WorldEntity::setDirection
+ WorldEntity::getPosition()
+ setOrientation()
+ void Waypoint::XMLPort(Element& xmlelement, XMLPort::Mode mode){
+ SUPER(Waypoint, XMLPort, xmlelement, mode); // From the SpaceShip.cc file
//XMLPortObject(SpaceShip, Engine, "engines", addEngine, getEngine, xmlelement, mode); // TRY ADDING THE WAYPOINT ARROW LIKE AN ENGINE
}
-
- void Waypoint::registerVariables()
- {
- // Ugly const casts, but are valid because position and orientation are not actually const
- registerVariable(const_cast<Vector3&>(this->getPosition()), \
- VariableDirection::ToClient, new NetworkCallback<StaticEntity>(this, &StaticEntity::positionChanged));
- registerVariable(const_cast<Quaternion&>(this->getOrientation()),
- VariableDirection::ToClient, new NetworkCallback<StaticEntity>(this, &StaticEntity::orientationChanged));
- }
-
-
-
- void Waypoint::setOrientation(const Quaternion& orientation)
- {
- if (this->addedToPhysicalWorld())
- {
- orxout(internal_warning) << "Attempting to change the orientation of a StaticEntity at physics run time. Ignoring change." << endl;
- return;
- }
- if (this->isStatic())
- {
- btTransform transf = this->physicalBody_->getWorldTransform();
- transf.setRotation(btQuaternion(orientation.x, orientation.y, orientation.z, orientation.w));
- this->physicalBody_->setWorldTransform(transf);
- }
-
- this->node_->setOrientation(orientation);
-
- }
-
- Vector3 Waypoint::toAimPosition(RadarViewable* target) const
- {
- Vector3 wePosition = HumanController::getLocalControllerSingleton()->getControllableEntity()->getWorldPosition();
- Vector3 targetPosition = target->getRVWorldPosition();
- Vector3 targetSpeed = target->getRVVelocity();
-
- return getPredictedPosition(wePosition, this->currentMunitionSpeed_, targetPosition, targetSpeed);
- }
-
-/*
- bool StaticEntity::isCollisionTypeLegal(WorldEntity::CollisionType type) const
- {
- if (type == WorldEntity::CollisionType::Kinematic || type == WorldEntity::CollisionType::Dynamic)
- {
- orxout(internal_warning) << "Cannot tell a StaticEntity to have kinematic or dynamic collision type! Ignoring." << endl;
- assert(false); // Only in debug mode
- return false;
- }
- else
- return true;
- }
-*/
- void Waypoint::setWorldTransform(const btTransform& worldTrans)
- {
- OrxAssert(false, "Setting world transform of a StaticEntity, which is CF_STATIC!");
- }
-
- void Waypoint::getWorldTransform(btTransform& worldTrans) const
- {
- worldTrans.setOrigin(btVector3(node_->getPosition().x, node_->getPosition().y, node_->getPosition().z));
- worldTrans.setRotation(btQuaternion(node_->getOrientation().x, node_->getOrientation().y, node_->getOrientation().z, node_->getOrientation().w));
- }
}
-
-
-const Pawn* pawnPtr = orxonox_cast<const Pawn*>(it->first->getWorldEntity());
-
-if (pawnPtr) {
- float position = pawnPtr->getPosition();
Modified: code/branches/QuestGuide_HS16/src/orxonox/worldentities/Waypoint.h
===================================================================
--- code/branches/QuestGuide_HS16/src/orxonox/worldentities/Waypoint.h 2016-10-24 13:58:29 UTC (rev 11242)
+++ code/branches/QuestGuide_HS16/src/orxonox/worldentities/Waypoint.h 2016-10-24 14:01:11 UTC (rev 11243)
@@ -5,15 +5,13 @@
#include "OrxonoxPrereqs.h"
#include "StaticEntity.h"
-#include "overlays/OverlaysPrereqs.h"
+#include "graphics/Model.h"
#include <map>
#include <string>
#include "util/OgreForwardRefs.h"
#include "tools/interfaces/Tickable.h"
-#include "interfaces/RadarListener.h"
-#include "overlays/OrxonoxOverlay.h"
namespace orxonox
{
@@ -29,50 +27,25 @@
A StaticEntity can only have the collisition type WorldEntity::None or WorldEntity::Static. The collsion types WorldEntity::Dynamic and WorldEntity::Kinematic are illegal.
*/
- class _OrxonoxExport Waypoint : public StaticEntity, public RadarListener
- {
+ class _OrxonoxExport Waypoint : public StaticEntity {
+
public:
+
Waypoint(Context* context);
virtual ~Waypoint();
- virtual void addObject(RadarViewable* object) override;
- virtual void removeObject(RadarViewable* viewable) override;
- virtual void objectChanged(RadarViewable* viewable) override;
- using StaticEntity::setPosition;
- using StaticEntity::setOrientation;
+ virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override;
- virtual void setPosition(const Vector3& position) override;
- virtual void setOrientation(const Quaternion& orientation) override;
- virtual void positionChanged() override { }
- virtual void radarTick(float dt) override {}
- virtual inline float getRadarSensitivity() const override
- { return 1.0f; }
-
- inline unsigned int getMarkerLimit() const
- { return this->markerLimit_; }
-
- static void selectClosestTarget();
- static void selectNextTarget();
-
-
-
private:
- void registerVariables();
+
//virtual bool isCollisionTypeLegal(CollisionType type) const override;
-
+ Model* model;
+
// network callbacks
- inline void positionChanged()
- { this->setPosition(this->getPosition()); }
- inline void orientationChanged()
- { this->setOrientation(this->getOrientation()); }
-
- // Bullet btMotionState related
- virtual void setWorldTransform(const btTransform& worldTrans) override;
- virtual void getWorldTransform(btTransform& worldTrans) const override;
};
}
-#endif /* _StaticEntity_H__ */
+#endif /* _Waypoint_H__ */
Added: code/branches/QuestGuide_HS16/src/orxonox/worldentities/Waypointarrow.cc
===================================================================
--- code/branches/QuestGuide_HS16/src/orxonox/worldentities/Waypointarrow.cc (rev 0)
+++ code/branches/QuestGuide_HS16/src/orxonox/worldentities/Waypointarrow.cc 2016-10-24 14:01:11 UTC (rev 11243)
@@ -0,0 +1,40 @@
+#include "Waypoint.h"
+
+#include <OgreSceneNode.h>
+#include <BulletDynamics/Dynamics/btRigidBody.h>
+#include "util/OrxAssert.h"
+#include "core/CoreIncludes.h"
+
+namespace orxonox
+{
+ RegisterClass(Waypointarrow);
+
+ Waypointarrow::Waypointarrow(Context* context) : StaticEntity(context)
+ {
+ RegisterObject(Waypointarrow);
+ model = new Model(this->getContext());
+ model->setMeshSource("axes.mesh"); // Name of the arrow file for now bottle
+ this->attach(model);
+ model->setScale(3);
+ //model->setOrientation(Vector3(0,0,-1));
+ model->setPosition(Vector3(0,15,0));
+ }
+
+ Waypointarrow::~Waypointarrow()
+ {
+ }
+
+
+
+
+ void Waypointarrow::XMLPort(Element& xmlelement, XMLPort::Mode mode){
+ SUPER(Waypointarrow, XMLPort, xmlelement, mode); // From the SpaceShip.cc file
+
+
+ //XMLPortObject(SpaceShip, Engine, "engines", addEngine, getEngine, xmlelement, mode); // TRY ADDING THE WAYPOINT ARROW LIKE AN ENGINE
+
+
+ }
+
+
+}
Added: code/branches/QuestGuide_HS16/src/orxonox/worldentities/Waypointarrow.h
===================================================================
--- code/branches/QuestGuide_HS16/src/orxonox/worldentities/Waypointarrow.h (rev 0)
+++ code/branches/QuestGuide_HS16/src/orxonox/worldentities/Waypointarrow.h 2016-10-24 14:01:11 UTC (rev 11243)
@@ -0,0 +1,52 @@
+
+
+#ifndef _Waypoint_H__
+#define _Waypoint_H__
+
+#include "OrxonoxPrereqs.h"
+#include "StaticEntity.h"
+#include "graphics/Model.h"
+
+#include <map>
+#include <string>
+
+#include "util/OgreForwardRefs.h"
+#include "tools/interfaces/Tickable.h"
+#include "interfaces/RadarListener.h"
+
+namespace orxonox
+{
+ /**
+ @brief
+ The StaticEntity is the simplest derivative of the @ref orxonox::WorldEntity class. This means all StaticEntity instances also have
+ a position in space, a mass, a scale, a frication, ... because every StaticEntity is a WorldEntity. You can attach StaticEntities to eachother ike @ref orxonox::WorldEntity WorldEntities.
+
+ In contrast to the MobileEntity the StaticEntity cannot move with respect to the parent to which it is attached. That's why
+ it is called StaticEntity. It will keep the same position (always with respect to its parent) forever unless you call the
+ function @see setPosition to changee it.
+
+ A StaticEntity can only have the collisition type WorldEntity::None or WorldEntity::Static. The collsion types WorldEntity::Dynamic and WorldEntity::Kinematic are illegal.
+ */
+
+ class _OrxonoxExport Waypoint : public StaticEntity {
+
+ public:
+
+ Waypointarrow(Context* context);
+ virtual ~Waypointarrow();
+
+
+ virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override;
+
+
+
+
+ private:
+
+ //virtual bool isCollisionTypeLegal(CollisionType type) const override;
+ Model* model;
+ // network callbacks
+ };
+}
+
+#endif /* _Waypoint_H__ */
More information about the Orxonox-commit
mailing list