andriyDev / landmass

A navigation system for video games written in Rust.
Apache License 2.0
14 stars 1 forks source link

Add support for 2D navigation. #57

Closed andriyDev closed 1 week ago

andriyDev commented 1 week ago

Today we only directly support 3D navigation. This makes using it for 2D cases awkward.

Workaround

For landmass, users just have to manually "swizzle" their coordinates (turning XYZ coordinates into XZY coordinates). There's no real need for a workaround since users already have to manually copy points between landmass and their use case.

For bevy_landmass however, we do the conversion for users. In this case, the workaround is to create a "proxy" entity for each agent, then keep that proxy in sync with your real agent, doing the conversion for its coordinates. This is very sad and unintuitive.

Solution

This isn't a fully formed idea but here goes. We can make everything generic on its "coordinate system". These coordinate systems would just be ways to convert to and from the current coordinate system. Another benefit is to support other conventions (example).

A disadvantage is that now all down stream libraries must also support this, which could be painful. Also all users have to propagate the generic argument everywhere, including nav meshes.