Jump to content
  • Advertisement
Sign in to follow this  
luzarius

What information do you need to calculate a collision between two entities?

This topic is 4171 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Joe swings his sword attemping to hit Bob. What math do you need from each player to calculate a collision? Here is what I think, and you can probably correct me. 1) The bounding box min,max of joe's body (A rectangle) 2) The bounding box min,max of joe's sword (A rectangle) 3) The bounding box min,max of bob's body (A rectangle) Somehow I need to calculate joe's maximum reach & arc of his sword swing. Now depending on each players position I should be able to detect if a collision will occur yes?

Share this post


Link to post
Share on other sites
Advertisement
To do it properly you need to do collision detection between the sword and bob, using a collision mesh matching bob. I think you need more than a cylinder - a person in combat is not especially cylindrical, so e.g. joe's sword will swing through bob's outstretched sword arm without it registering. So you model bob and the sword using polygons and use one of a number collision systems.

Or you do what any number of games have done and just give each weapon a 'reach' value and say that when joe and bob are within this distance the weapon hits, subject to weapon skill and shielding modifiers etc.. Many games don't even bother with this, giving all weapons the same reach, unless they are ranged.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!