Skip to content
Discussion options

You must be logged in to vote

I think you may be missing that your systems can have multiple queries.

fn control_ship(mut query: Query<&mut Ship>, mut actor_query: Query<&Actor>) {
    for mut ship in query.iter_mut() {
        if let Some(pilot) = ship.pilot {
            let pilot = actor_query.get_mut(pilot).unwrap();

            if ship.destination != pilot.goal {
                ship.destination = pilot.goal;
            }
        }
    }
}

Side note: to get your code formatted properly, enclose it in triple backticks (you can optionally specify a language for syntax highlighting).

```rust
let this = "some rust code";
```

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@randallsturgis
Comment options

Answer selected by randallsturgis
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants