andriyDev / landmass

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

Add support for different coordinate systems. #42

Open andriyDev opened 1 week ago

andriyDev commented 1 week ago

Currently, we assume that X is right, Z is forward, and Y is up. This is fine for 3D games for example. However, for 2D games (and more), this is inconvenient. Generally for 2D, X is right, Y is "forward", and Z isn't present.

We should add some way to specify the coordinate system and have this silently be handled for users.

A workaround today is to create "proxy agents" for which you do the coordinate conversion manually (i.e., for a 2D character, you turn (x, y) into (x, 0, y)). This is cumbersome and unintuitive at best.

andriyDev commented 1 week ago

My high level idea is to make most things generic on a type that implements trait CoordinateSystem, where CoordinateSystem does the conversion from the coordinate system to the current (x, y, z) system. I need to play around with this though. For example, should an associated type be Transform? Unclear!