Skip to content

Show preview when MouseEditMove in cubic_splines example - #26310

Open
U-C-S wants to merge 2 commits into
bevyengine:mainfrom
U-C-S:cubic-splines-example-update
Open

U-C-S wants to merge 2 commits into
bevyengine:mainfrom
U-C-S:cubic-splines-example-update

Conversation

@U-C-S

@U-C-S U-C-S commented Oct 25, 2026 •

Copy link
Copy Markdown

Objective

Update the examples/math/cubic_splines.rs to also show a preview of new line segment of the curve. The current example only shows the tangent as you MouseEditMove (aka click and drag the mouse pointer).

Solution

Store the preview point and it's tangent in the ControlPoints struct and draw it as the MouseEditMove changes each frame. So, this includes extra logic in the form_curve fn to also include the preview_point.

Testing

Tested it in Macbook m2 pro, manually by running the example.

The preview line segment moves accordingly for the SplineMode::Hermite as the tangent is only used in this mode.

@github-actions

Copy link
Copy Markdown
Contributor

Welcome, new contributor!

Please make sure you've read our contributing guide, as well as our policy regarding AI usage, and we look forward to reviewing your pull request shortly ✨

@U-C-S
U-C-S force-pushed the cubic-splines-example-update branch from 8f0c97d to ee6ca75 Compare October 25, 2026 17:28
@alice-i-cecile alice-i-cecile added C-Examples An addition or correction to our examples C-Usability A targeted quality-of-life change that makes Bevy easier to use A-Math Fundamental domain-agnostic mathematical operations D-Straightforward Simple bug fixes and API improvements, docs, test and examples S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Oct 25, 2026

@alice-i-cecile alice-i-cecile left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested, this is a nice addition!

@alice-i-cecile alice-i-cecile added the X-Uncontroversial This work is generally agreed upon label Oct 25, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Math Fundamental domain-agnostic mathematical operations C-Examples An addition or correction to our examples C-Usability A targeted quality-of-life change that makes Bevy easier to use D-Straightforward Simple bug fixes and API improvements, docs, test and examples S-Needs-Review Needs reviewer attention (from anyone!) to move forward X-Uncontroversial This work is generally agreed upon

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants