I would like to get the dot product of two 3D vectors in float. But unfortunately the result is a vector, not a float. I trued to access it's elements using vector4_f32, but I get an error, that it's not a member of __m128
float res = XMVector3Dot(a, b).vector4_f32[0];
The [] operator is not defined on XMVECTOR
You can access individual elements of
XMVECTORby usingXMVectorGetX,XMVectorGetY,XMVectorGetZandXMVectorGetW. But remember, these are more likely expensive operations as DirectXMath uses SIMD instruction set. For more info:1: XMVector3Dot performance
2: Expensive than expected