Hi, mutantleg! Can you please tell in more detail what "linetest with radius" is? I tried to implement a linetest with floor-related triangles, like in Super Mario 64, but my character keeps failing in the "gaps" between the triangles... (perhaps this is a problem with the precision of floating-point numbers) How do you add radius accounting?
sure, it's rather simple (in concept 😉):
- first you linetest against the plane the triangle is on (any point on the triangle and the triangles normal)
- then you have the point where you hit the plane
- and you need to find the closest point on the triangle to this point
- and then you measure the distance between these two points and if it's below the radius it's a hit
of course it can be done in a more sophisticated way by also doing a linetest for each vertex as if they were spheres etc.
and less sophisticated: just using more than one raycast to check for the floor
what tools are you using btw? would you like example code? 🤔
Thank you very much!
would you like example code?
No, thanks, I understand the algorithm. It's very similar to the "sphere vs. triangle" test (which I've already implemented).
what tools are you using btw?
I'm currently doing some prototyping using Python/PyGame/PyOpenGL (but I'm newbie...).
Btw, why don't you use capsules? They're really popular for collision detection in games now.... 🤔
I just find spheres easier to use for slopes and stairs (and the math is simpler)
for player movement they are perfect
I only got problems with the enemy code because they insist getting inside little holes
- so for first person I found sphere to be better but for third person capsule would be probably better 🤔