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:
parent
25206af09b
commit
3b3346ff3e
BIN
assets/character/Russian_soldier_last.glb
Normal file
BIN
assets/character/Russian_soldier_last.glb
Normal file
Binary file not shown.
Binary file not shown.
@ -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)
|
||||
|
@ -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));
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user