Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Polyanya can't load mesh files it writes #42

Open
MJohnson459 opened this issue Jan 15, 2024 · 0 comments
Open

Polyanya can't load mesh files it writes #42

MJohnson459 opened this issue Jan 15, 2024 · 0 comments

Comments

@MJohnson459
Copy link
Contributor

MJohnson459 commented Jan 15, 2024

When creating a mesh file using PolyanyaFile it creates the file mostly to spec but doesn't include the polygon neighbours as defined here.

Using the same example, instead of the expected

mesh
2
4 2
0.0 0.0 2 0 -1
1.5 0.0 3 0 1 -1
1.5 1.5 2 1 -1
0.0 1.5 3 -1 1 0
3 0 1 3 -1 -1 1
3 1 2 3 0 -1 -1

it writes

mesh
2
4 2
0.0 0.0 2 0 -1
1.5 0.0 3 0 1 -1
1.5 1.5 2 1 -1
0.0 1.5 3 -1 1 0
3 0 1 3
3 1 2 3

Loading this file then fails this assert

assert!(data.len() == nb * 2);

While removing this assert does allow the file to be loaded, the one-way flag is wrong as it defaults to true when there are no neighbours.

I saved the file with this code:

        let mut mesh = PolyanyaMesh::new(vertices, polygons);
        let file: PolyanyaFile = mesh.clone().into();
        file.to_file(&"nav_mesh.mesh");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant