#landmass

2780 messages ยท Page 3 of 3 (latest)

sleek scarab
#

So I'd say consuming the asset sounds like intended behavior

mellow mirage
#

The AABB case I hadn't thought of. I'll need to think about how to handle that one if/when we get streaming assets

sleek scarab
#

I should write that down though

mellow mirage
#

Yes please!

sleek scarab
mellow mirage
#

Fair haha

sleek scarab
#

Bevy currently only uses the AABB of the non-animated mesh, resulting in dramatic culling issues

#

Greeble's crate just recalculates the AABBs naively AFAIK

#

But I heard we could also calculate the max AABB extent on animation load and use that

#

Bit disappointing, but itโ€™s not been an issue for me in practice ๐Ÿ™‚

#

I suppose it could become an issue on web, but our asset handling is so beyond wasteful on Wasm that itโ€™s not the real issue

#

(Wasm cannot return memory)

sleek scarab
mellow mirage
#

Yeah I'm gonna release it for 0.17

sleek scarab
sand jasper
#

does the ground mesh count as obstacle for the mesh3d_backend?

sleek scarab
#

Also, it needs to be an obstacle, otherwise there would be nothing generated on it ๐Ÿ˜„

sand jasper
#

the agents are never reporting AgentState::ReachedTarget

#

my agents have avian colliders so their transform has a offset on Y from the ground, and my targets are on the very surface of the ground, if that matters

sleek scarab
#

@mellow mirage might that be the good old "put agents at feet" thing?

mellow mirage
#

Yeah that sounds right

mellow mirage
sand jasper
#

how necessary is updating Velocity for that calculation?

mellow mirage
#

Also their local collision avoidance between other agents won't work properly

sand jasper
#

what schedule is best to update Velocity?

#

it gotta be after an avian schedule right?

#

i put a huge value on the ArchipelagoOptions (from agent radius of 2.), it fixed a problem where the agent would report being outside of the navmesh when going up the sides of my test half-pipe, but not the problem of them yo-yoing on top of the target

#

both AgentTarget::Entity and AgentTarget::Point can trigger AgentState::ReachedTarget?

sleek scarab
#

FWIW I personally add the agent as a child of the collider

#

so that the agent is on the ground

#

I then use a custom AgentOf relation to link them

#

See the repo I posted above

sand jasper
#

having the Collider as the child does not work well?

#

because avian already has a ColliderOf to link a Collider to the entity with RigidBody

mellow mirage
#

So it shouldn't need that much tuning?

mellow mirage
sand jasper
#

the target and the agent

#

does the target need to have width? because that is just a point in space basicaly

#

both AgentTarget::Entity and AgentTarget::Point cause the agent to yo-yo on top of the target

sand jasper
#

TargetReachCondition is required for the state to change to ReachedTarget? what is the meaning of None on each of the distances?

sand jasper
#

and put the agent at the feet means exactly what? because i was getting more AgentNotInNavMesh with the feet at about 0.025 off the ground compared to when it is on the center of the agents collider at about 0.75

rotund cloud
sand jasper
#

How is your distance_above and distance_below

sleek scarab
#

In my case, the collider is 1.8 m high and floats 0.1 m above the ground, so I offset the agent by -(1.8 / 2 + 0.1) = -1.0 m from the collider

mellow mirage
sand jasper
#

from radius 0.5

mellow mirage
#

Is that all?

#

Ohhhh

#

This is actually a bug in landmass

#

I am computing the distance as the distance from the agent's position, not the agent's sampled position.

mellow mirage
#

Thanks for spotting this!

mellow mirage
#

0.17 branch is updated with this now @sand jasper, if you'd like to test it out

sand jasper
mellow mirage
sand jasper
#

@mellow mirage @sleek scarab does this mesh make sense?

sleek scarab
#

Mind trying with bevy_rerecast_editor?

#

That makes it simpler to see ๐Ÿ™‚

sand jasper
#

the green is the agent radius, right? this feels more like agent diameter, i.e. it is too small

sleek scarab
#

Or something like that

sand jasper
sleek scarab
#

And add the bevy_remote plugins, I believe theyโ€™re called something like RemotePlugin and HttpsRemotePlugin

sleek scarab
sand jasper
#

how do you move around the editor, right click only rotates the camera

sleek scarab
#

should probably add that info somewhere ๐Ÿ™‚

sand jasper
sleek scarab
#

Looks correct to me

#

if you want it to be more detailed, up the cell size fraction

#

the one used by the pathfinding in the end is the green one ๐Ÿ™‚

sand jasper
sleek scarab
# sand jasper

If you want to exclude the ramp, reduce the walkable climb

sleek scarab
# sand jasper

the one in the middle is excluded because it happens to have a too high slope

sand jasper
#

this is using avian backend

sleek scarab
#

so yeah this all looks correct to me!

sleek scarab
# sand jasper

Also, if you do cargo install bevy_rerecast_editor --git https://github.com/janhohenheim/rerecast you'll get a newer release of the editor

sand jasper
#

but it will use the 0.17 remote endpoints, no?

sleek scarab
#

I might be wrong though

#

But I think a 0.17 editor should be able to talk with a 0.16 app

#

actually, let me try ๐Ÿ˜„

sand jasper
sleek scarab
#

don't use the 0.17 editor for 0.16 projects ๐Ÿ˜„

sleek scarab
#

Yep I need to expose the slope too

#

adding that to the UI is trivial

#

If you want, I can publish a 0.16 release later that includes it

#

The only reason I didn't add all of the params is because I didn't find a way to do it in bevy_ui without a shit ton of boilerplate ;-;

#

lemme know if you want any other knobs in there

sand jasper
#

@sleek scarab kek

thread 'Async Compute Task Pool (2)' panicked at /home/hukasu/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rerecast-0.1.1/src/detail_mesh.rs:294:40:
attempt to subtract with overflow
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Encountered a panic in system `bevy_rerecast_core::generator::poll_tasks`!
Encountered a panic in system `bevy_app::main_schedule::Main::run_main`!
error: Recipe `navmesh` failed on line 303 with exit code 101
sand jasper
#

shouldn't these gizmos be blue to indicate that they are from the polygon mesh?

sleek scarab
sand jasper
#

ah, yes, bevy_landmass::debug::Landmass3dDebugPlugin::default()

sleek scarab
#

if so, blue = polygon, green = detail is my own convention for rerecast. These are the gizmos that landmass uses, and me and Andriy never put any effort into making sure the colors match between landmass and rerecast haha

#

but

#

you can mix the actual rerecast gizmos and landmass gizmos

#

sec

sand jasper
#

ffs, one day i will not click the video x instead of the video player x

sand jasper
#

memory allocation of 396997076744 bytes failed welp

sleek scarab
sand jasper
sleek scarab
#

@sand jasper alright I have some time now

#

you needed the slope angle in the 0.16 ui, right?

#

anything else?

sand jasper
#

small annoyance on the ui, there is no way to clear a cursor from text boxes, so i end up writing values on the text boxes trying to use keys from other applications

