Question with Collisions??
Blitz3D Forums/Blitz3D Beginners Area/Question with Collisions??
| ||
Hey guys I had a quick question on collisions. Is there any way to perform polygon to polygon collison checking?? -I am asking because in my game the player and the enemies both have an entityradius of .99. which I kinda need so that they won't beable to go through the level,and the player won't beable to back up to a wall and see through it. - To get to the point I need to perform a melee attack and I need to be really close to the enemy to do so, so how should I handle my collisions in this case?? |
| ||
You can get polygon-polygon collision using a 3rd party collision library, like coldet. However, for the specific situation you describe you don't really want polygon-polygon collision detection. Instead, use hitboxes. That is, assign a collision box to each of the characters' bones. Don't have characters collide with each other directly, but instead have their bones collide with each other. |
| ||
Thanks joe, when you say "hitboxes", you mean assigning my characters entitybox's right?? |
| ||
I am still not sure what you meant by 'hitboxes' can anyone explain them 2 me?? |
| ||
The idea with hitboxes is that you don't test for collisions against the character, you test for collisions with the character's bones. This assumes a skeletal animated model. You use CountChildren/GetChild to loop through all the bones, or use FindChild to locate bones by name, and assign them a handle. You then use that handle to setup collision detection for the bones. I think EntityBox will work, but I'm not sure. It's been a while, and plus I'm at work so I can't check. The main issue is, do the EntityBox's rotate with the bone as it animates? I think so, so that'll work, but if not then you can just create the boxes as 0 alpha meshes. |
| ||
Not sure about EntityBox, but I know that EntityRadius is always vertical (axis is orientated with Global Y axis), so there's a good chance that EntityBox is the same way. |
| ||
So if I use hitboxes, I could theoretically check character models for which bones I shoot as well then, right?? This way I could check for better collisions and distinguish where I hit the enemies, so that I know how much health to take away from the enemy. - Could someone show me a tutorial or explanation on how to create\utilize hitboxes?? |
| ||
I know that EntityRadius is always vertical (axis is orientated with Global Y axis) Spheres have axis?! |
| ||
Gawd love us. |
| ||
Spheres have axis, if they rotate. Look at the Earth with its north and south poles. |
| ||
Remember though that MeshesIntersect is a relatively slow command to use... |
| ||
You wouldn't test the entire "art" mesh with meshesintersect() - a child "arm" specifically for collisions would be, what, three polygons. Zones for other areas could be similarly lite. That way you get custom hitboxes that (i)definitely rotate and (ii)report correctly when the two meshes in question are both in motion. |