Skip to content
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

[Merged by Bors] - use Mul<f32> to double the value of Vec3 #6607

Closed
wants to merge 1 commit into from

Conversation

rick68
Copy link
Contributor

@rick68 rick68 commented Nov 14, 2022

improve the example code

@james7132 james7132 added the C-Examples An addition or correction to our examples label Nov 14, 2022
@@ -169,8 +169,7 @@ fn integrate(mut query: Query<(&mut Acceleration, &mut Transform, &mut LastPos)>
// verlet integration
// x(t+dt) = 2x(t) - x(t-dt) + a(t)dt^2 + O(dt^4)

let new_pos =
transform.translation + transform.translation - last_pos.0 + acceleration.0 * dt_sq;
let new_pos = transform.translation * 2.0 - last_pos.0 + acceleration.0 * dt_sq;
Copy link
Contributor

Choose a reason for hiding this comment

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

can you move the 2.0 to before translation to match the equation above?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I can't do this, because we don't have the impl Mul<Vec3> for f32 rule.

@mockersf mockersf added S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it A-Math Fundamental domain-agnostic mathematical operations labels Nov 14, 2022
@cart
Copy link
Member

cart commented Nov 14, 2022

bors r+

bors bot pushed a commit that referenced this pull request Nov 14, 2022
improve the example code
@bors bors bot changed the title use Mul<f32> to double the value of Vec3 [Merged by Bors] - use Mul<f32> to double the value of Vec3 Nov 14, 2022
@bors bors bot closed this Nov 14, 2022
taiyoungjang pushed a commit to taiyoungjang/bevy that referenced this pull request Dec 15, 2022
alradish pushed a commit to alradish/bevy that referenced this pull request Jan 22, 2023
ItsDoot pushed a commit to ItsDoot/bevy that referenced this pull request Feb 1, 2023
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 S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants