1 using System.Collections.Generic;
10 [AddComponentMenu(
"TrueSync/Physics/MeshCollider", 0)]
23 vertices = GetVertices();
24 indices = GetIndices();
32 private List<TSVector> vertices;
40 vertices = GetVertices();
45 private List<TriangleVertexIndices> indices;
50 public List<TriangleVertexIndices>
Indices {
53 indices = GetIndices();
63 var meshFilter = GetComponent<MeshFilter>();
64 mesh = meshFilter.sharedMesh;
73 return new TriangleMeshShape(octree);
76 private List<TriangleVertexIndices> GetIndices() {
77 var triangles = mesh.triangles;
78 var result =
new List<TriangleVertexIndices>();
79 for (
int i = 0; i < triangles.Length; i += 3)
80 result.Add(
new TriangleVertexIndices(triangles[i + 2], triangles[i + 1], triangles[i + 0]));
84 private List<TSVector> GetVertices() {
94 Gizmos.DrawWireMesh(mesh);
FP y
The Y component of the vector.
override Shape CreateShape()
Creates a shape based on attached mesh.
Shape Shape
Shape used by a collider.
Collider with a mesh shape.
List< TriangleVertexIndices > Indices
A list of mess related structs.
void Reset()
Gets (if any) the mesh attached to this game object.
FP z
The Z component of the vector.
Abstract collider for 3D shapes.
TSVector lossyScale
Holds an first value of the GameObject's lossy scale.
Mesh Mesh
Mesh attached to the same game object.
override void DrawGizmos()
Draws the specific gizmos of concrete collider (for example "Gizmos.DrawWireCube" for a TSBoxCollider...
FP x
The X component of the vector.
List< TSVector > Vertices
A list of all mesh's vertices.
override Vector3 GetGizmosSize()
Returns the gizmos size.