Jump to content
• Advertisement

# XNA to D3D9

This topic is 2788 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

## Recommended Posts

Hi! I moved to D3D9 because the limitations of C# and XNA, so far so good.

But now I hit to wall. I don't know how to make this in Cplusplus using D3D9 libraries.

[SOURCE] public Vector3 Direction        {            get { return worldMatrix.Forward; } // Looking forward how to get this with D3D9 libraries            set             {                Vector3 position = worldMatrix.Translation; // Looking forward how to get this too                Vector3 forward = value;                 if (forward == Vector3.Up || forward == Vector3.Down)                {                    Vector3 right = Vector3.Right;                    Vector3.Cross(ref right, ref forward, out up); //D3DXVec3Cross                }                //And for this too               Matrix.CreateWorld(ref position, ref forward, ref up, out worldMatrix);            }       }[/SOURCE]
[/source]

#### Share this post

##### Share on other sites
Advertisement
Your typical row-major transformation matrix is laid out like this:
X = local X-axisY = local Y-axisZ = local Z-axisT = translation[Xx] [Xy] [Xz] [0][Yx] [Yy] [Yz] [0][Zx] [Zy] [Zz] [0][Tx] [Ty] [Tz] [1]

So for "Forward" you just want the local Z-axis, which is in the _31, _32, and _33 elements of a D3DXMATRIX. For Translation you want the 4th row.

#### Share this post

##### Share on other sites

• Advertisement
• Advertisement

• ### Popular Contributors

1. 1
Rutin
25
2. 2
3. 3
4. 4
JoeJ
17
5. 5
• Advertisement

• 14
• 11
• 9
• 9
• 10
• ### Forum Statistics

• Total Topics
631754
• Total Posts
3002105
×

## Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!