public Leaf(SpaceColonizationScriptableObject SCData) { this.SCData = SCData; //find point within mesh if (SCData.isConvexMesh) { this.position = (SelectRandomMeshPoints.GetRandomPointInsideConvex(SCData.leafRefShapeMesh) * SCData.leafRefSpawnSize) + SCData.leafRefOffset; } else { this.position = (SelectRandomMeshPoints.GetRandomPointInsideNonConvex(SCData.leafRefShapeMesh, SCData.leafRefOffset) * SCData.leafRefSpawnSize); } }
// Start is called before the first frame update void Start() { mesh = GetComponent <MeshFilter>().mesh; pts[0] = transform.position + SelectRandomMeshPoints.GetRandomPointOnSurface(mesh); }