Phattalapol Posted January 5, 2010 Share Posted January 5, 2010 If I want to create enemy,which I can shot him in the head then him die.How can I do this? please give me some code example. Quote Link to comment Share on other sites More sharing options...
Canardia Posted January 5, 2010 Share Posted January 5, 2010 It would be too much code to paste here, but the principle is that you check what was the name of the mesh which was hit with EntityPick(). Quote ■ Ryzen 9 ■ RX 6800M ■ 16GB ■ XF8 ■ Windows 11 ■ ■ Ultra ■ LE 2.5 ■ 3DWS 5.6 ■ Reaper ■ C/C++ ■ C# ■ Fortran 2008 ■ Story ■ ■ Homepage: https://canardia.com ■ Link to comment Share on other sites More sharing options...
Davaris Posted January 5, 2010 Share Posted January 5, 2010 So would the head have to be a separate mesh? Or perhaps you can store a table of polygon ids. Quote Win 7 Pro 64 bit AMD Phenom II X3 720 2.8GHz GeForce 9800 GTX/9800 GTX+ 4 GB RAM Link to comment Share on other sites More sharing options...
Chris Paulson Posted January 5, 2010 Share Posted January 5, 2010 I've thought about this for my own stuff and this is what I'd do:- Got message i've been hit by bullet Message contains location of bullet hit For each bone in my model work out with math fiddle closest bone in model to hit location next if bone is head then HEAD SHOT! endif Hopefully in a month or two I'll have a working example in C++. However it seems to me you prehaps deciding what colour to paint your hand built car before you've even tightened the first nut or done your first weld.... I'd try to get the basics done first. Quote Link to comment Share on other sites More sharing options...
Niosop Posted January 5, 2010 Share Posted January 5, 2010 For a headshot in particular you might just want to look at LOCAL Y position of the hit and decide it's a headshot if it's over a certain value (which might change depending on if they're in a crouched state or an upright state, etc). This would be faster than iterating over the bones and doing distance calculations. But if you want per body part detection to blow off arms and such then Chris's implementation is a lot more robust and could handle that. Quote Windows 7 x64 - Q6700 @ 2.66GHz - 4GB RAM - 8800 GTX ZBrush - Blender Link to comment Share on other sites More sharing options...
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.
Note: Your post will require moderator approval before it will be visible.