Enlarging/Expanding a triangle along its normal?
Hi!
I'm wondering if anyone has any good way of enlarging a meshs' triangles according to their normals? If I simply add the normal to the vertices I get the face extruded, but the edges doesn't line up...
Then I tried to calculate the center ( vec(A+B+C)/3 ) and a direction vector to each vertice - but this doesn't give correct results either..
A sidenote; This is mainly for collision detections, where I want the player to walk "into" the wall, but rather stop in front of it.
I got basic collision detection up and running - now all I need (I hope) is a way of keeping the players noses intact. :)
/Robert
For the most accurate results, you'll need to add extra faces to link the extruded faces. Basically, each edge generates a quad linking the two extruded edges on either side of the edge, and each vertex generates a polygon linking the generated quads.
This is all overkill to keep a player from running into a wall, though. Why do perfect triangle-based collision, rather than just simulating the player as a cylinder?
This is all overkill to keep a player from running into a wall, though. Why do perfect triangle-based collision, rather than just simulating the player as a cylinder?
First of all, I quote Sneftel's closing remark, for emphasis:
If you still feel you need to inflate the geometry, then you may want to look at the threads listed below. Together, we have essentially solved the two-dimensional case, and andy82 has provided pictures along the way. Adapting the code to work in 3D shouldn't take much more effort.
Part 1
Part 2
Part 3
Admiral
Quote:This is all overkill to keep a player from running into a wall, though. Why do perfect triangle-based collision, rather than just simulating the player as a cylinder?
If you still feel you need to inflate the geometry, then you may want to look at the threads listed below. Together, we have essentially solved the two-dimensional case, and andy82 has provided pictures along the way. Adapting the code to work in 3D shouldn't take much more effort.
Part 1
Part 2
Part 3
Admiral
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement