Exemple #1
0
 public void GizmosDrawTransform(GX_Data.Object_0x48.BaseObject obj, Vector3 direction, float directionScale)
 {
     Gizmos.DrawLine(
         obj.transform.position,
         obj.transform.position + obj.transform.rotation * direction * Mathf.Clamp(directionScale * drawSimpleScale, -drawSimpleScaleMax, drawSimpleScaleMax)
         );
 }
Exemple #2
0
        //public static void PrintCollision()
        //{
        //    foreach (GX_Data.Object_0x48.BaseObject obj in gxDataOther.obj)
        //    {
        //        PrintLog.WriteTsvLineEndToBuffer(
        //            obj.sectionA.collision.id.ToString(),
        //            obj.sectionA.collision.dat_Tri_0x04.ToString(),
        //            obj.sectionA.collision.dat_Quad_0x08.ToString(),
        //            obj.sectionA.collision.dat_Tri_0x0C.ToString(),
        //            obj.sectionA.collision.dat_Quad_0x10.ToString(),
        //            obj.sectionA.collision.triCount.ToString(),
        //            obj.sectionA.collision.quadCount.ToString(),
        //            obj.sectionA.collision.triAddress.ToString(),
        //            obj.sectionA.collision.quadAddress.ToString()
        //            );
        //    }

        //    PrintLog.SaveStream(string.Format("Collision_{0}_(1)", ((int)StageManager.currentStage).ToString("000"), StageManager.currentStage));
        //}

        public void TriQuadDisp(GX_Data.Object_0x48.BaseObject obj, TriQuad[] triQuad, Color color)
        {
            Mesh           m      = new Mesh();
            List <Vector3> verts1 = new List <Vector3>();

            //List<Vector3> normals = new List<Vector3>();

            for (int i = 0; i < triQuad.Length; i++)
            {
                Vector3[] verts = triQuad[i].vertices;

                for (int j = 0; j < verts.Length; j++)
                {
                    Debug.DrawLine(
                        verts[j] + obj.transform.position,
                        verts[(j + 1) % triQuad[i].vertices.Length] + obj.transform.position,
                        color
                        );
                }

                // Add vertices to mesh
                if (triQuad[i].vertices.Length == 3)
                {
                    verts1.AddRange(new Vector3[] {
                        triQuad[i].vertices[2],
                        triQuad[i].vertices[1],
                        triQuad[i].vertices[0]
                    });
                }
                else
                {
                    verts1.AddRange(new Vector3[] {
                        triQuad[i].vertices[2],
                        triQuad[i].vertices[1],
                        triQuad[i].vertices[0],
                        triQuad[i].vertices[0],
                        triQuad[i].vertices[3],
                        triQuad[i].vertices[2],
                    });
                }
            }

            m.SetVertices(verts1);
            //m.SetNormals(normals);

            int[] vertConfig = new int[m.vertexCount];
            for (int i = 0; i < m.vertexCount; i++)
            {
                vertConfig[i] = i;
            }
            m.SetTriangles(vertConfig, 0);
            m.RecalculateNormals();

            Gizmos.color = color;
            Gizmos.DrawMesh(m, obj.transform.position);
        }