Index: /orxonox/trunk/src/Makefile.am
===================================================================
--- /orxonox/trunk/src/Makefile.am	(revision 3520)
+++ /orxonox/trunk/src/Makefile.am	(revision 3521)
@@ -41,4 +41,5 @@
 		 world_entities/environment.cc \
 		 world_entities/skysphere.cc \
+		 world_entities/primitive.cc \
 		 ai/ai.cc \
 		 lib/coord/p_node.cc \
@@ -83,4 +84,5 @@
 		 world_entities/shoot_rocket.h \
 		 world_entities/power_up.h \
+		 world_entities/primitive.h \
 		 ai/ai.h \
 		 network/synchronisable.h \
Index: /orxonox/trunk/src/Makefile.in
===================================================================
--- /orxonox/trunk/src/Makefile.in	(revision 3520)
+++ /orxonox/trunk/src/Makefile.in	(revision 3521)
@@ -58,11 +58,11 @@
 	campaign.$(OBJEXT) world.$(OBJEXT) world_entity.$(OBJEXT) \
 	player.$(OBJEXT) environment.$(OBJEXT) skysphere.$(OBJEXT) \
-	ai.$(OBJEXT) p_node.$(OBJEXT) null_parent.$(OBJEXT) \
-	helper_parent.$(OBJEXT) data_tank.$(OBJEXT) fontset.$(OBJEXT) \
-	array.$(OBJEXT) objModel.$(OBJEXT) model.$(OBJEXT) \
-	material.$(OBJEXT) texture.$(OBJEXT) base_entity.$(OBJEXT) \
-	base_object.$(OBJEXT) ini_parser.$(OBJEXT) list.$(OBJEXT) \
-	vector.$(OBJEXT) matrix.$(OBJEXT) curve.$(OBJEXT) \
-	glmenu_imagescreen.$(OBJEXT)
+	primitive.$(OBJEXT) ai.$(OBJEXT) p_node.$(OBJEXT) \
+	null_parent.$(OBJEXT) helper_parent.$(OBJEXT) \
+	data_tank.$(OBJEXT) fontset.$(OBJEXT) array.$(OBJEXT) \
+	objModel.$(OBJEXT) model.$(OBJEXT) material.$(OBJEXT) \
+	texture.$(OBJEXT) base_entity.$(OBJEXT) base_object.$(OBJEXT) \
+	ini_parser.$(OBJEXT) list.$(OBJEXT) vector.$(OBJEXT) \
+	matrix.$(OBJEXT) curve.$(OBJEXT) glmenu_imagescreen.$(OBJEXT)
 orxonox_OBJECTS = $(am_orxonox_OBJECTS)
 orxonox_LDADD = $(LDADD)
@@ -86,5 +86,5 @@
 @AMDEP_TRUE@	./$(DEPDIR)/objModel.Po ./$(DEPDIR)/orxonox.Po \
 @AMDEP_TRUE@	./$(DEPDIR)/p_node.Po ./$(DEPDIR)/player.Po \
-@AMDEP_TRUE@	./$(DEPDIR)/skysphere.Po \
+@AMDEP_TRUE@	./$(DEPDIR)/primitive.Po ./$(DEPDIR)/skysphere.Po \
 @AMDEP_TRUE@	./$(DEPDIR)/story_entity.Po ./$(DEPDIR)/texture.Po \
 @AMDEP_TRUE@	./$(DEPDIR)/track_manager.Po ./$(DEPDIR)/vector.Po \
@@ -231,4 +231,5 @@
 		 world_entities/environment.cc \
 		 world_entities/skysphere.cc \
+		 world_entities/primitive.cc \
 		 ai/ai.cc \
 		 lib/coord/p_node.cc \
@@ -273,4 +274,5 @@
 		 world_entities/shoot_rocket.h \
 		 world_entities/power_up.h \
+		 world_entities/primitive.h \
 		 ai/ai.h \
 		 network/synchronisable.h \
