Hello!
I have created a Unity Navigation and that seems to be working for the most part. The only issue I am having is when I click on parts of the scene, during gameplay, that are not on the Unity Navigation, the Player still tries to go there. In this screenshot, it actually is trying to go to the table chair ( which is off the floor )
All items have been set to Ignore Raycast so I'm not sure what is going on.
What I am trying to accomplish is that I want my player to only move to the the Unity Navigation parts ( the blue parts ) and not the rest of the room. If I have to make a Mesh Collider for this to happen, I can if need be.
Using 1.50g
Thanks!
Comments
This is why NavMeshSegments are available: if you just rely on those, it's easier to get a 1:1 match. But yes: switching to Mesh Collider would solve the problem.
NavMeshTriangulation tri = NavMesh.CalculateTriangulation();
Mesh mesh = new Mesh();
List<Vector3> verts = new List<Vector3>();
for (int i=0; i<tri.vertices.Length; i++) {
verts.Add(tri.vertices[i]);
}
mesh.SetVertices(verts);
mesh.SetIndices(tri.indices, MeshTopology.Triangles, 0);
mesh.RecalculateBounds();
meshCollider.sharedMesh = mesh;
}
}