title: How to properly use an XMVECTOR member variable
body: <p>I have a simple IRenderable class that has members for position, scaling, and rotation:</p>
  
  <pre><code>XMFLOAT3 _position;
  XMFLOAT3 _scaling;
  XMVECTOR _rotation;
  </code></pre>
  
  <p>I am attempting to set them with the constructor. The first method here gives an access violation 0x00000000 trying to set _rotation (_position and _scaling are both set fine):</p>
  
  <pre><code>IRenderable() : _position(XMFLOAT3(0, 0, 0)), _scaling(XMFLOAT3(1, 1, 1)), _rotation(XMQuaternionIdentity()) { }
  </code></pre>
  
  <p>Making _rotation an XMVECTOR* instead and using _rotation(new XMVECTOR()) in the constructor sets it to an empty XMVECTOR, but then throws an access violation later when trying to set the identity Quaternion:</p>
  
  <pre><code>*_rotation = XMQuaternionIdentity();
  </code></pre>
  
  <p>Using the address of the XMQuaternionIdentity in the constructor works fine when creating the object,</p>
  
  <pre><code>IRenderable() : _position(new XMFLOAT3(0, 0, 0)), _scaling(new XMFLOAT3(1, 1, 1)), _rotation(&amp;XMQuaternionIdentity()) { }
  </code></pre>
  
  <p>but then the quaternion itself contains garbage data by the time it needs to be used to render with. Both _position and _scaling are working fine in all of these situations.</p>
  
  <p>What is the <strong><em>correct</em></strong> way to use XMVECTOR in this situation?</p>