I would like to connect my sphere to a rigid body, how would I do that with rapier?
fn main() {
let position = Point3::new(0.0, 0.0, 0.0);
let sphere = BoundingSphere::new(position, 100.0);
let rigid_body = RigidBodyBuilder::fixed();
// rigid_body.set_object(sphere); <- How would I do this?
}
I suppose the type
BoundingSphereis a parryBoundingSphere?In that case you can't mix and match these with rapier.
How to add rapier collider spheres to RigidBody
I will give an explanation how to add a sphere or multiple spheres to a
RigidBodybelow:You will need your world objects, for example these:
the rigid body that you already have in the question must be inserted into the world:
Then you have to create either one compound shape (which I think is closer to your use case) or multiple colliders. With the first option you get:
or if you want to attach mutiple shapes / spheres:
This would be a full example using rapiers' testbed:
which will result in this:
or that when using multiple spheres: