Meshes

Started by
6 comments, last by wingman20 23 years, 3 months ago
I''m new to directX and have done no previous game programing. i''ve been trying to figure out how to move a mesh for quite a while. if i have a mesh, how can i use a matrix to move that arround inworld space. please give me some code. thanks
Advertisement
im pretty sure that you do your animation with Cinema 4D or whatever program and then you export all the frames into your directX program. Im pretty sure there are functions in directX 8.0 that will load mesh animations in. You dont have to do the rotation math manually
"This is stupid. I can't believe this! Ok, this time, there really IS a bug in the compiler."... 20 mins pass ..."I'M AN IDIOT!!!"
im pretty sure that you do your animation with Cinema 4D or whatever program and then you export all the frames into your directX program. Im pretty sure there are functions in directX 8.0 that will load mesh animations in. You dont have to do the rotation math manually

aDasTRa - that thing about moving pillars around. It would actually be easier than what we are doing now. You are just using words to make it sound like more work than it really is
example:
load up the animation program, move the pillar over again, then save it, then export it, then load up the 3d engine then goto the place where there pillar is, then decide what you want to do
or
move the pillar over, save, export, run. I matter of 20 seconds. You dont have to load up the animation program up again (unless you are running an AMD system that dies when you try to do two things at once because of its sucky one-processor), and you don''t have to close it. Besides, what do you think you do when you are working in a level editor anyways?? Im sorry but that though was complete BS.

I agree with you on the fact that doing all of those visibility tests though. But im sure that there is a way to do get around it. When you use Clip Planes, does it just clip the triangles so it don''t have to draw them or does it make it so that it doesn''t have to do the math aswell?




"This is stupid. I can't believe this! Ok, this time, there really IS a bug in the compiler."... 20 mins pass ..."I'M AN IDIOT!!!"
Psionic, your wrong.
That''s a animated mesh your talking about and yes that is quite simple.

How EVER he''s talking about, Scaling, Rotating, and Moving the X Y Z coordinates of the mesh.
To do this you have you actually change the World Matrix that the mesh is being rendered in. It''s not too hard but it sure is complex.

I''ve got a 3D world which all works fine except I''m using D3DTS_VIEW and to do all that stuff to one of my mesh''s make''s everything "trail" so i''m currently trying to figure that problem out.
What you need is matrix translation and transformation.You set the world view matrix to the transformed matrix before rendering the mesh. If you have directx 8, I suggest you use the direct3dx library functions.

Example:
D3DXMATRIX m_mattrans,m_matrot,m_mat;

// set matrix to completely untransformed position
D3DXMatrixIdentity(&m_mat);

// rotation is in radians
D3DXMatrixRotationYawPitchRoll(&m_matrot,0,0.5,0);
D3DXMatrixTranslation(&m_mattrans,0,0,1); // move in z direction

// multiply original matrix by rot. and trans.
D3DXMatrixMultiply(&m_mat,&m_mattrans,&m_mat);
D3DXMatrixMultiply(&m_mat,&m_matrot,&m_mat);

// set world view
d3dDevice->SetTransform( D3DTS_WORLD, &m_mat );
mesh->render();

thanks for your reply, but if i have two meshes, for example a mesh for a character''s body and one for his/her arm and i only want to move the arm how can i do that?

thanks
In that case have 1 Mesh with 2 Frames in it.

1st frame is just standing still, 2nd frame is whereever you want it. It''s not wise to "animate" body parts by hard code.

To do this use something like 3D Studio Max, or Maya, or Lightwave, or Truespace even.
If you use the CD3DFILE class, there are functions that alow you to handle individual frames. As was said, you probably want to get a pre-animated model exported to the x format, then you run the animation from there.

This topic is closed to new replies.

Advertisement