feat: make RigidBody::add_collider private

Colliders must only be added through the `ColliderSet`.
This commit is contained in:
Sébastien Crozet
2024-05-26 18:14:14 +02:00
committed by Sébastien Crozet
parent 5922612ef3
commit d127af7816
2 changed files with 3 additions and 4 deletions

View File

@@ -636,8 +636,7 @@ impl RigidBody {
}
/// Adds a collider to this rigid-body.
// TODO ECS: we keep this public for now just to simply our experiments on bevy_rapier.
pub fn add_collider(
pub(crate) fn add_collider_internal(
&mut self,
co_handle: ColliderHandle,
co_parent: &ColliderParent,

View File

@@ -123,7 +123,7 @@ impl ColliderSet {
self.modified_colliders.push(handle);
let coll = self.colliders.get_mut(handle.0).unwrap();
parent.add_collider(
parent.add_collider_internal(
handle,
coll.parent.as_mut().unwrap(),
&mut coll.pos,
@@ -167,7 +167,7 @@ impl ColliderSet {
};
if let Some(rb) = bodies.get_mut(new_parent_handle) {
rb.add_collider(
rb.add_collider_internal(
handle,
collider.parent.as_ref().unwrap(),
&mut collider.pos,