# Enlarging/Expanding a triangle along its normal?

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

## Recommended Posts

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

##### Share on other sites
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?

##### Share on other sites
Rather than using the face normals, use the vertex normals.

##### Share on other sites
First of all, I quote Sneftel's closing remark, for emphasis:

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

1. 1
Rutin
46
2. 2
3. 3
4. 4
5. 5
JoeJ
19

• 13
• 10
• 12
• 10
• 13
• ### Forum Statistics

• Total Topics
632998
• Total Posts
3009808
• ### Who's Online (See full list)

There are no registered users currently online

×