I want to ask you what is the best way to deal with collisions in hack&slash game, I know that collisions must be very accurate. My first idea is to use sphere bounds ( I making hack&slash in 3d), but how to deal with hitting with sword some enemy, do you know some better solution for this type of game ?
|
|
First Simplicity is key. Second Expandability is necessary. What I would do, if I were making a "hack n' slash" is create a simple bounding box technique. Define the height and width of the attack, then check collisions with the box. Keep in mind, that if your character can go inside of other characters you want to include your own collision dimensions in the attack box. Simple, and expandable. |
|||
|
|
|
You could treat your sword as a line segment and continue treating your enemies as spheres. Line segment + sphere intersection would be very cheap and you'd probably gain sufficient accuracy for a hack and slash. Determining the location and orientation of the line segment could be challenging, especially if it needs to correspond with animation. |
|||
|
|
|
I came up with a method for testing collision awhile back. I haven't used it so I don't know how useful it will be but the basic idea is this. if point x is inside triangle ABC (collision) then the area of triangle AxB + BxC + CxA will be approximately equal to the total area of triangle ABC. If point x was outside of triangle ABC then it won't be equal. This same idea could then be applied to 3 dimensional objects just using the formula for volume and testing all points within an object to another object. I'm not sure how CPU intensive it would be but I assume it would be too slow with testing lots of points every frame so I thought of only testing two objects if they were close to eachother. Hopefully you can use this information to come up with something. |
|||
|
|