Skip to content

Commit

Permalink
Added region, fixed gizmos and warning
Browse files Browse the repository at this point in the history
  • Loading branch information
Macoron committed Oct 21, 2019
1 parent 4393128 commit b828afd
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions Assets/Unity Simple Liquid/Scripts/SplitController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -130,16 +130,16 @@ private void OnDrawGizmosSelected()
GizmosHelper.DrawPlaneGizmos(bottleneckPlane, transform);

// And bottleneck position
GizmosHelper.DrawSphereOnPlane(bottleneckPlane, BottleneckRadiusWorld, transform);

///

GizmosHelper.DrawSphereOnPlane(bottleneckPlane, BottleneckRadiusWorld, transform);
}
void OnDrawGizmos()
private void OnDrawGizmos()
{
// Draw a yellow sphere at the transform's position
Gizmos.color = Color.yellow;
Gizmos.DrawSphere(raycasthit, 0.01f);
if (raycasthit != Vector3.zero)
{
Gizmos.color = Color.yellow;
Gizmos.DrawSphere(raycasthit, 0.01f);
}
}
#endregion

Expand Down Expand Up @@ -326,11 +326,12 @@ private RaycastHit FindLiquidContainer(Vector3 splitPos, GameObject ignoreCollis
return new RaycastHit();
}

#endregion
#endregion

private Vector3 GetSlopeDirection(Vector3 up, Vector3 normal)
#region Slope Logic
private Vector3 GetSlopeDirection(Vector3 up, Vector3 normal)
{
https://forum.unity.com/threads/making-a-player-slide-down-a-slope.469988/#post-3062204
//https://forum.unity.com/threads/making-a-player-slide-down-a-slope.469988/#post-3062204
return Vector3.Cross(Vector3.Cross(up, normal), normal);
}

Expand Down Expand Up @@ -361,16 +362,16 @@ private Vector3 TryGetSlopeEdge(Vector3 slope, RaycastHit hit)
}
return edgePosition;
}
#endregion

private void Update()
private void Update()
{
// Update bottleneck and surface from last update
bottleneckPlane = GenerateBottleneckPlane();
BottleneckPos = GenerateBottleneckPos();
surfacePlane = liquidContainer.GenerateSurfacePlane();
BottleneckRadiusWorld = bottleneckRadius * transform.lossyScale.magnitude;


// Now check spliting, starting from the top
currentDrop = 0;
CheckSpliting();
Expand Down

0 comments on commit b828afd

Please sign in to comment.