shoot. TODO: fix collision and brief spawning at 0,0

This commit is contained in:
2022-08-16 20:46:10 +02:00
parent 56fdaabb1a
commit 614092a8eb
3 changed files with 17 additions and 15 deletions

View File

@@ -148,13 +148,13 @@ pub fn setup_level(mut _commands: Commands) {
pub fn spawn_projectile(commands: &mut Commands, origin: Vec2, direction: Vec2) -> Entity {
commands
.spawn()
.insert(Transform {
translation: Vec3::new(origin.x, origin.y, 0.),
..Default::default()
})
.insert(Collider::ball(0.1))
.insert(Velocity::linear(direction * 10.))
.insert(ActiveEvents::COLLISION_EVENTS)
.insert_bundle(TransformBundle::from(Transform::from_xyz(
origin.x, origin.y, 0.,
)))
//.insert(Collider::ball(0.1))
.insert(RigidBody::Dynamic)
.insert(Velocity::linear(direction))
//.insert(ActiveEvents::COLLISION_EVENTS)
.insert(Projectile {
duration: Timer::from_seconds(3.5, false),
direction,