use origin instead of pivot
and use trimesh instead of convex
This commit is contained in:
@@ -32,20 +32,14 @@ impl SpawnPoint {
|
||||
|
||||
#[derive(SolidClass, Component, Reflect)]
|
||||
#[reflect(Component)]
|
||||
#[geometry(GeometryProvider::new().convex_collider().smooth_by_default_angle().render())]
|
||||
#[geometry(GeometryProvider::new().trimesh_collider().smooth_by_default_angle().render())]
|
||||
pub struct Worldspawn;
|
||||
|
||||
#[derive(SolidClass, Component, Reflect, Default)]
|
||||
#[reflect(Component)]
|
||||
#[geometry(GeometryProvider::new().convex_collider().smooth_by_default_angle().render())]
|
||||
pub struct NamedEntity {
|
||||
pub name: String,
|
||||
}
|
||||
|
||||
#[derive(PointClass, Component, Reflect, Default)]
|
||||
#[reflect(Component)]
|
||||
#[require(Transform)]
|
||||
pub struct Pivot {
|
||||
#[geometry(GeometryProvider::new().trimesh_collider().smooth_by_default_angle().render())]
|
||||
pub struct NamedEntity {
|
||||
pub name: String,
|
||||
}
|
||||
|
||||
@@ -67,17 +61,23 @@ impl EnemySpawn {
|
||||
world
|
||||
.commands()
|
||||
.entity(entity)
|
||||
.insert((
|
||||
Visibility::default(),
|
||||
RigidBody::Dynamic,
|
||||
Collider::capsule(0.2, 1.),
|
||||
LockedAxes::new().lock_rotation_z().lock_rotation_x(),
|
||||
Name::from("Enemy"),
|
||||
))
|
||||
.with_child((
|
||||
Transform::from_translation(Vec3::new(0., -0.6, 0.)).with_scale(Vec3::splat(1.5)),
|
||||
SceneRoot(mesh),
|
||||
));
|
||||
.insert((Name::from("Enemy"), Visibility::default()))
|
||||
.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((
|
||||
Visibility::default(),
|
||||
Transform::from_translation(Vec3::new(0., -1.4, 0.))
|
||||
.with_scale(Vec3::splat(1.5)),
|
||||
SceneRoot(mesh),
|
||||
));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user