wil Posted December 6, 2004 Posted December 6, 2004 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 Quote
ThePentiumGuy Posted December 7, 2004 Posted December 7, 2004 Ay.. I can't help you there.. Can I ask you a favor though? If it's OK with you can you post the converted sample for the skinned mesh? I've been looking for it everywhere. Quote 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
ThePentiumGuy Posted December 7, 2004 Posted December 7, 2004 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) Quote 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
wil Posted December 7, 2004 Author Posted December 7, 2004 (edited) No problem. I don't think its 100% complete, but it does work. I'll post it when I get home.Animation.zip Edited December 8, 2004 by wil Quote
ThePentiumGuy Posted December 8, 2004 Posted December 8, 2004 Thank you so much Quote 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
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.