@@ -392,4 +394,5 @@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/p_node.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/player.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/primitive.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/skysphere.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/story_entity.Po@am__quote@
@@ -527,4 +530,20 @@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o skysphere.obj `if test -f 'world_entities/skysphere.cc'; then $(CYGPATH_W) 'world_entities/skysphere.cc'; else $(CYGPATH_W) '$(srcdir)/world_entities/skysphere.cc'; fi`
+
+primitive.o: world_entities/primitive.cc
+@am__fastdepCXX_TRUE@	if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT primitive.o -MD -MP -MF "$(DEPDIR)/primitive.Tpo" -c -o primitive.o `test -f 'world_entities/primitive.cc' || echo '$(srcdir)/'`world_entities/primitive.cc; \
+@am__fastdepCXX_TRUE@	then mv -f "$(DEPDIR)/primitive.Tpo" "$(DEPDIR)/primitive.Po"; else rm -f "$(DEPDIR)/primitive.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='world_entities/primitive.cc' object='primitive.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	depfile='$(DEPDIR)/primitive.Po' tmpdepfile='$(DEPDIR)/primitive.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o primitive.o `test -f 'world_entities/primitive.cc' || echo '$(srcdir)/'`world_entities/primitive.cc
+
+primitive.obj: world_entities/primitive.cc
+@am__fastdepCXX_TRUE@	if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT primitive.obj -MD -MP -MF "$(DEPDIR)/primitive.Tpo" -c -o primitive.obj `if test -f 'world_entities/primitive.cc'; then $(CYGPATH_W) 'world_entities/primitive.cc'; else $(CYGPATH_W) '$(srcdir)/world_entities/primitive.cc'; fi`; \
+@am__fastdepCXX_TRUE@	then mv -f "$(DEPDIR)/primitive.Tpo" "$(DEPDIR)/primitive.Po"; else rm -f "$(DEPDIR)/primitive.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='world_entities/primitive.cc' object='primitive.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	depfile='$(DEPDIR)/primitive.Po' tmpdepfile='$(DEPDIR)/primitive.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o primitive.obj `if test -f 'world_entities/primitive.cc'; then $(CYGPATH_W) 'world_entities/primitive.cc'; else $(CYGPATH_W) '$(srcdir)/world_entities/primitive.cc'; fi`
 
 ai.o: ai/ai.cc
Index: /orxonox/trunk/src/lib/coord/p_node.cc
===================================================================
--- /orxonox/trunk/src/lib/coord/p_node.cc	(revision 3520)
+++ /orxonox/trunk/src/lib/coord/p_node.cc	(revision 3521)
@@ -22,5 +22,5 @@
 
 #include "p_node.h"
-
+#include "null_parent.h"
 
 using namespace std;
@@ -259,6 +259,4 @@
 {}
 
-
-
 /**
    \brief adds a child and makes this node to a parent
@@ -282,7 +280,14 @@
 void PNode::addChild (PNode* pNode, parentingMode mode)
 {
-  pNode->mode = mode;
-  pNode->parent = this;
-  this->children->add (pNode);
+  if( pNode->parent == NULL )
+    {
+      pNode->mode = mode;
+      pNode->parent = this;
+      this->children->add (pNode);
+    }
+  else
+    {
+      PRINTF(1)("PNode::addChild() - this node has already been added - closed Loop MARK \n");
+    }
 }
 
@@ -295,4 +300,5 @@
 {
   this->children->remove (pNode);
+  pNode->parent = NULL;
 }
 
@@ -302,8 +308,10 @@
    \param parent the Parent to set
 */
+/*
 void PNode::setParent (PNode* parent)
 {
   parent->addChild(this);
 }
+*/
 
 /**
@@ -368,22 +376,21 @@
 		}
 	      else
-		this->absCoordinate = parent->getAbsCoor () + this->relCoordinate;	      /* update the current absCoordinate */
+		this->absCoordinate = parent->getAbsCoor() + this->relCoordinate;	      /* update the current absCoordinate */
 	    }
 	}
       
-      if( this->mode == ROTATION && this->mode == ALL)
+      if( this->mode == ROTATION || this->mode == ALL)
 	{
 	  if( this->bAbsDirChanged /*&& this->timeStamp != DataTank::timeStamp*/)
 	    {
 	      /* if you have set the absolute coordinates this overrides all other changes */
-	      this->relDirection = this->absDirection - parent->getAbsDir ();
+	      this->relDirection = this->absDirection - parent->getAbsDir();
 	    }
 	  else if( this->bRelDirChanged /*&& this->timeStamp != DataTank::timeStamp*/)
 	    {
 	      /* update the current absDirection - remember * means rotation around sth.*/
-	      this->absDirection = parent->getAbsDir () * this->relDirection;
+	      this->absDirection = parent->getAbsDir() * this->relDirection;
 	    }
 	}    
