Sign in to follow this  
dskurth

MOVING MESHES...HELP!!!!!!

Recommended Posts

Hello..or should I say HELP! I am going crazy. I have done Direct Draw games for years. This time, I am doing a Direct3D using Directx 9(windows XP platform) and need to know how to move meshes around the screen. Here is the problem..I said move the meshes, NOT the world coordinate system. I can do the coordinate system just fine, but I need independent control of individual meshes to move, rotate and other handle without distrubing the World system. In this case I have 3 rings, each separate .x files that I read in using D3DXLoadMeshFromX as in the following: D3DXLoadMeshFromX("p1-ring_proto_ring1.x", // load this file D3DXMESH_SYSTEMMEM, // load the mesh into system memory d3ddev, // the Direct3D Device NULL, // we aren't using adjacency &bufRingMaterial[1], // put the materials here NULL, // we aren't using effect instances &numMaterials[1], // the number of materials in this model &MeshData[1].MeshRing); // put the mesh here From here it is a striaght and simple process to retrieve the materials and using the MeshData[1].MeshRing->DrawSubset, the model/mesh is displayed. This process is continued for the remaining 4 rings and again, there is a nice display even with rotation. The problem is the rotation is on a WORLD COORDINATE level and I need to rotate just ONE mesh (one ring) at a time with the mouse. Further it displays at a wrong angle. showing the top portion at about a 30 top surface and I need the rings to look like a rolette wheel facing straight on. Thus I need to change the position, independently AND rotate independently. This is driving me nuts! I have spent 3 days trying and I know I need to get the MATRIX of the mesh relative to the world coordinate, I just do not how in the XXXX to do it. HELP! Desperate Engineer....... under massively tight schedule Any alternative suggestions are warming welcome

Share this post


Link to post
Share on other sites
Just keep seperate transformation matrices for each ring. Build up their translation, rotation, and scale. Then when you go to render each one set the world matrix with each of these matrices you've composed as you render each ring.

Also for the issue of it displaying at the wrong angle, look into setting up your view matrix so that your camera is directed with the proper orientation. There should be some d3dx helper functions for setting up all the matrices.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this