How do I get a `CollisionObjectHandle` when adding to a `CollisionWorld`?

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 CollisionObjectHandles 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.

OK, I see that I can call .handle() on the CollisionObject, so now I have code that compiles. I’m not clear on how the examples seem to work with the object as if it were a handle, though. Is there a conversion I’m missing?

Seems the examples may just be outdated. CollisionWorld::add(...) returns a CollisionObject, not a CollisionObjectHandle. I’ll file a GitHub issue to that effect.

Hi!

Yes, it looks like the examples are outdated. Thank you for opening the issues, and sorry for the inconvenience!