Comments (8)
Hi,
So NavMeshSurface2d bakes navmesh, after that, its 'native' for unity. So lets look what surface do we get. The Z offset is kind of strange, what version of unity you are using? Rotate your scene and check is it flat against grid?
On demo scene I see some bubble, maybe I have some defect in matrix transformation
Also, check your offset. Agent sits flat on navmesh, but Z is 0.5, because of offset
Please look as this issue #20
Also, you can ask questions on Navigation part of unity forum.
from navmeshplus.
Unity version - 2019.3.0f6
Rotate your scene and check is it flat against grid? - Not sure if that's what you mean but I used camera to just check if things are flat when looking at the from the side in 3D scene view, they are
Base Offest - was indeed set to 0.6875, no idea why, setting it to 0 doesn't help
"Giving the velocity.x a tiny value (0.0001f,Y,0) 'fixes' this - the agent will then move as expected." - I guess I can use this hack, but given my lack of experience I am not really able to distinquish if the other navigation related issues I am having are related to this or no.
Also, you can ask questions on Navigation part of unity forum. - it's quite hard to tell when the forum should be used vs the issues here, in general I think GitHub issues are much better UI, search and can be tied more closely to an actual piece of code that might be in question (as it's now). Any advice on that? I am quite new to the ecosystem.
from navmeshplus.
Hi,
If navmesh is okay, and only thing that doesn't work is agent movement with keys - its better to ask question of forum, as I don't have Agent 2d wrapper for you.
Post new thread in https://forum.unity.com/forums/navigation.79/ with code snippet of how do you move agent.
from navmeshplus.
I have a player gameobject placed on a navmesh with NavMeshSurface2d rotated -90 on X just like the WIKI says. When the "game" starts the z of the transform holding the player gameobject is set to --0.7708252. The runtime navmesh generation works, colliding works, agent.SetDestination works. Manual movement (keyboard arrows) don't work, the player object get's stuck from time to time when moving up or down, probably to the Z missmatch. As a workaround I have code in the update to set the Z to 0 whenever it's not (the value is getting set to the -0.7708252 constantly actually), but that results in some other issues and just feels bad.
Using NavMeshSurface doesn't generate the issue, but of course doesn't work for the 2d case anyway so quite hard to say if it's really NavMeshSurface2d but I have been randomly disabling components and that's my best bet now.
Let me know if you can help and if I can provide any more clues here. Cheers
I know this was a while ago but did you end up finding a solution to this problem? I am having the exact same issue and have yet to find a solution to the Z axis being thrown off of 0.0f.
from navmeshplus.
@WoodlandDevelopment To set your Agent flat to the surface you can use Agent offset, but anyway you will have drift 0.0001f.
The workaround is to disable position update and move gameobject by script
The nextPosition is coupled to Transform.position. In the default case the navmesh agent's Transform position will match the internal simulation position at the time the script Update function is called. This coupling can be turned on and off by setting updatePosition.
from navmeshplus.
Hi @h8man, thanks for making this package, super handy and easy to use.
I tried disabling updatePosition, but found that essentially broke collisions and let me travel through anything, not sure if this is unavoidable due to the coupling, or am I missing a step?
Using the drift solution I had some small problems with stuttering (maybe due to float precision/rounding to zero?) but I added some dithering on the horizontal velocity so object tends back to Y axis, which let me user a more aggressive horizontal vel and eliminated the stuttering+drift.
Vector2 dither = Vector2.right * 0.001f * (Random.Range(0,1) >= 0.5f ? 1 : -1);
_myNavAgent.velocity = _movementInput.ReadValue<Vector2>() * _playerSpeed + dither;
from navmeshplus.
@jcpickett1 Thanks for feedback.
As I mentioned few times, I don't use Agent so I didn't get deep into it. But it seems Agent.NextPosition is simulated position and should include navmesh and obstacle avoidance. It is mentioned in manual
https://docs.unity3d.com/ScriptReference/AI.NavMeshAgent-nextPosition.html
from navmeshplus.
Whenever I hit play, my agent gets sent to the other side of the 2d plane. No matter the offset, its the same distance on the other side
from navmeshplus.
Related Issues (20)
- Does this work with Prefabs? HOT 2
- 2D NavMeshAgent gets stuck trying to move straight up or down HOT 2
- 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
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.