I have an entity that already has a transform, and want to give it a mesh afterwards. in the code below I am trying to preserve the transform in two ways but its not working:
fn init_player_system(
mut cmds: Commands,
q: Query<(Entity, &Transform), Added<Player>>,
mut meshes: ResMut<Assets<Mesh>>,
mut materials: ResMut<Assets<StandardMaterial>>,
) {
for (entity, transform) in &q {
cmds.entity(entity).insert(PbrBundle {
mesh: meshes.add(Mesh::from(shape::Cube::default())),
material: materials.add(StandardMaterial {
base_color: Color::GREEN,
..default()
}),
transform: *transform,
..default()
}).insert(*transform);
}
}