void Update() { // Udpate inner verts // TODO: Only needs to happen when edge diameter is upated m_InnerVerts = new Vector3[3]; m_InnerVerts = TriMeshTest1.FindInnerVertsForFace(m_Join0.transform.position, m_Join1.transform.position, m_Join2.transform.position, ((m_Join0.Diameter / 2f) + m_TabTolerance) * .001f); m_TriMesh.UpdateTri(m_InnerVerts[0], m_InnerVerts[1], m_InnerVerts[2], m_Thickness * .001f); UpdateMeasurements(); }
void Update() { // needs to take into account the face width but can't be larger than the edge radius //float radius = ((m_BaseJoin.Diameter * .49f) ) - ( (m_BaseJoin.Diameter * .5f ) * Mathf.Sin( ( MeshEdgeSolver.Instance.FaceThickness / m_BaseJoin.Diameter ) * Mathf.PI *.5f ) ); //float radius = ((m_BaseJoin.Diameter * .5f) ) - ( (m_BaseJoin.Diameter * .5f ) * ( MeshEdgeSolver.Instance.FaceThickness / m_BaseJoin.Diameter ) ); //float radius = ( m_BaseJoin.Diameter * .48f ); //transform.position = -m_BaseJoin.transform.position; float desiredRadius = (m_BaseJoin.ArmOuterDiameter / 2f) - (((m_BaseJoin.ArmOuterDiameter / 2f) - (m_BaseJoin.ArmInnerDiameter / 2f)) / 2f); float radius = desiredRadius - (SpacingRadius / desiredRadius); /* * m_InnerVerts = TriMeshTest1.FindInnerVerts * ( * m_BaseJoin.transform.position, // v1 pos * m_ConnctedJoin0.transform.position, // v2 pos * m_ConnctedJoin1.transform.position, // v3 pos * radius * .001f , // radius from the join * m_BaseJoin.Length * .001f // length of the tab * ); */ m_InnerVerts = TriMeshTest1.FindInnerVerts ( m_BaseJoin.transform.position, // v1 pos m_ConnctedJoin0.transform.position, // v2 pos m_ConnctedJoin1.transform.position, // v3 pos radius * .001f, // radius from the join m_Arm12.TotalLength * .001f, // length of the tab m_Arm13.TotalLength * .001f // length of the tab ); Vector3 v0 = m_InnerVerts[0]; Vector3 v1 = m_InnerVerts[1]; Vector3 v2 = m_InnerVerts[2]; // Get the normal of the triangle m_Normal = Vector3.Cross(v1 - v0, v2 - v0).normalized; // calculate the offset based on spacing Vector3 offset = m_Normal * ((SpacingRadius)) * .001f; //m_TabInner.UpdateTri( m_InnerVerts[0] + offset, m_InnerVerts[1] + offset, m_InnerVerts[2] + offset, m_WallThickness ); if (m_TabInner != null) { m_TabInner.UpdateTri(m_InnerVerts[0] + offset, m_InnerVerts[1] + offset, m_InnerVerts[2] + offset, m_WallThickness * .001f); } if (m_TabOuter != null) { m_TabOuter.UpdateTri(m_InnerVerts[0] - offset, m_InnerVerts[1] - offset, m_InnerVerts[2] - offset, m_WallThickness * .001f); } }