Comments (4)
Hi,
I see dotted line, and bake setting Default Area - Walkable.
So first NavMeshPlus creates huge box area as walkable, and than carves out unwalkable regions.
I assume that you sprite shape are not complete squares and have some gaps, and those gaps are not carved out.
You can override tile shape by "Use Mesh Prefab", as you do.
Or, if your world is in square tiles, enable "Override by Grid".
Or, better use this scenario https://github.com/h8man/NavMeshPlus/wiki/HOW-TO#baking-a-maze
Also, enable compress bounds, it will increase bake time, but also will delete excessive tiles.
from navmeshplus.
I assume that you sprite shape are not complete squares and have some gaps, and those gas are not carved out.
But does it matter? Because I use ColliderType.Grid, not ColliderType.Sprite.
Oh! I've just managed to fix the problem! See my fix in the code below. This is part of NavMeshBuilder2d.CollectTileSources() method. I don't understand why it fixed the problem. It was just a lucky guess. I wonder what was the issue...
else //default to box
{
var boxsrc = new NavMeshBuildSource();
boxsrc.transform = Matrix4x4.TRS(Vector3.Scale(tilemap.GetCellCenterWorld(vec3int), builder.overrideVector) - tilemap.layoutGrid.cellGap, tilemap.transform.rotation, tilemap.transform.lossyScale) * tilemap.orientationMatrix * tilemap.GetTransformMatrix(vec3int);
boxsrc.shape = NavMeshBuildSourceShape.Box;
// boxsrc.size = size; // problem: NavMesh artefacts =(
boxsrc.size = new Vector3( 1, 1, 0 ); // All good!
boxsrc.area = area;
sources.Add(boxsrc);
}
from navmeshplus.
Hi,
Yes, it does matter if you bake Geometry https://github.com/h8man/NavMeshPlus/wiki/HOW-TO#used-geometry
NavMeshPlus does not tolerate tilemaps "ColliderType".
Unity have public API to get mesh form sprite, or mesh from collider, but not mesh from grid cell, or mesh from sprite physics shape. And we need that mesh.
As for code above, I assume there is a bug. If both "Override Grid" and "Use Mesh Prefab" are used, than "size" is overwritten and does not correspond to grid's cell size.
var size = new Vector3(tilemap.layoutGrid.cellSize.x, tilemap.layoutGrid.cellSize.y, 0);
and
if (builder.useMeshPrefab != null) { ... size = builder.useMeshPrefab.transform.localScale;
from navmeshplus.
var size = new Vector3(tilemap.layoutGrid.cellSize.x, tilemap.layoutGrid.cellSize.y, 0);
Yep, this works! Thanks!
from navmeshplus.
Related Issues (20)
- CalculatePath always return PathInvalid. HOT 4
- Overlapping Walkable on top of Obstacle won't work.. HOT 4
- netcode and navmeshplus HOT 1
- How i can re-bake in the game mode.
- NavMeshCollecSources2d script does not exist HOT 2
- If there is no tile, don't bake that area
- Upgrading to 2022 HOT 5
- NavMeshAgent.SetDestination does not work HOT 3
- Same tilemap can't have two different surfaces HOT 3
- Everytime I load unity scripts missing HOT 1
- Does not work properly with custom cell size HOT 2
- [Bug] NavigationModifierTilemap missing AffectedAgents field HOT 2
- Isometic grid issues doesn't fit HOT 4
- Make the 2D Agent face in the direction of movement? HOT 2
- Enemy not moving after git push and pull in other computer HOT 2
- NavMeshPlus baking walkable area weirdly HOT 5
- CS0618: 'NavMeshVisualizationSettings.showNavigation' is obsolete ? HOT 2
- Problems with not being able to see the baked navmesh HOT 8
- NavMesh Modifier Volume not working HOT 8
- Navmesh Tilemap help wanted HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from navmeshplus.