Skip to content

Commit

Permalink
When extruding multiple faces use each face's own normal (#42)
Browse files Browse the repository at this point in the history
* When extruding multiple faces use each face's own normal

* respect snap grid
  • Loading branch information
andybak authored Aug 31, 2024
1 parent b8111e8 commit 5a71ca3
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions Assets/Scripts/tools/ExtrusionOperation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -475,14 +475,8 @@ public static List<ExtrusionSideVertices> BuildExtrusionSides(
Vector3 projectedDelta;
if (extrusionParams.lockToNormal)
{
List<Vector3> coplanar = new List<Vector3>() {
mesh.VertexPositionInModelCoords(face.vertexIds[0]),
mesh.VertexPositionInModelCoords(face.vertexIds[1]),
mesh.VertexPositionInModelCoords(face.vertexIds[2])
};
Vector3 normal = MeshMath.CalculateNormal(coplanar);
projectedDelta =
Vector3.Project(GridUtils.SnapToGrid(extrusionParams.translationModel), normal);
var extrudedPoint = GridUtils.SnapToGrid(extrusionParams.translationModel);
projectedDelta = mesh.rotation * face.normal * extrudedPoint.magnitude;
}
else
{
Expand Down

0 comments on commit 5a71ca3

Please sign in to comment.