// Start is called before the first frame update. void Start() { myRb = GetComponent <PhysXRigidBody>(); meshstateTracker = FindObjectOfType <MeshstateTracker>(); deformableMeshes = new List <DeformableMesh>(GetComponentsInChildren <DeformableMesh>()); DeformableMesh.Subdivide(deformableMeshes[0].maxEdgeLength, deformableMeshes[0].GetMeshFilter().mesh); vertices = new List <Vector3>(deformableMeshes[0].GetMeshFilter().mesh.vertices); // Group similar vertices. meshGraph = meshstateTracker.GetMyMeshGraph(meshType); originalMesh = Instantiate(deformableMeshes[0].GetMeshFilter().mesh); collisionResolver = Instantiate(collisionResolver); resolverBody = collisionResolver.GetComponent <PhysXBody>(); resolverBody.position = new Vector3(0, 10000, 0); interfaceCar = GetComponent <InterfaceCarDrive4W>(); if (interfaceCar != null) { frWheel = interfaceCar.frontRightW; frWheelVertexGroup = NearestVertexTo(frWheel.transform.position); flWheel = interfaceCar.frontLeftW; flWheelVertexGroup = NearestVertexTo(flWheel.transform.position); rrWheel = interfaceCar.rearRightW; rrWheelVertexGroup = NearestVertexTo(rrWheel.transform.position); rlWheel = interfaceCar.rearLeftW; rlWheelVertexGroup = NearestVertexTo(rlWheel.transform.position); } teamId = GetComponent <NetworkPlayerVehicle>().teamId; }
void LateStart() { // Split each mesh ready for deformations. DeformableMesh.Subdivide(maxEdgeLength, interceptorMeshFilter); interceptorMeshGraph = new MeshGraph(interceptorMeshFilter, groupRadius); System.GC.Collect(); Debug.Log("IanMeshDone"); //DeformableMesh.Subdivide(maxEdgeLength, aceMeshFilter); aceMeshGraph = new MeshGraph(aceMeshFilter, groupRadius); System.GC.Collect(); Debug.Log("AceMeshDone"); DeformableMesh.Subdivide(maxEdgeLength, bomberMeshFilter); bomberMeshGraph = new MeshGraph(bomberMeshFilter, groupRadius); System.GC.Collect(); Debug.Log("BomberMeshDone"); //DeformableMesh.Subdivide(maxEdgeLength, bikeMeshFilter); //bikeMeshGraph = new MeshGraph(bikeMeshFilter, groupRadius); //System.GC.Collect(); //Debug.Log("BikeMeshDone"); Debug.Log("Loading Main Menu..."); SceneManager.LoadScene("MainMenu"); //StartCoroutine(nameof(LoadMeshes)); }