Successfully imported a rigid body from blender, now I have to link the rigidbody and the collider, as it is currently detached

This commit is contained in:
Franklin 2023-11-16 21:32:15 -04:00
parent 25206af09b
commit 3b3346ff3e
4 changed files with 7 additions and 6 deletions

Binary file not shown.

Binary file not shown.

View File

@ -18,7 +18,7 @@ pub enum Collider {
#[derive(Component, Reflect, Default, Debug)] #[derive(Component, Reflect, Default, Debug)]
#[reflect(Component)] #[reflect(Component)]
pub enum RigidBody { pub enum RigidBodyBlender {
#[default] #[default]
Fixed, Fixed,
Dynamic, Dynamic,
@ -42,8 +42,8 @@ pub fn physics_replace_proxies(
(Without<RapierCollider>, Added<Collider>), (Without<RapierCollider>, Added<Collider>),
>, >,
proxy_rigidbodies: Query< proxy_rigidbodies: Query<
(Entity, &RigidBody), (Entity, &RigidBodyBlender),
(Without<RapierRigidBody>, Added<RigidBody>), (Without<RapierRigidBody>, Added<RigidBodyBlender>),
>, >,
// needed for tri meshes // needed for tri meshes
children: Query<&Children>, children: Query<&Children>,
@ -105,10 +105,11 @@ pub fn physics_replace_proxies(
} }
} }
for (entity, proxy_rigidbody) in proxy_rigidbodies.iter() { for (entity, proxy_rigidbody) in proxy_rigidbodies.iter() {
println!("A");
let rapier_rigidbody: RapierRigidBody; let rapier_rigidbody: RapierRigidBody;
match proxy_rigidbody { match proxy_rigidbody {
RigidBody::Fixed => rapier_rigidbody = RapierRigidBody::Fixed, RigidBodyBlender::Fixed => rapier_rigidbody = RapierRigidBody::Fixed,
RigidBody::Dynamic => rapier_rigidbody = RapierRigidBody::Dynamic, RigidBodyBlender::Dynamic => rapier_rigidbody = RapierRigidBody::Dynamic,
} }
commands commands
.entity(entity) .entity(entity)

View File

@ -22,7 +22,7 @@ impl Plugin for ProxyComponentsPlugin {
// Physics // Physics
app.register_type::<AutoAABBCollider>(); app.register_type::<AutoAABBCollider>();
app.register_type::<physics::rapier::Collider>(); app.register_type::<physics::rapier::Collider>();
app.register_type::<physics::rapier::RigidBody>(); app.register_type::<physics::rapier::RigidBodyBlender>();
app.add_systems(Update, (physics_replace_proxies, update_game_load_state)); app.add_systems(Update, (physics_replace_proxies, update_game_load_state));
} }
} }