How can i translate the code to directxmath code?

// Create a quaternion that rotates about the world up
 Quaternion quatYaw = CreateFromAxisAngle( Vector3(0,1,0), yaw )
 // Transform the camera offset and up by this quaternion
 offset = Transform( offset, quatYaw)

Do i use XMQuaternionRotationAxis for CreateFromAxisAngle? And also, what function do i use for: Transform

I need to use functions from DIRECTXMATH https://docs.microsoft.com/en-us/windows/win32/api/directxmath/


1 Answer 1


Do I use XMQuaternionRotationAxis for CreateFromAxisAngle?


What function do I use for: Transform

You use XMVector3Rotate.

You can find these matches just by comparing the function signatures, or plugging "DirectXMath rotate vector by quaternion" into a search engine (this was on the first page of results)..

  • 1
    \$\begingroup\$ This page on Microsoft Docs has a complete table of D3DXMath to DirectXMath conversions. \$\endgroup\$ Jan 8, 2021 at 9:37

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .