This commit is contained in:
2025-03-12 17:14:35 +01:00
parent 17a2ed676b
commit 709c1762bd
4 changed files with 154 additions and 29 deletions

View File

@@ -94,6 +94,14 @@ impl EnemySpawn {
};
let this = world.get_entity(entity).unwrap().get::<Self>().unwrap();
let this_transform = world
.get_entity(entity)
.unwrap()
.get::<Transform>()
.unwrap();
let mut this_transform = *this_transform;
this_transform.translation += Vec3::new(0., 1., 0.);
let mesh = asset_server.load(GltfAssetLabel::Scene(0).from_asset("models/alien_naked.glb"));
@@ -103,23 +111,23 @@ impl EnemySpawn {
world
.commands()
.entity(entity)
.insert((Name::from("Enemy"), Visibility::default()))
.insert((
this_transform,
Name::from("Enemy"),
Visibility::default(),
RigidBody::Dynamic,
Collider::capsule(0.4, 2.),
LockedAxes::new().lock_rotation_z().lock_rotation_x(),
))
.with_children(|parent| {
parent
.spawn((
Visibility::default(),
RigidBody::Dynamic,
Collider::capsule(0.4, 2.),
LockedAxes::new().lock_rotation_z().lock_rotation_x(),
Transform::from_translation(Vec3::new(0., 1.0, 0.)),
))
.with_child((
Transform::from_translation(Vec3::new(0., 1., 0.)),
SceneRoot(head_mesh),
))
.with_child((
Visibility::default(),
Transform::from_translation(Vec3::new(0., -1.4, 0.))
Transform::from_translation(Vec3::new(0., -2.4, 0.))
.with_scale(Vec3::splat(1.5)),
SceneRoot(mesh),
));