sleek scarab
#

I'll see if I can backport it ๐Ÿ™‚

sleek scarab
#

and published

#

try downloading the new version ๐Ÿ™‚

#

sorry that the 0.16 UI looks a bit shit hehe

sleek scarab
#

also added the slope to the 0.17 version

sleek scarab
sleek scarab
sleek scarab
#

but it would be neat if it was the radius hmm

sand jasper
#

Right now it is tied to the agent having a target or not

sleek scarab
#

BTW I forgot how silly the propagation for pointer targets was. I backported the unfocus fix and had to remember that in 0.16 trigger.target() is the current propagation target and trigger.target is the original target

#

๐Ÿซ 

#

In 0.17 it's .entity and .original_event_target()

#

or alternatively .event_target() and .original_event_target()

#

much better

mellow mirage
#

Ah you found that haha sorry

sleek scarab
#

@mellow mirage if I have a landmass agent, does it also need a landmass character in order to do local avoidance?

#

or is it implicitly a character when it's an agent?

#

but it's a bit hard to tell

mellow mirage
sleek scarab
sand jasper
#

is there an utility where i can query which entities are reachable from a point?

mellow mirage
#

In the future, I might add a more robust reachability check which I could then expose. Right now it fails if some node types have infinite cost (making it unusable by agents)

sand jasper
#

i cant compile bevy_landmass due to an error on ord_subset

#
error[E0277]: the size for values of type `L` cannot be known at compilation time
   --> /home/hukasu/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/ord_subset-3.1.1/src/ord_subset_trait.rs:113:51
    |
