Fix winding issue

This commit is contained in:
James Lambert 2022-12-24 12:10:03 -07:00
parent 13810c40d6
commit 84bff8a669
2 changed files with 8 additions and 2 deletions

View file

@ -163,10 +163,16 @@ local function create_collision_quad(mesh, thickness)
normal_sum = normal_sum + normal
end
local final_normal = normal_sum:normalized()
-- make sure the basis is right handed
if edge_a_point:cross(edge_b_point):dot(final_normal) < 0 then
edge_a_point, edge_b_point = edge_b_point, edge_a_point
end
local edge_a_normalized = edge_a_point:normalized()
local edge_b_normalized = edge_b_point:normalized()
local final_normal = normal_sum:normalized()
return {
corner = corner_point,

View file

@ -50,7 +50,7 @@ for _, decor_entry in pairs(sk_scene.nodes_for_type('@decor')) do
position,
rotation,
room_index,
'DECOR_TYPE_' .. decor_entry.arguments[1],
sk_definition_writer.raw('DECOR_TYPE_' .. decor_entry.arguments[1]),
})
end