shoot. TODO: fix collision and brief spawning at 0,0
This commit is contained in:
@@ -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,
|
||||
|
Reference in New Issue
Block a user