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. /// Adds a collider to this rigid-body.
// TODO ECS: we keep this public for now just to simply our experiments on bevy_rapier. pub(crate) fn add_collider_internal(
pub fn add_collider(
&mut self, &mut self,
co_handle: ColliderHandle, co_handle: ColliderHandle,
co_parent: &ColliderParent, co_parent: &ColliderParent,

View File

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