-      // }
   PNode* pn = this->children->enumerate();
   while( pn != NULL) 
@@ -457,2 +464,3 @@
   return this->objectName;
 }
+
Index: /orxonox/trunk/src/lib/coord/p_node.h
===================================================================
--- /orxonox/trunk/src/lib/coord/p_node.h	(revision 3520)
+++ /orxonox/trunk/src/lib/coord/p_node.h	(revision 3521)
@@ -64,5 +64,5 @@
   void addChild (PNode* pNode, parentingMode mode);
   void removeChild (PNode* pNode);
-  void setParent (PNode* parent);
+  //void setParent (PNode* parent);
   void parentCoorChanged ();
   void parentDirChanged ();
@@ -79,4 +79,5 @@
   void debug ();
 
+ protected:
   float timeStamp;         //!< this the timeStamp of when the abs{Coordinat, Direction} has been calculated
   char* objectName;        //!< The name of the Object
Index: /orxonox/trunk/src/story_entities/world.cc
===================================================================
--- /orxonox/trunk/src/story_entities/world.cc	(revision 3520)
+++ /orxonox/trunk/src/story_entities/world.cc	(revision 3521)
@@ -22,4 +22,5 @@
 #include "camera.h"
 #include "environment.h"
+#include "primitive.h"
 #include "p_node.h"
 #include "null_parent.h"
@@ -232,14 +233,19 @@
 	    this->glmis->step();
 
+	    
+	    WorldEntity* env = new Environment();
+	    env->setName ("env");
+	    this->spawn(env);
+	    this->trackManager->setBindSlave(env);
+
 	    Vector* es = new Vector (50, 2, 0);
 	    Quaternion* qs = new Quaternion ();
-	    WorldEntity* env = new Environment();
-	    env->setName ("env");
-	    this->spawn(env, es, qs);
-	   
+	    WorldEntity* pr = new Primitive(PSPHERE);
+	    pr->setName("primitive");
+	    this->spawn(pr, this->localPlayer, es, qs, ROTATION);
+	    
+
 	    /*monitor progress*/
 	    this->glmis->step();
-
-	    trackManager->setBindSlave(env);
 
 	    break;
@@ -896,4 +902,30 @@
 
 
+/**
+   \brief add and spawn a new entity to this world
+   \param entity to be added
+   \param entity to be added to (PNode)
+   \param At what relative  coordinates to add this entity.
+   \param In which relative direction should it look.
+*/
+void World::spawn(WorldEntity* entity, PNode* parentNode, 
+		  Vector* relCoor, Quaternion* relDir, 
+		  parentingMode mode)
+{
+
+  if( parentNode != NULL && entity->parent == NULL)
+    {
+      parentNode->addChild (entity);
+      
+      entity->setRelCoor (relCoor);
+      entity->setRelDir (relDir);
+      
+      this->entities->add (entity);
+      
+      entity->postSpawn ();
+    }
+}
+
+
 
 /**
Index: /orxonox/trunk/src/story_entities/world.h
===================================================================
--- /orxonox/trunk/src/story_entities/world.h	(revision 3520)
+++ /orxonox/trunk/src/story_entities/world.h	(revision 3521)
@@ -9,5 +9,5 @@
 #include "stdincl.h"
 #include "story_entity.h"
-
+#include "p_node.h"
 
 class TrackManager;
@@ -19,4 +19,5 @@
 class Light;
 class FontSet;
+
 
 //! The game world
@@ -51,5 +52,6 @@
   void spawn (WorldEntity* entity);
   void spawn (WorldEntity* entity, Vector* absCoor, Quaternion* absDir);
-
+  void spawn(WorldEntity* entity, PNode* parentNode, Vector* relCoor, Quaternion* relDir, 
+	     parentingMode mode);
 
 
