Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I'm relatively new to DirectX. I'm playing around with a simple game with cannons shooting at each other (think Scorched Earth).

 

I started out loading .X models into Mesh objects and just rendered them. When rotating/elevating the cannon I would simply rotate the entire model, which looks junky.

 

So I figured the best way to do this is with skeletal animation. Though I don't want to 'play' an animation. I just want to rotate the bones to cause the corresponding parts of the mesh to move (rotate). I used 3DCanvas to create a model that works and by rotating the correct frames I get the desired result.

 

When you press the Enter key I create a projectile and send it flying in the direction the cannon is facing. The problem I have now is the projectile is created at the origin of the model, not the end of the barrel. How can I figure out how to position the projectile at the end of the barrel?

 

FYI, I converted the SkinnedMesh sample for the C++ SDK to VB.NET.

 

Thanks

Posted

About the proectile thing: Figure out the distance from the origin to the end of the barrel (use your 3d modelling program and figure it out manually) and translate the world accordingly..

for example:

 

End of barrel: 0,1,0

Center of cannon: 1,0,0

 

You'd translate the world 1 unit upward and one unit left before rendering the projectile. I understand this is a makeshift way, but I think it's probably the only way of doing this (another way would be to use Mesh.Intersect to find the end of the barrel and do what I said above)

My VB.NET Game Programming Tutorial Site (GDI+, Direct3D, Tetris [coming soon], a full RPG.... you name it!)

vbprogramming.8k.com

My Project (Need VB.NET Programmers)

http://workspaces.gotdotnet.com/ResolutionRPG

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...