Drop TODO to combine phys fns, update docstring
Replacing the `Position` component with direct manipulation of the transform functionally completed the TODO. The functions weren't exactly combined, but the resulting behavior might as well have been. I've updated the docstring to (exist, actually. yay syntax) describe the system accurately.
This commit is contained in:
@@ -18,13 +18,7 @@ pub(crate) struct Rotation(pub(crate) f32);
|
|||||||
#[derive(Component)]
|
#[derive(Component)]
|
||||||
pub(crate) struct Wrapping;
|
pub(crate) struct Wrapping;
|
||||||
|
|
||||||
// TODO: Combine movement integration steps into one function
|
/// Integrate linear velocity and update the entity's transform.
|
||||||
// They need to be ordered so the physics is deterministic. Bevy can enforce
|
|
||||||
// order, but it makes more sense to cut out the extra machinery and have one
|
|
||||||
// single function. Probably better for cache locality or whatever, too.
|
|
||||||
/*
|
|
||||||
Add velocity to position
|
|
||||||
*/
|
|
||||||
pub(crate) fn integrate_velocity(mut query: Query<(&mut Transform, &Velocity)>, time: Res<Time>) {
|
pub(crate) fn integrate_velocity(mut query: Query<(&mut Transform, &Velocity)>, time: Res<Time>) {
|
||||||
for (mut transform, velocity) in &mut query {
|
for (mut transform, velocity) in &mut query {
|
||||||
let delta = velocity.0 * time.delta_secs();
|
let delta = velocity.0 * time.delta_secs();
|
||||||
|
|||||||
Reference in New Issue
Block a user