void OnDrawGizmos() { Vector2 p = DerivedPos; mBaseShape.transformVertices(ref p, DerivedAngle, ref mScale, ref mGlobalShape); DerivedPos = p; VertexPositionColor[] shape = new VertexPositionColor[mPointMasses.Count]; p = DerivedPos; mBaseShape.transformVertices(ref p, DerivedAngle, ref mScale, ref mGlobalShape); DerivedPos = p; for (int i = 0; i < mPointMasses.Count; i++) { shape[i] = new VertexPositionColor(); shape[i].Position = VectorTools.vec3FromVec2(mPointMasses[i].Position); shape[i].Color = Color.red; if (i != 0) { Gizmos.DrawLine(mPointMasses[i - 1].UnRotatedPsition, mPointMasses[i].UnRotatedPsition); } } Gizmos.DrawLine(mPointMasses[mPointMasses.Count - 1].UnRotatedPsition, mPointMasses[0].UnRotatedPsition); }
void OnDrawGizmos() { Vector2 p = DerivedPos; mBaseShape.transformVertices(ref p, DerivedAngle, ref mScale, ref mGlobalShape); DerivedPos = p; VertexPositionColor[] shape = new VertexPositionColor[mPointMasses.Count]; p = DerivedPos; mBaseShape.transformVertices(ref p, DerivedAngle, ref mScale, ref mGlobalShape); DerivedPos = p; List <Vector2> points = new List <Vector2> (); for (int i = 0; i < mPointMasses.Count; i++) { // shape[i] = new VertexPositionColor(); // shape[i].Position = VectorTools.vec3FromVec2(mPointMasses[i].Position); // shape[i].Color = Color.red; Gizmos.color = Color.white; if (i != 0) { // Gizmos.DrawLine(mPointMasses [i - 1].UnRotatedPsition, mPointMasses [i].UnRotatedPsition); } } for (int i = 0; i < mSprings.Count; i++) { Gizmos.color = Color.red; Gizmos.DrawLine(VectorTools.vec3FromVec2(mPointMasses[mSprings[i].pointMassA].UnRotatedPsition), VectorTools.vec3FromVec2(mPointMasses[mSprings[i].pointMassB].UnRotatedPsition)); } // Gizmos.DrawLine(shape[mPointMasses.Count-1].Position,shape[0].Position); }
void OnDrawGizmos() { Vector2 p = DerivedPos; mBaseShape.transformVertices(ref p, DerivedAngle, ref mScale, ref mGlobalShape); DerivedPos = p; VertexPositionColor[] shape = new VertexPositionColor[mPointMasses.Count * 2]; VertexPositionColor[] springs = new VertexPositionColor[mSprings.Count * 2]; p = DerivedPos; mBaseShape.transformVertices(ref p, DerivedAngle, ref mScale, ref mGlobalShape); DerivedPos = p; for (int i = 0; i < mPointMasses.Count; i++) { shape[(i * 2) + 0] = new VertexPositionColor(); shape[(i * 2) + 0].Position = VectorTools.vec3FromVec2(mPointMasses[i].Position); shape[(i * 2) + 0].Color = Color.green; shape[(i * 2) + 1] = new VertexPositionColor(); shape[(i * 2) + 1].Position = VectorTools.vec3FromVec2(mGlobalShape[i]); shape[(i * 2) + 1].Color = Color.red; // if(i != 0) // { // // Gizmos.DrawLine(springs[(i * 2) + 0].Position,springs[(i * 2) + 1].Position); // Gizmos.DrawLine(springs[i].Position,springs[i+1].Position); // Gizmos.DrawLine(springs[i+1].Position,springs[i-1].Position); // } // Gizmos.DrawLine(springs[mSprings.Count-1].Position,springs[0].Position); } for (int i = 0; i < mSprings.Count; i++) { springs[(i * 2) + 0] = new VertexPositionColor(); springs[(i * 2) + 0].Position = VectorTools.vec3FromVec2(mPointMasses[mSprings[i].pointMassA].Position); springs[(i * 2) + 0].Color = Color.gray; springs[(i * 2) + 1] = new VertexPositionColor(); springs[(i * 2) + 1].Position = VectorTools.vec3FromVec2(mPointMasses[mSprings[i].pointMassB].Position); springs[(i * 2) + 1].Color = Color.yellow; Gizmos.color = Color.red; if (i != 0) { // Gizmos.DrawLine(springs[(i * 2) + 0].Position,springs[(i * 2) + 1].Position); Gizmos.DrawLine(springs[i * 2].Position, springs[(i * 2) + 1].Position); // Gizmos.DrawLine(springs[(i*2)+1].Position,springs[i-1].Position); } } Gizmos.DrawLine(springs[mSprings.Count - 1].Position, springs[0].Position); }