Jump to content
  • Advertisement
Sign in to follow this  

Enlarging/Expanding a triangle along its normal?

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

If you intended to correct an error in the post then please contact us.

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 this post


Link to post
Share on other sites
Advertisement
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 this post


Link to post
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

Admiral

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!