// 0x24: Collision triangles // [X1 X1] [Y1 Y1] [Z1 Z1] [X2 X2] [Y2 Y2] [Z2 Z2] [X3 X3] [Y3 Y3] [Z3 Z3] [?? ??] private void decodeCollision24(byte[] data) { uint start = BE.U32(data, 0x24); uint end = BE.U32(data, 0x28); for (uint idx = start; idx < end; idx += 20) { Int16 x1, y1, z1; Int16 x2, y2, z2; Int16 x3, y3, z3; UInt16 t; x1 = BE.I16(data, idx); y1 = BE.I16(data, idx + 2); z1 = BE.I16(data, idx + 4); x2 = BE.I16(data, idx + 6); y2 = BE.I16(data, idx + 8); z2 = BE.I16(data, idx + 10); x3 = BE.I16(data, idx + 12); y3 = BE.I16(data, idx + 14); z3 = BE.I16(data, idx + 16); t = BE.U16(data, idx + 18); Collision24 zone = new Collision24(x1, y1, z1, x2, y2, z2, x3, y3, z3, t); collision24.Add(zone); } }
private Vector3 GetNormal(Collision24 tri) { Vector3 a = new Vector3(tri.x1, tri.y1, tri.z1); Vector3 b = new Vector3(tri.x2, tri.y2, tri.z2); Vector3 c = new Vector3(tri.x3, tri.y3, tri.z3); return GetNormal(a, b, c); }