Skip to content

Commit

Permalink
Update cuttin/top direction check
Browse files Browse the repository at this point in the history
  • Loading branch information
FilipAlg committed Jan 22, 2025
1 parent 07f034d commit f5210a0
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions Editor/AGXUnityEditor/Tools/DeformableTerrainShovelTool.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,14 @@ public override void OnSceneViewGUI( SceneView sceneView )
var rayCenter = 0.5f * ( CuttingEdgeLineTool.Line.Center + TopEdgeLineTool.Line.Center );
var rayDir = Vector3.Cross( cuttingDir, cuttingToTop ).normalized;

if ( Vector3.Dot( cuttingDir, TopEdgeLineTool.Line.Direction ) < 0.95f )
var absDot = Mathf.Abs(Vector3.Dot( cuttingDir, TopEdgeLineTool.Line.Direction ));
if ( absDot < 0.95f )
m_edgeIssues.Add( "\u2022 " +
GUI.AddColorTag( "Top", Color.Lerp( Color.yellow, Color.white, 0.35f ) ) +
" and " +
GUI.AddColorTag( "Cutting", Color.Lerp( Color.red, Color.white, 0.35f ) ) +
" edge direction expected to be approximately parallel with dot product > 0.95, currently: " +
GUI.AddColorTag( Vector3.Dot( cuttingDir, TopEdgeLineTool.Line.Direction ).ToString(), Color.red ) );
" edge direction expected to be approximately parallel with (absolute) dot product > 0.95, currently: " +
GUI.AddColorTag( absDot.ToString(), Color.red ) );
if ( !Utils.Raycast.Intersect( new Ray( rayCenter, rayDir ), Shovel.GetComponentsInChildren<MeshFilter>() ).Hit )
m_edgeIssues.Add( "\u2022 " +
GUI.AddColorTag( "Top", Color.Lerp( Color.yellow, Color.white, 0.35f ) ) +
Expand Down

0 comments on commit f5210a0

Please sign in to comment.