I feel like I’m missing something obvious. The docs seem to imply that CollisionWOrld::add(...)
should give me a CollisionObjectHandle
. I want to map Amethyst Entity
instances to CollisionObjectHandle
s so I can sync them with my game, so this is perfect. But it seems like CollisionWorld::add(...)
returns a &mut CollisionObject
instead. And all the update methods expect a CollisionObjectHandle
.
Am I missing some conversion method or trait? I’ve tried:
let handle: CollisionObjectHandle = self.world.add(*transform.isometry(), shape, collision_groups, geometric_query_type, *id); // wrong
// Remove the type specification from above and try again.
let handle: CollisionObjectHandle = handle.into(); // wrong
handle as CollisionObjectHandle; // wrong wrong wrong
What am I missing? Even the example in the user guide calls the return value a handle, then uses it later. I want something I can clone/copy and stash in a HashMap
, then use later to manipulate colliders. How do I get that?
Thanks.