public override void Decorate() { var centerline = m_Conduit.centerline; var start90_i = m_Conduit.centerlineBendIndices[0].index; var end90_i = m_Conduit.centerlineBendIndices[1].index; var endTakeUp = centerline[end90_i].point + transform.forward * (Engine.conduitDiameterM + m_LineWidth) * 0.5f; var startTakeUp = endTakeUp; startTakeUp.y = centerline[start90_i].point.y; m_TakeUpLine.Draw(startTakeUp, endTakeUp); }
public override void Decorate() { Bend bend = m_Conduit.bend; // Get Roll Angle float rollAngleDeg = (float)bend.GetOutputParameter(EBendParameterName.RollAngleDegrees).value; float riseM = (float)bend.GetInputParameter(EBendParameterName.Rise).value; float rollM = (float)bend.GetInputParameter(EBendParameterName.Roll).value; var centerline = m_Conduit.centerline; var indices = m_Conduit.centerlineBendIndices; if (rollAngleDeg == 0f || indices.Count == 0 || bend.alert != null) { // Disable Lines EnableLines(false); return; } if (!m_LinesEnabled) { EnableLines(true); } // Get Points //Vector3 csFirst = centerline[ indices[0].index ].point; //Vector3 ceSecond = centerline[ indices[3].index ].point; Vector3 cEnd = centerline[centerline.Count - 1].point; Vector3 origin = Vector3.zero; origin.z = cEnd.z; Vector3 riseOrigin = origin; riseOrigin.y -= m_LineWidth * 0.5f; // Generate Circle Sector Mesh //ConduitGenerator.GenerateSector( sectorMesh, riseM, rollAngleDeg, 5f ); m_RiseLine.Draw(riseOrigin, riseOrigin + Vector3.up * riseM); m_RollLine.Draw(origin, origin + Vector3.left * rollM); // Positions //sectorObject.localPosition = origin; m_Conduit.transform.rotation = Quaternion.Euler(0f, 0f, rollAngleDeg); transform.localRotation = Quaternion.Euler(0f, 0f, 360f - rollAngleDeg); // Undo Rotation (since we're child of Conduit) }
public override void Decorate() { var bend = m_Conduit.bend; var centerline = m_Conduit.centerline; var indices = m_Conduit.centerlineBendIndices; var conduitRadius = Engine.conduitDiameterM * 0.5f; var travel = (float)bend.GetOutputParameter(EBendParameterName.Travel).value; var oDiam = (float)bend.GetInputParameter(EBendParameterName.Diameter).value; var oRadius = 0.5f * oDiam; // Set Obstacle Position Vector3 oPos; oPos.x = -k_objstacleLength; oPos.y = oRadius - conduitRadius; oPos.z = centerline[indices[3].index].point.z - oRadius + conduitRadius; m_obstacle.transform.localScale = new Vector3(oDiam, k_objstacleLength, oDiam); m_obstacle.transform.localPosition = oPos; // Set Flag Positions Vector3 startLine1 = centerline[indices[0].index].point; startLine1.y -= Engine.conduitDiameterM; Vector3 startLine2 = centerline[indices[3].index].point; startLine2.z += Engine.conduitDiameterM; Vector3 endLine1 = startLine1; endLine1.z += travel; Vector3 endLine2 = startLine2; endLine2.y -= travel; m_travelLine1.Draw(startLine1, endLine1); m_travelLine2.Draw(startLine2, endLine2); }
public override void Decorate() { Bend bend = m_Conduit.bend; // Get Values var centerline = m_Conduit.centerline; var bendIndices = m_Conduit.centerlineBendIndices; float spacingM = (float)bend.GetInputParameter(EBendParameterName.Spacing).value; float spreadM = (float)bend.GetOutputParameter(EBendParameterName.KickSpread).value; float shiftM = (float)bend.GetOutputParameter(EBendParameterName.Shift).value; float travelM = (float)bend.GetOutputParameter(EBendParameterName.KickTravel).value; float firstMarkM = (float)bend.GetOutputParameter(EBendParameterName.KickFirstMark).value; // Get Start and End Centerline Indices int cs90_i = bendIndices[2].index; int ce90_i = bendIndices[3].index; int csKick_i = bendIndices[0].index; int ceKick_i = bendIndices[1].index; Vector3 cs90 = centerline[cs90_i].point; // Have the Bends Changed? float angleDeg = (float)bend.inputParameters[0].value; // Re-Copy Split Mesh ConduitGenerator.CopyLastConduitPartial(bendKickMesh, 0, ceKick_i); // OPT: We Don't need to Re-Copy the 90 every time, we could just rotate a Clone as needed ConduitGenerator.CopyLastConduitPartial(bend90Mesh, ceKick_i, centerline.Count - 1); // Record Start Position of Kick bend90Adjust = cs90; bend90Forward = centerline[cs90_i].forwardDir; lastAngleDeg = angleDeg; //---------------- // Set Positions //---------------- // Space & Slide Conduit Vector3 conduitOrig = m_Conduit.transform.localPosition; conduitOrig.y = spacingM; m_Conduit.transform.localPosition = conduitOrig; // Slide & Shift Parallel Conduit float partialShift = (spacingM * Mathf.Tan(angleDeg * Mathf.Deg2Rad * 0.5f)); Vector3 parallelOrig = conduitOrig; parallelOrig.y = -spacingM; parallelOrig.z = partialShift; // a 'part' of the total ShiftM transform.localPosition = parallelOrig; // Shift Parallel 90 m_P90Conduit.transform.localPosition = (cs90 - bend90Adjust) + bend90Forward * (shiftM); //---------------- // Draw Lines //---------------- Vector3 startSpread = centerline[ce90_i].point; startSpread.y += Engine.conduitDiameterM * 0.5f; Vector3 endSpread = startSpread + m_Conduit.transform.forward * spreadM; Vector3 startShift = centerline[ceKick_i].point; Vector3 endShift = centerline[ceKick_i].point + shiftM * bend90Forward; Vector3 startTravel = centerline[csKick_i].point; Vector3 startFirstMark = centerline[ceKick_i].point + centerline[ceKick_i].radialDir * m_Conduit.conduitDiameterM; m_SpreadLine.Draw(startSpread, endSpread); m_ShiftLine.Draw(startShift, endShift); m_FirstMarkLine.Draw(startFirstMark, startFirstMark + centerline[ceKick_i].forwardDir * firstMarkM); m_TravelLine.Draw(startTravel, startTravel + centerline[csKick_i].forwardDir * travelM); }