title: Position 3d objects in xna
body: <p>I'm pretty new to xna development and want to position the Cubes from the <a href="http://creators.xna.com/en-US/sample/primitives3D" rel="nofollow noreferrer">Primitives3D sample</a> by passing a position vector to the constructor .. unfortunatly it does not work .. instead it is just spinning arround..</p>
  
  <p>Thats how i modified the code of the cubeprimitive class:</p>
  
  <pre><code>  public class CubePrimitive : GeometricPrimitive
  {
      public Vector3 position;
  
      /// &lt;summary&gt;
      /// Constructs a new cube primitive, using default settings.
      /// &lt;/summary&gt;
      public CubePrimitive(GraphicsDevice graphicsDevice)
          : this(graphicsDevice, 1, new Vector3(-3,0,0))
      {
      }
  
      /// &lt;summary&gt;
      /// Constructs a new cube primitive, with the specified size.
      /// &lt;/summary&gt;
      public CubePrimitive(GraphicsDevice graphicsDevice, float size, Vector3 posi)
      {
          this.position = posi;
  
          // A cube has six faces, each one pointing in a different direction.
          Vector3[] normals =
          {
              new Vector3(0, 0, 1),
              new Vector3(0, 0, -1),
              new Vector3(1, 0, 0),
              new Vector3(-1, 0, 0),
              new Vector3(0, 1, 0),
              new Vector3(0, -1, 0),
          };
  
          // Create each face in turn.
          foreach (Vector3 normal in normals)
          {
              // Get two vectors perpendicular to the face normal and to each other.
              Vector3 side1 = new Vector3(normal.Y, normal.Z, normal.X);
              Vector3 side2 = Vector3.Cross(normal, side1);
  
              // Six indices (two triangles) per face.
              AddIndex(CurrentVertex + 0);
              AddIndex(CurrentVertex + 1);
              AddIndex(CurrentVertex + 2);
  
              AddIndex(CurrentVertex + 0);
              AddIndex(CurrentVertex + 2);
              AddIndex(CurrentVertex + 3);
  
              // Four vertices per face.
              AddVertex(posi+(normal - side1 - side2) * size / 2, normal);
              AddVertex(posi + (normal - side1 + side2) * size / 2, normal);
              AddVertex(posi + (normal + side1 + side2) * size / 2, normal);
              AddVertex(posi + (normal + side1 - side2) * size / 2, normal);
          }
  
          InitializePrimitive(graphicsDevice);
      }
  }
  </code></pre>
  
  <p>Can you please show me how to modify it correctly? .. thanks in advance :)</p>