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)]
|
#[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)
|
||||||
|
@ -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));
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user