113 |               impl<$($T:OrdSubset),+> OrdSubset for ($($T,)+) where last_type!($($T,)+): ?Sized {
    |                                                     ^^^^^^^^^ doesn't have a size known at compile-time
...
128 | / tuple_impls! {
129 | |     Tuple1 {
130 | |         (0) -> A
...   |
229 | |         (11) -> L
    | |                 - this type parameter needs to be `Sized`
230 | |     }
231 | | }
    | |_- in this macro invocation
    |
    = note: required for `(A, B, C, D, E, F, G, H, I, J, K, L)` to implement `PartialEq`
note: required by a bound in `ord_subset_trait::OrdSubset`
   --> /home/hukasu/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/ord_subset-3.1.1/src/ord_subset_trait.rs:12:41
    |
 12 | pub trait OrdSubset: PartialOrd<Self> + PartialEq<Self> {
    |                                         ^^^^^^^^^^^^^^^ required by this bound in `OrdSubset`
    = note: this error originates in the macro `tuple_impls` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider removing the `?Sized` bound to make the type parameter `Sized`
    |
113 -             impl<$($T:OrdSubset),+> OrdSubset for ($($T,)+) where last_type!($($T,)+): ?Sized {
113 +             impl<$($T:OrdSubset),+> OrdSubset for ($($T,)+)  {
    |

For more information about this error, try `rustc --explain E0277`.
error: could not compile `ord_subset` (lib) due to 12 previous errors
sleek scarab
sand jasper
#

for posteriority

[patch.crates-io]
ord_subset = { git = "https://github.com/virtualritz/ord_subset", rev = "c6432c67d3dcf684f37db68d711a7fca2813c29b" }
mellow mirage
#

Yeah I completely removed ord_subset haha

sand jasper
#

is there any utility to just give me a position within x radius?

rotund cloud
sand jasper
#

it would be more like a find_path where you don't input a end_point with a maximum distance

rotund cloud
#

huh yeah, I do not think I have seen anything like that.

sand jasper
#

like in skyrim they had something like that, where when a player would get close to a fox, the fox would just query any tile 50 units away from the player

rotund cloud
#

ah I see, I doubt there is anything prebuilt for that, you could use sample point with very low tolerances on the distance to make sure that sampled point is very close to that desired radius to see if a point in the radius is valid.

sleek scarab
#

@mellow mirage about to release rerecast for Bevy 0.17

#

same as the RC, just bumped versions

mellow mirage
#

Awesome, I'll release landmass_rerecast tonight

mellow mirage
sleek scarab
#

thanks!

mellow mirage
#

Thank you!

sand jasper
#

animation link is to mark something like you can jump from this point to this other point?

#

between islands also?

sand jasper
#

how do you make other entities always open way for another? like, this dude will fuck you up if you stay on its way

mellow mirage
sand jasper
#

@sleek scarab which settings should i change when i get invalid contour?

sleek scarab
sand jasper
#

avian backend

sleek scarab
#

just be careful with that knob, it makes generation much more expensive ๐Ÿ™‚

mellow mirage
#

Perhaps rerecast needs an "ignore mesh" component or something?

sleek scarab
#

Additional ignores are the backend's job (at least ATM)

#

the mesh backend has ExcludeMeshFromNavmesh

#

dunno if the avian navmesh does too

mellow mirage
#

Ahhh ok

sleek scarab
#

happy to change it if it's annoying ๐Ÿ™‚

mellow mirage
sleek scarab
#

whoops

mellow mirage
#

Might also be worth it to add that doc to Mesh3dBackend to point more people at it?

blissful dove
#

What is the difference between a character and an agent in bevy_landmass?

mellow mirage
#

So the canonical example is you'd have your player be a character so that you AI agents will avoid them

sleek scarab
#

Published avian_rerecast supporting Avian 0.4 and Bevy 0.17 ๐Ÿ™‚

sleek scarab
#

@mellow mirage I'm working with Steam Audio right now, and they also do pathfinding, but in 3D using a grid of probes.
Interestingly they have two settings for pathfinding that I think may be interesting for landmass:

  • validate paths
  • search alternative paths

The first setting makes it so every connection between two probes during pathfinding is validated by a raycast. The idea is that this will catch dynamic geometry, like a moving obstacle. If the raycast fails, then the pathfinding fails.
The second setting expands on the first setting by not failing, but marking that connection between probes as invalid for the current frame. It then goes on pathfinding an alternative route.

#

The real-world workflow is that you annotate your colliders as Steam Audio meshes, and at bake time only use the "most open scenario", i.e. all movable obstacles are gone. Then at runtime you use the full set of Steam Audio meshes, and the pathfinding will adapt to any new meshes it encounters by navigating around them

#

It's a bit like the Landmass concept of local avoidance

#

But API-wise it works more automatically

#

and I have no clue how they actually handle the new obstacles internally.

#

I know they do A*, and that's where my understanding ends

#

But yeah the key insight here is the concept of "optionally use a raycast to verify every connection formed during pathfinding"

#

Maybe that could be useful?

sand jasper
#

path finding on the Steam Audio lib?

sleek scarab
mellow mirage
#

I don't think that would help much with regular pathfinding. I would guess that audio is much more amenable to approximation, so those alternate paths probably don't "sound" as bad. Whereas if an in agent takes a weird detour it's much easier to see

#

I'm also guessing that those "probes" are probably distributed more uniformly, whereas the navmesh tries to be as sparse as possibly. Validating a navmesh edge with a single raycast may be more punishing that in SteamAudio's case

#

Punishing in terms of path quality

#

Maybe that's wrong though haha

sleek scarab
mellow mirage
#

I'm surprised that's fast enough and doesn't chew up memory? Especially if they're doing raycasts during the search?

sleek scarab
mellow mirage
#

How often does the audio update then? Every 100ms?

sleek scarab
#

Like, you can offset the pathing to pretend it still arrived at your ear after your movement even if youโ€™re not sure it actually did until the next 100 ms timer

#

There is also a direct raycast for occlusion that is run every frame

#

So you donโ€™t hear a "lag" when you go behind cover

#

Since the pathing is meant to convey indirect audio, you donโ€™t notice if it's a bit out of sync

#

The spatial information is out of sync, that is. The audio information itself, so the samples, are updated as fast as possible in their own thread

sleek scarab
#

(In landmass)

mellow mirage
#

Otherwise, we keep the path and only update the straight line path which is very cheap

sleek scarab
mellow mirage
#

No not yet

#

It also would mean the agents would effectively be stuck doing nothing for that 100ms

sleek scarab
mellow mirage
#

Since we don't know where the agent or the target are in relation to the existing path

#

I don't even store where the agent is in their current path

#

I suppose I could...

sleek scarab
#

I'm mentioning it because this is a very common thing people do in 3D games with lots of NPCs

mellow mirage
#

I definitely want to be able to limit how many path finds there are per frame

sleek scarab
#

Great!

#

I'm currently modeling my NPCs so that everything they do is on a timer that is influenced by their distance to the player

#

E.g. their vision cones only update every 500 ms when far from the player, but every 200 ms when near

#

And the one and only thing I currently cannot really model like that is landmass

#

At least not that I know

mellow mirage
#

Yeah haha, it's been on the issues for a while

#

Need to make that happen

sleek scarab
#

I suppose I could only update the agent entity's position every 100 ms. Then thatโ€™s the time frame for all NPCs, but eh

sleek scarab
#

No rush though!

#

I donโ€™t yet have any pathfinding bottlenecks ๐Ÿ˜‰

mellow mirage
mellow mirage
#

Though maybe in your case you'd be ok to turn that off if given the option?

sleek scarab
#

You know what

#

I could have a character entity that follows the player every frame

#

And a separate agent entityโ€™s position every that lags behind on a timer

#

That way local avoidance still works

#

๐Ÿงช

mellow mirage
#

The agent would try to avoid itself though ๐Ÿ™

sleek scarab
#

Donโ€™t we all sometimes

#

Agents donโ€™t know anything about CollisionLayers, right?

mellow mirage
#

They do not

sleek scarab
#

@mellow mirage I'm having some trouble hmm

#

I'm trying to update my namesh

#

rerecast looks correct

#

and the landmass gizmos also look... correct? Not sure

#

another angle

#

the agent state is Idle

#

but it fails to ever sample any point!

#

the sampler gives me OutOfRange every time

#

it's happening since I recreted the navmesh

#

Which kinda puts the blame on rerecast

#

but uuh I don't think I changed anything?

#

hmm I fiddled with the params and generated a new navmesh and that one works?

#

It seems either

  • rerecast is generating something fucked up or
  • landmass is not dealing correctly with some meshes
mellow mirage
#

Do you mean it breaks once you regenerate the mesh?

#

or before hand?

sleek scarab
mellow mirage
#

and that should be hot reloading the nav mesh right?

sleek scarab
#

but it also happens when I restart the game with the new navmesh

mellow mirage
#

And there's no error logs?

sleek scarab
#

nope. Weird, right?

mellow mirage
#

Indeed!

sleek scarab
mellow mirage
#

Yeah hmmm that should mean we have valid stuff

sleek scarab
#

hmm, maybe I should be playing around with the sampling settings?

#

that doesn't do the trick

#

ยฏ_(ใƒ„)_/ยฏ

#

well I have my workaround

#

just a bit curious

sleek scarab
#

@mellow mirage lol the schedule change required touching every test

#

since they need to actually run, y'know

#

but done now ๐Ÿ˜„

#

Mind taking a look at the PR?

mellow mirage
#

I'll take a deeper look tonight, currently at work lol

sleek scarab
mellow mirage
#

From a quick skim it seemed fine!

sleek scarab
#

no pressure

#

also, this should be public in Bevy

#

PRing that rn

mellow mirage
#

Still good to make it pub though

mellow mirage
#

That works even better!

sleek scarab
mellow mirage
#

Hi sorry about that! Had a rough night, taking a look right now!

sleek scarab
mellow mirage
sleek scarab
#

@mellow mirage do you happen to know how expensive sampling a point is?

#

I'm writing some code in a hot loop and considering whether I can afford it

#

It's fine if not, but do you know what kind of ฮผs times I can expect for sampling on bigger navmeshes?

mellow mirage
#

With some extra caching, it could be made faster

#

Like if you pass a previously cached sampled point, we could check the previous island + node first

sleek scarab
mellow mirage
#

Meh I'll stick with my impl. I literally just need it for sorting and all the other features in that lib are completely unnecessary.

Thanks though!

sleek scarab
mellow mirage
#

Indeed!

barren mica
mellow mirage
barren mica
mellow mirage
#

There's an issue to make bevy_landmass automatically complain if your agent moves often without its velocity set

#

Still gotta get around to doing that

barren mica
#

What's the function I would use to calculate the velocity? Sorry but I seem to be too stupid to find it in the docs.

mellow mirage
barren mica
#

I seem to be completely off.

mellow mirage
#

Ah not quite, there's a Velocity component too!

#

The Velocity component tells landmass how the agent actually moves, whereas the AgentDesiredVelocity tells you how landmass says your agent should try to move

barren mica
mellow mirage
#

I just realized the bevy_landmass README doesn't mention this! I need to add that!

#

At least the example needs to include this

barren mica
#

I don't know if my brain is completely fried but:

fn update_position(
    mut query: Query<(&mut Transform, &AgentDesiredVelocity2d, &mut Velocity2d)>,
    time: Res<Time>,
) {
    for (mut transform, agent_vel, mut vel) in query.iter_mut() {
        transform.translation.x += agent_vel.velocity().x * time.delta_secs();
        transform.translation.y += agent_vel.velocity().y * time.delta_secs();
        vel.velocity = agent_vel.velocity();
    }
}

This is what you where talking about, correct? It appears to behave very similarly.

#

In the clip I showed, I assumed that the magenta colored path is what landmass strives for.

mellow mirage
#

That's what I meant yes, but also your position update is slightly wrong. You should multiply the velocity by the delta time

#

Hopefully that'll work haha

mellow mirage
barren mica
mellow mirage
barren mica
#

Just do confirm: The agents look like:

 Agent2dBundle {
            agent: Default::default(),
            settings: AgentSettings {
                radius: AGENT_RADIUS,
                desired_speed: 20.0,
                max_speed: 20.0,
            },
            archipelago_ref: ArchipelagoRef2d::new(archipelago_id),
        },
        AgentTarget2d::Point(POINT_2),

with no Character component (and some more components for rendering and transform).

mellow mirage
#

Hmmm I'm a little dumbfounded!

barren mica
#

And the only system that acts on them is the update_position system from above.

#

Do I need to activate collision avoidance with a secret feature flag or plugin perhaps? xD

mellow mirage
#

Haha you shouldn't need to, in fact there's no way to turn off collision avoidance

mellow mirage
#

But I'm just trying to make it as simple as possible to find the problem lol

barren mica
#

Just in case: I tried to make them both Characters only (no Agent) but that obviously didn't work either ๐Ÿ™‚

mellow mirage
#

(I gtg for now, but I'll take another look later, sorry!)

barren mica
waxen mural
#

Hello, say I have many melee units that target a building, is there a way to make them path so that they don't all end up in the same point but instead surround it ?

Also curious how the navigation should interact with a physics engine like avian. What is needed so that it all works together nicely

barren mica
barren mica
#

I'd also like to know how "determinstic" landmass (bevy_landmass) behaves. Is there anything that would make it behave nondeterministic?

waxen mural
mellow mirage
#

It's quite concerning that it falls apart at low speeds

#

At 50 speed it works reasonably well

#

Also, separating the desired and max speeds seems to help (though I'm not sure why). Normally this is a good idea since it allows agents to speed up to avoid a collision (not just slow down). I tried having a desired_speed of 20 and a max_speed of 100 and it works ok.

mellow mirage
# waxen mural Hello, say I have many melee units that target a building, is there a way to mak...

landmass doesn't currently have a way to surround points. It's something I do want, but I'm not really sure how to go about it. I think most games solve that problem from the outside by just creating a "formation" that agents try to stand in.

As for interacting with the physics engine, you basically just need to pass the physics engine's velocity into landmass and then use the desired velocity of the agent to update the force in some way.

mellow mirage
mellow mirage
#

Maybe I need a minimum distance as well as a time_horizon

waxen mural
#

Hello, might be a dumb question, but in the examples the archipelago is cosntructed based on an agent radius, so how would that work with agents of different radii

mellow mirage
sleek scarab
#

Turns out Source Engine lets you edit a lot of its navmesh stuff not in-editor, but in-game ๐Ÿ‘€

#

e.g. this one-way link to jump from the ledge down was authored in-game through console commands

mellow mirage
sleek scarab
#

I was always considering authoring that in an editor

mellow mirage
#

Indeed haha

sleek scarab
#

but this way you just do a raycast from the camera, boom, there's your point A

mellow mirage
#

I mean the fact that it seems you have to do this in teh game is a little weird

#

They were talking about drawing zones manually lol

#

That I'd expect to do in an editor for sure

sleek scarab
sleek scarab
#

so at least there that's definitely no longer needed

#

(in fact, it just does it for you implicitly when you compile your map)

sleek shale
#

Is there any further documentation on constructing a 3D navmesh? I'm having trouble recreating the examples into my own project.

mellow mirage
#

Please share what you're struggling with though! I wonder if the examples are stale since I messed with the order of the polygons (you may need to flip them)

sleek shale
#

fn landmass_setup(
    mut commands: Commands,
    mut meshes: ResMut<Assets<Mesh>>,
    mut materials: ResMut<Assets<StandardMaterial>>,
    nav_meshes: ResMut<Assets<NavMesh3d>>,
    asset_server: Res<AssetServer>,
) {
    let archipelago = Archipelago3d::new(ArchipelagoOptions::from_agent_radius(0.35));
    let archipelago_entity = commands.spawn(archipelago).id();

    // Spawn the islands.
    let mesh: Handle<Mesh> = asset_server.load("levels/World.glb#Mesh0/Primitive0");
    let nav_mesh = nav_meshes.reserve_handle();
    commands.spawn((
            Island3dBundle {
                archipelago_ref: ArchipelagoRef3d::new(archipelago_entity),
                island: Island,
                nav_mesh: NavMeshHandle(nav_mesh.clone()),
            },
            ConvertMesh { mesh, nav_mesh },
    ));
}

fn convert_mesh(
    converters: Query<(Entity, &ConvertMesh)>,
    meshes: Res<Assets<Mesh>>,
    mut nav_meshes: ResMut<Assets<NavMesh3d>>,
    mut commands: Commands,
) {
    trace!("SYSTEM: convert_mesh");
    for (entity, converter) in converters.iter() {
        trace!("Iterating over converters");
        let Some(mesh) = meshes.get(&converter.mesh) else {
            trace!("Failed to get converter mesh");
            continue;
        };


        if let Ok(nav_mesh) = bevy_mesh_to_landmass_nav_mesh(mesh) {
            if let Ok(valid_nav_mesh) = nav_mesh.validate() {
                nav_meshes
                    .insert(&converter.nav_mesh,
                        NavMesh3d { nav_mesh: Arc::new(valid_nav_mesh) },
                    )
                    .unwrap();
                commands.entity(entity).remove::<ConvertMesh>();
            }
            //let valid_nav_mesh = nav_mesh.validate().unwrap();
        }
        //let nav_mesh = bevy_mesh_to_landmass_nav_mesh(mesh).unwrap();
    }
}
#

Note, this is me trying to recreate parts of the playground example from bevy_landmass with my own file.

#

I seem to be getting errors with the validate() method, but I'm not sure why.

#

I can push my current repo if you want to recreate the error.

#

I'm just trying to get a minimal working system to iterate on.

mellow mirage
sleek shale
#

Not sure, I've been trying to print the error.

#

let me try something; one sec

#

got it

#
Err(ConcavePolygon(0))
mellow mirage
#

Try spawning just the mesh (not the gltf scene) and see if it's oriented correctly

#

Oh also make sure the navmesh only includes the valid walking areas, not the whole level geometry.

sleek shale
#

I should be, since the mesh is spawned in elsewhere. I'm just loading it again here for some reason to get the navmesh.

#

In other words

mellow mirage
#

For example, if you include the bottoms of floors, that's an invalid nav mesh

sleek shale
#

In this context, Mesh0 should just be the floor itself.

#

Would other stuff on top of it be causing it, even though it's not loaded into the navmesh?

mellow mirage
#

You can also try triangulating the navmesh before exporting. That could help?

#

I doubt it though

sleek shale
#

Want the output of bevy_mesh_to_landmass_nav_mesh(mesh)?

mellow mirage
mellow mirage
sleek shale
#

No, because it crashes.

#

Or now, because I took the unwraps out, it doesn't at all

#

Here's what it looks like in Blender though

#

Mesh0 should be the pink ground.

#

Bevy does render the mesh itself though.

mellow mirage
# sleek shale

Yeah so the problem is your mesh is a rectangular prism. Landmass is expecting you only have the top face of that prism - so ONLY the walkable surface, not any other part of the floor

sleek shale
#

That explains that

mellow mirage
#

Yeah haha, it's a pain. But that's what landmass_rerecast is for!

#

It will use bevy_rerecast to build the nav mesh for whatever geometry you give it

sleek shale
#

Oof.

#

I've been holding out on working with rerecast because I couldn't figure it out.

mellow mirage
#

It is definitely a more complex beast with a lot of options haha

#

But I think the defaults were straightforward to setup?

sleek shale
#

I'll poke at it and come back with questions if needed.

#

Quick sanity check question, to make sure i'm doing this right before going forward:

#

Setting up bevy_rerecast simply involves this, correct?:

            .add_plugins(NavmeshPlugins::default())
            .add_plugins(AvianBackendPlugin::default())
mellow mirage
sleek shale
#

Ok, don't want to get far ahead and wonder what I'm doing wrong, lmao

mellow mirage
#

And you need the landmass_recast plugins

sleek shale
#

You mean these?:

            .add_plugins(Landmass3dPlugin::default())
            .add_plugins(Landmass3dDebugPlugin::default())
mellow mirage
#

No, there's a crate called landmass_rerecast

sleek shale
#

oh, yess

#

hold on

#

Ok, think I got it. Now to recreate setup

sleek shale
#

This code from the landmass_rerecast readme:

    // This island's nav mesh will be generated by `bevy_rerecast`!
    commands.spawn(Island3dBundle {
        island: Island,
        archipelago_ref: ArchipelagoRef3d::new(archipelago),
        nav_mesh: NavMeshHandle3d(
            generator.generate(NavmeshSettings { agent_radius: 0.5, ..Default::default() }),
        ),
    });

is giving me this error:

mismatched types
expected struct `NavMeshHandle<ThreeD>`
   found struct `NavMeshHandle3d` (rustc E0308)
mellow mirage
sleek shale
sleek shale
#

Just simply what structs/components should I look more at for creating navigating characters?

mellow mirage
#

ohhh

sleek shale
#

I know there's agent

mellow mirage
#

Basically just Agent

sleek shale
#

Yeah, I see that the adapted example supposedly spawns one in.

#

But I guess because it's not actually a part of any moving entity, it just sits there

#

I dunno; just trying to figure out what I need to provide, vs what's included.

mellow mirage
#

You also need AgentTarget to tell the agent where to go

sleek shale
#

I'll do that for now, but is it possible to handle the movement myself, while relying on the navmesh for, well, navigation?

mellow mirage
sleek shale
#

Ah

#

I understood you backwards there

#

Real quick, should I be using AgentDesiredVelocity, or AgentDesiredVelocity3d?

#

Wait, nvm

#

I think

mellow mirage
#

AgentDesiredVelocity3d is AgentDesiredVelocity with a particular coordinate system, so they should be interchangable!

worn scaffold
#

hey, just a bit confused about the sample_point method- how do i create the inputs for it in the right way? like, for example, how would i pass in the navmesh coords of an agent aspoint?

mellow mirage
#

If you're in 2d, you'll need to do .xy() as well

worn scaffold
#

ahh i see, so no conversions or anything. thanks!

quick spade
#

hi

#

Does someone know how can i make the mesh rotate towards the walking direction ?

#
pub fn move_agent_by_velocity(
    time: Res<Time>,
    mut agent_query: Query<(&mut Transform, &GlobalTransform, &Velocity3d, &Children)>,
) {
    for (mut transform, global_transform, velocity, childs) in agent_query.iter_mut() {
        let local_velocity = global_transform
            .affine()
            .inverse()
            .transform_vector3(velocity.velocity);

        transform.translation += local_velocity * time.delta_secs();

    }
}
#

i wanted to update it there

#

but the agent just rotate indefinetely

#

@mellow mirage is there any bult-in settings for that ?

mellow mirage
mellow mirage
quick spade
#

right

mellow mirage
quick spade
mellow mirage
#

There's no way to get the next target point, but the desired velocity will point in the direction the agent wants to move, which will take into account local collision avoidance.

worn scaffold
#

hello again, is there a best way to get the "walking distance" of an actor from their target?

mellow mirage
worn scaffold
#

right thats what i was thinking, thanks!!

sleek shale
#
ERROR bevy_rerecast_core::generator: Failed to generate navmesh: Invalid contour. This sometimes happens if the contour simplification is too aggressive.

This error is a little vague, what should I be looking/poking at?

mellow mirage
sleek shale
#

There are a handful of options it could be in NavmeshSettings.

mellow mirage
#

This may be more of a question for @sleek scarab

flint axle
#

Hi I am trying to do navigation on rerecast navmesh
i use this to set target of agent:
โจ```rs
let _target = commands.spawn(target(position, &mut meshes, &mut materials)).id();
for mut agent in agents {
*agent = AgentTarget3d::Point(position + Vec3::Y * 0.3);
}

then i print in console and i get this
โจ```
Target: Point(Vec3(-1.2441564, 0.38111955, -0.9764929)) | State Idle
```โฉ
why is agent idle but has target that he didnt reach yet
#

also this is how i spawn player
โจ```rs
pub fn player(
position: Vec3,
meshes: &mut Assets<Mesh>,
materials: &mut Assets<StandardMaterial>,
archipelago: &ArchipelagoRes,
) -> impl Bundle {
let mesh = meshes.add(Capsule3d::new(
AGENT_RADIUS,
AGENT_HEIGTH - 2.0 * AGENT_RADIUS,
));
let material = materials.add(Color::srgb_u8(124, 144, 255));
(
Name::new("Player"),
Player,
Transform::from_translation(position),
Agent3dBundle {
agent: Default::default(),
settings: AgentSettings {
radius: AGENT_RADIUS,
desired_speed: 7.0,
max_speed: 10.0,
},
archipelago_ref: ArchipelagoRef3d::new(archipelago.archipelago3d_ent),
},
AgentTarget3d::None,
children![(
Transform::from_xyz(0.0, AGENT_HEIGTH / 2.0, 0.0),
Mesh3d(mesh),
MeshMaterial3d(material),
Pickable::IGNORE,
)],
)
}

mellow mirage
flint axle
mellow mirage
#

Huh that's still surprising, since then the agent should be reporting that it's not on the nav mesh

#

Strange

flint axle
#

i have a question:
initially i spawn agent with default desired speed
now i want to update this desired speed (example walk, run)
how to do that since AgentDesiredVelocity3d is not changable
do i just leave it and only update Velocity3d, but will it work (The current velocity of the agent/character. This must be set to match whatever speed the agent/character is going.)

mellow mirage
sleek scarab
#

@mellow mirage you got time for a sec?

mellow mirage
#

What's up?

sleek scarab
#

sec

#

pic incoming

#

so I want my dudes to do a random walk

#

and what I do is, I take their feet pos

#

then take a random dir

#

raycast there

#

and where it hits, I pull a little bit back just in case

#

and that's the yellow circle here

#

how this of course doesn't work because it's not quite on the navmesh right

#

so I sample the position

#

but that almost always gives me an error

mellow mirage
sleek scarab
#

thought that should certainly be enough here

mellow mirage
sleek scarab
#

so yeah

mellow mirage
#

Hmmm

sleek scarab
#

oh, 10.0 looks better

#

lemme see

mellow mirage
#

I would not recommend from_agent_radius when sampling

sleek scarab
#

oooh

#

aaaah

#

ooooh

#

you're right

#

yep

#

that explains it

#

thanks heart_lime

simple moss
#

@mellow mirage i am trying to use bevy_landmass on top of bevy_rerecast navmeshes. what is the minimum setup i need to do if all i need is the position sampling from Archipelago3d do i need to spawn IslandBundle and Agents ?

mellow mirage
#

And you need an archipelago of course

simple moss
#

awesome will give it a try

#

if i have a platform that is constantly moving how can i make the pathfinder make use of it when it at a point close enough to adjacent navmesh parts to connect to?

mellow mirage
mellow mirage
simple moss
mellow mirage
simple moss
mellow mirage
simple moss
#

gotcha. ok

vast flicker
#

Looking for a bit more help on how to debug AgentState::NoPath

I'm generating the vertices for the navmesh based on tiles from ldtk, and the Landmass2dDebugPlugin shows everything fine, so I'm unsure why the agent can't path from the top left to bottom right tiles. I'm rendering the agent with a green circle (top left).

let mut vertices: Vec<Vec2> = default();
let mut polygons: Vec<Vec<usize>> = default();

for (tile_coord, tags) in tiles.iter_many(children) {
    if !tags.is_some_and(|tags| tags.tags.iter().any(|t| t == "Pathable")) {
        continue;
    }

    let tile_pos = IVec2::from(*tile_coord) * layer_metadata.grid_size
        + IVec2::new(-layer_metadata.grid_size / 2, layer_metadata.grid_size / 2);

    polygons.push([0, 1, 2, 3].map(|i| i + vertices.len()).to_vec());

    vertices.push((tile_pos + IVec2::new(0, 0) * layer_metadata.grid_size).as_vec2());
    vertices.push((tile_pos + IVec2::new(0, -1) * layer_metadata.grid_size).as_vec2());
    vertices.push((tile_pos + IVec2::new(1, -1) * layer_metadata.grid_size).as_vec2());
    vertices.push((tile_pos + IVec2::new(1, 0) * layer_metadata.grid_size).as_vec2());
}

let nm2d = NavigationMesh2d {
    vertices,
    polygon_type_indices: (0..polygons.len()).map(|_| 0).collect(),
    polygons,
    height_mesh: None,
}
.validate()
.unwrap();
mellow mirage
#

The way you've generated your mesh, each square defines its own 4 vertices, so since none of those vertices are shared, it doesn't think those polygons are connected.

vast flicker
#

ahhh, ok, makes sense thanks

stuck hawk
#

Hi, I can't find a channel for rerecast, so I'll ask here, hope thats fine.
I have a couple of questions:

  • rerecast allows generating a navmesh from any gltf file that gets spawned. Can I also specify a specific gtlf model, and only this should be used for nav mesh generation? Ive exported a mesh as gltf file from https://navmesh.isaacmason.com/ (and edited it in blender, so some areas wont be included in pathfinding)
  • If that's not possible, bevy_mesh_to_landmass_nav_mesh mentions that its implementation is naive, and a better method for generating navigation meshes should be used. Would this also apply to my case, where that mesh is made specifically for pathfinding?
  • rerecast mentions in their README that its possibe to export a navmesh as a .bin file and import it into the game. How can I import the file in the game? Is that something that I need to implement myself?
#

Previously, I've just generated the nav mesh from colliders using avian integration, but now i want to exclude some areas to be not included in navmesh generation, hence why ive switched to gltf model as i can edit that in advance

stuck hawk
#

@sleek scarab
Can i maybe somehow export the nav mesh that avian_rerecast generates as a file thats editable in blender, so i can remove some areas from the nav mesh, and then import that edited file in rerecast?

#

because the nav mesh itself seems to be of much better quality than the one the online version generates

sleek scarab
stuck hawk
#

the online generator found here
https://navmesh.isaacmason.com/
both implementations rely on recast, so they should have both same results? but maybe i misunderstand some things ^^

sleek scarab
sleek scarab
#

Yeah should be the exact same IF the params are the same

#

(I have unit tests to verify that)

stuck hawk
sleek scarab
#

So either you tag the meshes that you want to ignore

#

(I forgot the name of the marker)

#

Or you take a look at how avian_rerecast is implemented

#

Itโ€™s just a 50 line glue

#

You can customize that to do whatever you want ๐Ÿ™‚

stuck hawk
#

okay i see, so there is some kind of name that i could include in my meshes name, so bevy_rerecast will ignore them?

sleek scarab
stuck hawk
#

Ah, even better!

sleek scarab
#

I assume you use bevy_rerecast_editor?

stuck hawk
sleek scarab
#

This is the marker, but itโ€™s in the rc

#

Which uses avian 0.6 rc

stuck hawk
sleek scarab
#

Take a look at it, it should be self-explanatory

#

Alternatively, this component makes the collider not go to the editor at all

stuck hawk
stuck hawk
stuck hawk
sleek scarab
#

0.6.0-rc.1

stuck hawk
#

ahh, nice, your move and slide implementation is included there! maybe ill switch to your implementation, mine is a bit crappy haha

#

but im also very happy that i was able to write my own, so out of proud ill keep mine ^^

sleek scarab
sleek scarab
stuck hawk
#

Ah, I found the error that I had running bevy_rerecast_editor:
2026-02-21T11:09:10.737598Z WARN bevy_ecs::error::handler: Encountered an error in system `bevy_rerecast_editor::get_navmesh_input::poll_remote_navmesh_input`: BRP error: {"code":-32601,"message":"Method `bevy_rerecast/generate_editor_input` not found"}
Which is weird, because that would mean the method that comes from rerecast wasnt added? Also, in README, its mentioned that the remote plugins need to be added, but adding it in bevy 0.18 errors because these plugins already exist, I guess that was changed in bevy 0.18 when you add the bevy_remote feature

#

I get this when I click Load Scene. I also remember trying to debug this, seeing that the method only gets inserted when certain resources exist, etc, i made sure everything was setup correctly, i even had a log for when the method gets added, which i could see, but still, i got that error

sleek scarab
sleek scarab
stuck hawk
stuck hawk
sleek scarab
sleek scarab
stuck hawk
#

okay, i will include it in pr

sleek scarab
sleek scarab
#

@mellow mirage I'm running into an issue where I set an agent's AgentTarget3d to a point, but I always get LandmassAgentDesiredVelocity::velocity of zero

#

the target I set is the result of a successful archipelago.sample_point

#

any idea how I might debug this?

#

I suppose the NPC's agent is maybe not on the navmesh for some reason hmm

#

though it surely looks correct

#

the box on the ground is where the target is

#

I'm also missing the yellow target gizmo that I usually get

mellow mirage
sleek scarab
#

thanks

mellow mirage
#

But I think landmass debug rendering uses blue

#

So I think your island is just not properly registering, or the nav mesh is not being converted properly?

sleek scarab
sleek scarab
#

FYI this is code I'm porting from one crate to another, so it's very possible I'm missing something incredibly simple that I forgot to port

mellow mirage
sleek scarab
sleek scarab
#

do you see anything suspicious?

mellow mirage
#

Nothing other than the comments wants to follow player lol

sleek scarab
mellow mirage
#

You did add the landmass plugins right?

#

Both the regular ones and the rerecast ones?

sleek scarab
mellow mirage
#

It would be cool to be able to ask "does this entity match a query in this system"

#

That feels build-able

sleek scarab
#

aah to see if it's the same entity that i'm setting up?

#

let me maybe take a look at how it looks in-game

#

looks correct to me

mellow mirage
#

Maybe your archipelago doesn't have the right components?

sleek scarab
#

it's just this here

#

I'll be afk for a moment, but I'm really curious what I'm missing

#

oh, simple question: I assume AgentTarget3d::Point is a global value in the end, right?

#

and not relative to the Transform of the agent

sleek scarab
#

that sounds right then

mellow mirage
#

I also will be afk shortly lol

sleek scarab
mellow mirage
#

And all its parents for that matter

sleek scarab
#

it certainly does, but it's possible some of its parents may not

#

then again, that should print a warning in Bevy I believe

#

i.e. Transform requires GlobalTransform, which I believe has a builtin validation observer

#

just checked. Yep, the entire hierarchy has them

#

@mellow mirage I'm a silly silly goose

#

I tweaked some constants and the sample_point function actually returns Err

#

whoops whoops

#

fixed that and now I get AgentNotOnNavMesh

mellow mirage
#

LMAO

#

oh

#

I mean that's a step in the right direction lol

sleek scarab
#

definitely

#

the agent is on the feet

#

is there a knob I can tweak?

#

the AgentSettings::radius maybe

mellow mirage
#

It's set to 0.25, so I think the height is like 0.05 or something smol

sleek scarab
#

I should check the landmass gizmos

#

okay I'm silly

#

I rotated something and forgot to rotate the navmesh too

#

haha

#

now it works

#

thanks for the help heart_lime

robust cosmos
#

Hello, so my question is: How are we handling large open worlds? Is there a built in way to build the nav meshes in chunks and stitch them together?

sleek scarab
#

So rerecast is a 1:1 port of recast, which has exactly that feature as you described

#

I just didnโ€™t port it yet

#

Itโ€™s not difficult or anything, it just never blocked me yet

#

I'll for sure port it eventually unless someone beats me to it, itโ€™s just very low priority given how fast the non-tiled version is proving to be

#

Note; recast calls the chunks "tiles"

robust cosmos
#

Sounds good. It's not urgent for me either, just something I know I'll want to do eventually.

#

Thank you for the answer ๐Ÿ™‚

robust cosmos
#

Okay another question: Is it possible to make it so the debug visualizations for different islands are different colors so I can see where breaks are in complex terrain?

mellow mirage
robust cosmos
#

No, it's for my custom terrain #showcase message Maybe island isn't the best term. Just the disconnected navmesh segments

#

also gotta figure out how do disable generation on oceans. Maybe make them separate meshes?

#

Also, eventually, I'd like to have alternate means of transport like Morrowinds silt-strider service. I'd need a way to work that into navigation but I think I can get that working in my custom graph layer that agents user for distant navigation

sleek scarab
#

Mind opening an issue?

#

Should be easy to implement

robust cosmos
robust cosmos
#

@sleek scarab I switched my pathfinding to landmass and it's working flawlessly. I thought landmass was a crate for, like, big heightmap terrains lol

sleek scarab
#

Please share a video of the agents walking around once you have that!

robust cosmos
#

Ask and ye shall receive @sleek scarab

sleek scarab
#

@mellow mirage if @robust cosmos is fine with it, this would make for an extremely lovely video in the readme

#

thanks for sharing heart_lime

#

again, soooo cool to see rerecast working in action ๐Ÿ™‚

robust cosmos
#

oooh.... I actually generated my own navmesh lol

#

It was easy since I'm already generating the terrain. It's almost instant

mellow mirage
#

@robust cosmos would you be ok with that?

robust cosmos
#

Yeah I don't mind

vast flicker
#

I was looking through the landmass API for building navmeshes, I currently use polyanya. I was wondering if there is an equivalent workflow in landmass? Basically I have a square map, and everything is grid based. So I just carve out squares where needed. Agent radius takes care of adding margin between the carved out obstacles and the walkable area, "smoothing" the corners of everything. Below is the entirety of my navmesh generation logic ๐Ÿ™‚

let mut triangulation =
    polyanya::Triangulation::from_outer_edges(&SQUARE.map(|p| p * config_size));
triangulation.set_agent_radius(agent_radius);

triangulation.add_obstacles(
    obstacles_to_use
        .into_iter()
        .map(|(size, pos)| SQUARE.map(|corner| corner * size + pos)),
);

let mut navmesh: polyanya::Mesh = triangulation.as_navmesh();
mellow mirage
#

Landmass doesn't do that, but rerecast does

#

But I did do something similar for a 2d game I was working on. Just started with a big rectangle and then cut away area using geo

mellow mirage
vast flicker
#

I guess, though I'd have to generate more complex shapes than a square or I'd get hard corners everywhere

vast flicker
vast flicker
#

Interesting, I might try hook that up directly into landmass, I don't think I need complex stuff like recast to figure out a navmesh because I have "perfect information" about it by design

mellow mirage
#

My rough impl I used haha

vast flicker
#

create_full_nav_mesh_polygon is basically exactly what my above code does xD

mellow mirage
#

That was a simple stupid way to make a margin around the colliders

unique bloom
#

Thanks @humble hatch for the guidance on character movement ๐Ÿ˜„ using a navmesh to bound the player simplified the controller implementation a lot, and it works smoothly with this collection of landmass crates which i was gonna need anyway for npcs. Just wanted to show off the nice workflow I was trying to set up where I can edit the level in blender, and immediately preview and save/commit the level's navmesh to the filesystem (and have it then hotload to the level's archipelago directly in game) - all fairly easy to set up with bevy patterns and the crates

vast flicker
#

I'm getting a ConcavePolygon(0) validation error, but I think it's wrong? It's always polygon 0, so I print it but it seems fine

println!("{:?}", nav_mesh.polygons[0]);
for v in &nav_mesh.polygons[0] {
    println!("  {v}: {}", nav_mesh.vertices[*v]);
}
[2, 3, 0, 1]
  2: [10, 0, 10]
  3: [-10, 0, 10]
  0: [-10, 0, -10]
  1: [10, 0, -10]
#

I'm following the logic you linked earlier andriy, using geo to build the navmesh. I'm rendering the GeneratedNavMesh in green here

mellow mirage
#

Iirc the bevy 3d coordinate system should do the flipping for you automatically...

vast flicker
# mellow mirage Hmm yeah I'm not sure why that would be wrong, it looks correct to me. You could...

I called .reverse on all the polygons but it just moved the error further to polygon 5 lol ๐Ÿฅฒ I've mostly copy-pasted from your gist so there might be something I'm doing wrong somewhere
here's the original one

fn navmesh_validation_test() -> Result<(), landmass::ValidationError> {
    use landmass::{NavigationMesh, XYZ};

    let nav_mesh = NavigationMesh::<XYZ> {
        vertices: vec![
            Vec3::new(-10.0, 0.0, -10.0),
            Vec3::new(10.0, 0.0, -10.0),
            Vec3::new(10.0, 0.0, 10.0),
            Vec3::new(-10.0, 0.0, 10.0),
        ],
        polygons: vec![vec![2, 3, 0, 1]],
        polygon_type_indices: vec![0],
        height_mesh: None,
    };

    nav_mesh.validate().map(|_| ()) // ValidationError::ConcavePolygon(0)
}
pearl path
#

does landmass offer a way for agents to not pick the same location to navigate to? My units have collision in my game and are navigating to the same area/colliding with each other haha

mellow mirage
#

I don't know if there's anything we can do here without something like navmesh hole cutting, which is not practical on the landmass side. Maybe rerecast could support that but I don't think it does currently

timid forge
#

when a unit arrives at a destination it checks if itโ€™s neighbours are in contact with it and zeros their velocity and sets them as arrived too
Syncronised stop is disabled if a unit isnโ€™t within a threshold distance to the movement goal, this means that units too far away will push others forwards until they enter within this larger stopping distance. I added this so that units stop in a smaller circular radius around the movement goal, rather than a long thin line of units forming (like a line of ants coming to a stop).

primal lily
#

I'm gonna ask here, because I see no other relevant place:
I want to build navmesh data using bevy_rerecast and then access it (wanna try to create own pathfinding). bevy_rerecast tells that I need: run bevy app and load scene -> load scene into bevy_rerecast_editor using bevy brp -> generate navmesh -> load navmesh in game

I feel like in release game version I don't need all of this bevy -> rerecast editor -> bevy loading complexity, I just want to be able to load predefined navmesh data

Is there any way to just load scene from 3D model into editor?

mellow mirage
#

I was also under the impression it has a loader to just load nav data from a file?

primal lily
#

I believe bevy_rerecast not only load but also provide a way to access navmesh data, otherwise you need to read raw bytes, no?

mellow mirage
mellow mirage
primal lily
mellow mirage
#

That's an @sleek scarab question

mellow mirage
#

which doesn't want to break its file system abstraction

sleek scarab
#

See the examples

#

The editor is just a neat tool to do that for you

sleek scarab
#

Or you regenerate the navmesh every time the player starts the game if the computational cost is not too high for you

#

You never need the editor if you donโ€™t want to

sleek scarab
#

Yeah the only reason that doesnโ€™t work is that I didnโ€™t implement it :p

#

Ideally I want to replace the navmesh editor with jackdaw anyways

#

I think jackdaw can load arbitrary gltfs

sleek scarab
#

@digital harness does loading a gltf, generating a navmesh, then saving a navmesh work atm?

#

I know it should

#

but does it?

primal lily
#

Great thanks for answering!! well, as I understand the workflow is:

  • have bevy_rerecast_editor as optional feature (for plugins / any logic call use #[cfg])
  • run bevy app -> remote access with editor -> bake .nav -> load .nav in next run without nav editor feature

is it clean solution? Just looking for project setup that won't load it with unnecessary dependencies

digital harness
#

But i dont see how it wouldโ€™ve been touched with recent changes - aside from migrating to the Operator API internally

#

Iโ€™m AFK tonight but can have a look in the AM

sleek scarab
#

So the rerecast editor stuff is just one more feature to add to the feature gate pile

sleek scarab
#

You should be able to load your glTF there and export a .nav

digital harness
# primal lily whoa ๐Ÿ˜ฎ

I would also love for you to suggest any improvements to the gltf loading as well, i kinda didnโ€™t have a need to go further with a basic load and display type deal (and some fiddling around child entities that get created in bevy iirc)

primal lily
sleek scarab
#

You can load a glTF in jackdaw AND generate a rerecast navmesh AND export it all in jackdaw ๐Ÿ™‚

#

At least you should be able to, jackdaw is a bit buggy

#

So let us know if thereโ€™s any issues with that

primal lily
#

I currently at the point where I have .nav data (I didn't use jackdaw yet, just create TriMesh from tagged scene entity), in editor it looks fine.

Next step I want to be able to just move player on this navmesh, currently I use WASD to just move player along xz axis. I don't need any pathfinding yet, just move player but now with navmesh data as spatial constraint

I believe for that to be happen player entity should have something like agent data (where it is in terms of navmesh polygons) and sample flat movement along current polygon, polygon crossing, height sampling (using detailed mesh as I understand).

Is there something in landmass or other crates I can just grab and use, or am I need to implement this myself

mellow mirage
primal lily
#

I'm preatty new for navmesh implementation details, so pleas excuse me for asking maybe too much noob question. @mellow mirage also thank you, player is moving on navmesh with just sampling good enough with really rare stacking

I'm trying to start to implement custom algorithm for crowd pathfinding on navmesh.

As I see all polygons in polygon mesh are placed in a way so if polygon A is a neighbor for polygon B then agent can travel straight forward from any point of A to any point of B and vice versa (without touching any other polygon or abscent of surface). But can I be sure this is a rule?

mellow mirage
#

But with only polygons, that is true

primal lily
lime pollen
#

I'm having trouble with pathfinding using landmass. I have a 2d grid with a player and a monster (see picture), and the monster keeps getting stuck against the walls. Its desired velocity vector points in a direction that goes exactly through the corner of the wall, not taking into account the radius I gave the monster :/ Anyone has an idea what the problem might be? I'm also attaching the code for spawning the archipelago and the monster's agent.

mellow mirage
#

You need to shrink your navmesh by the size of the monster

lime pollen
#

Ohh I see. So this won't support having entities of different sizes? Or like, I need a different archipelago for each

mellow mirage
#

Sorta yeah. I'd recommend just picking the biggest size entity you have (within reason) and then using that for navigation.

#

Usually most characters are similar enough in size that picking the biggest to err on the size of caution works fine

mellow mirage
#

Hopefully that makes sense haha

lime pollen
#

it does! thanks a lot! and thank you for the crate :] it was pretty simple to setup and get working

mellow mirage
#

I just wish the quality was better haha. Agents that are stationary cause all sorts of problems that make me really sad about it

#

And a lot of the solutions I've seen seem to be too RTS focused.

lime pollen
#

yeah it's been difficult to find good resources on the subject. I was quite happy when I found that you'd solved most of my problems with landmass ๐Ÿ˜„ sorry to hear it's not as good as you'd wish

mellow mirage