I have started coding a First Person Shooter,and am trying to implement collsion detection.The engine uses polygons rather than triangles and i need to find how to calculate surface normals for a 4+ sided polygon.I have only seen normal tutorials for triangles.COuld anyone out there help.I must not turn polys into triangles though.
First of all I would say definitely DO turn polygons into triangles at some point. Design your levels and models and whatever with polygons if you''d like but at some point convert those polygons to triangles before rendering.
The problem with finding surface normals for polygons with 4+ sides is that they aren''t necessarily flat. A triangle is always flat, so it only has one surface normal. A surface that isn''t flat has a different normal at every point, so there is no single normal that is correct for the entire polygon.
If your 4+ sided polygons ARE flat, you use the same basic method as you would for triangles. Pick a corner of the polygon, and find vectors from that corner to two adjacent corners. Take the cross product of those two vectors and normalize the result.
Note to math nazis out there: I am fully aware that by definition all polygons are flat, but I''m assuming here he just means a shape defined by 4+ sides.