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

View File

@ -22,7 +22,7 @@ impl Plugin for ProxyComponentsPlugin {
// Physics
app.register_type::<AutoAABBCollider>();
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));
}
}