Skip to content

Example: projectile targeting moving object #19281

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

kivi
Copy link
Contributor

@kivi kivi commented May 18, 2025

Objective

This example has been writing during the RustWeek2025. In this example a projectile is spawned at cursor position on mouse click. The target is a moveable polygon that also rotates. The project will de-spawn, when close enough to it's target.

Solution

This example goes in /examples/usage/projectile_follow_moving.rs.
I added the example to Cargo.toml at the bottom of the examples listed and then ran cargo run -p build-templated-pages -- build-example-page as described in Creating examples

It changed the Cargo.toml and added lines to /examples/README.md

Testing

Nothing in bevy was changed. But the tests are running.
You can test the example by running the example.


Showcase

cargo run --example projectile_follow_moving

Note

Special thanks to people guiding me to use the Api wisely. Making me understand some core concepts and constantly correcting my mistakes.

@IQuick143 IQuick143 added C-Docs An addition or correction to our documentation C-Examples An addition or correction to our examples S-Needs-Review Needs reviewer attention (from anyone!) to move forward D-Modest A "normal" level of difficulty; suitable for simple features or challenging fixes labels May 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-Docs An addition or correction to our documentation C-Examples An addition or correction to our examples D-Modest A "normal" level of difficulty; suitable for simple features or challenging fixes S-Needs-Review Needs reviewer attention (from anyone!) to move forward
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants