Skip to content

Commit

Permalink
refactor: specify target agent
Browse files Browse the repository at this point in the history
  • Loading branch information
mrchantey committed Jul 12, 2024
1 parent 8f924bc commit 673e942
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
</h3>
</div>

Beet is Behavior Expressed as Entity Trees, using [bevy observers][bevy-observers] for control flow and messaging. The entity-based approach is very flexible, and allows for multiple behavior paradigms to be used together as needed.
Beet is Behavior Expressed as Entity Trees, using [Observers][bevy-observers] for control flow and messaging. The entity-based approach is very flexible, and allows for multiple behavior paradigms to be used together as needed.

Currently implemented paradigms:
- [Behavior Trees](./examples/hello_world.rs)
Expand Down
2 changes: 1 addition & 1 deletion crates/beet_core/src/steer/steer_actions/seek.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ mod test {
SteerBundle::default().with_target(Vec3::new(1.0, 0., 0.)),
))
.with_children(|parent| {
parent.spawn((RootIsTargetAgent, Running, Seek));
parent.spawn((TargetAgent(parent.parent_entity()), Running, Seek));
})
.id();

Expand Down
6 changes: 5 additions & 1 deletion crates/beet_core/src/steer/steer_actions/wander.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,11 @@ mod test {
SteerBundle::default(),
))
.with_children(|parent| {
parent.spawn((RootIsTargetAgent, Running, Wander::default()));
parent.spawn((
TargetAgent(parent.parent_entity()),
Running,
Wander::default(),
));
})
.id();

Expand Down
4 changes: 2 additions & 2 deletions crates/beet_examples/src/scenes/avoid_obstacles.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@
// .with_children(|parent| {
// parent.spawn((
// Name::new("Drive Forward"),
// RootIsTargetAgent,
// TargetAgent(agent.parent_entity()),
// Score::Weight(0.5),
// SetAgentOnRun(DualMotorValue::splat(MotorValue::forward_max())),
// ));

// parent.spawn((
// Name::new("Turn Right"),
// RootIsTargetAgent,
// TargetAgent(agent.parent_entity()),
// Score::default(),
// DepthSensorScorer::new(threshold_dist),
// SetAgentOnRun(DualMotorValue::new(
Expand Down
2 changes: 1 addition & 1 deletion crates/beet_examples/src/scenes/flock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ pub fn flock(mut commands: Commands) {
agent.spawn((
RunOnSpawn,
ContinueRun::default(),
RootIsTargetAgent,
TargetAgent(agent.parent_entity()),
Separate::<GroupSteerAgent>::new(1.),
Align::<GroupSteerAgent>::new(1.),
Cohere::<GroupSteerAgent>::new(1.),
Expand Down

0 comments on commit 673e942

Please sign in to comment.