Jump to content
  • Advertisement
Sign in to follow this  

DX panel

This topic is 3992 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

I`m working in VS2005 C#, make DX panel and try to load some .x files exported from 3ds max. It works fine until some point. When I try to load several .x files one after another, it seems like world coordinate system changes it`s origins. When I click on the panel, first .x file (first mesh) draws exactly where I click. But, when I click to draw second mesh somewere on DX panel it draws some points away from my click. Third also, and so on. Can anyone tell me what`s going on, please? here`s the code: camera setup: device.Transform.World = Matrix.Identity; device.Transform.Projection = Matrix.PerspectiveFovLH((float)Math.PI / 4, panel1.Width / panel1.Height, 1.0f, 1000.0f); device.Transform.View = Matrix.LookAtLH(new Vector3(0, 0, 600.0f), new Vector3(0, 0, 0), new Vector3(0, 1, 0)); and then calculate screen to world coordinates: Vector3 tempV3 = v3CurrMeshPos; //value of the v3CurrMeshPos vector is (0,0,0) tempV3.Project(device.Viewport, device.Transform.Projection, device.Transform.View, device.Transform.World); tempV3.X = x; tempV3.Y = y; tempV3.Unproject(device.Viewport, device.Transform.Projection, device.Transform.View, device.Transform.World); then, draw the mesh on the tempV3.X and tempV3.Y coordinates. any suggestion will be helpful

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!