amethyst / amethyst/legion

Linking legion entities with rapier2d colliders.

Offen
#297 0 Kommentare 2 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Rust
Sterne
1.7k
Forks
140
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

Hello,

I'm trying to combine legion with rapier2d for physics calculation and 2d . So if I make a query in rapier2d and get a certain rigid body or collider I want to be able to get the legion entity.

For this reason rapier2d provides a u128 userdata linked to each collider, however, the internal legion entity id (NonZeroU64) is private and can therefore not be used.

Would it be possible to provide a way to get the internal entity id and create a new entity using a known id, like:

```
collider.set_userdata(entity.get_id());
...
let entity = World::get_entity(collider.get_userdata() as NonZeroU64).unwrap();
```

Or do you even know of a a better solution? The only possible alternative that comes to my mind is building a separate u128 id and mapping it to legions entities. However, this is a lot of boilerplate and effectively managing ids on ids...

Thanks in advance and thanks for this incredible ECS!

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.