#Why isn't this movement system smooth?

30 messages · Page 1 of 1 (latest)

prisma rover
#
pub fn move_system(
    mut query: Query<&mut Transform, With<Bullet>>,
    time: Res<Time>,
) {
    let dt = time.delta_secs(); // f32
    for mut transform in query.iter_mut() {
        transform.translation += Vec3::new(300.0, 0.0, 0.0) * dt;
    }
}```
sterile solar
prisma rover
#

No but I think that would make it worse since I'm multiplying by delta time.

sterile solar
#

it prevents floating point error from causing changes

#

that might not be the issue here, but that's the first thing that comes to mind

prisma rover
#

Isn't the point of FixedUpdate that the time between frames is fixed?

sterile solar
#

again, i don't really know if that is the issue here, but that is the first thing that comes to mind without seeing the rest of your code

prisma rover
#

There's not much else to see. I'm just inserting the TIme resource and a Bullet with that system

sterile solar
prisma rover
#

Oh, I am using the default plugins.. I'll remove my own insertion of it.

#

Hmm.. that does actually seem better.

sterile solar
#

when you ask for help, it's usually best to show a minimal complete example of your code, if you have very little code because you're just getting started, then you can show it all

prisma rover
#

Maybe part of it is also just that bevy starts up and it hasn't quite settled... (it only stays on the screen for about 1.5 seconds)

#

Thanks!

west moat
#

longshot but are you using avian as well for physics or just this translation here?

#

wondering if it could be some weird interpolation thing but probs not.

prisma rover
#

@west moat no, just Bevy. One thing that seemed to help was switching to release builds

#

its smooth enough to the point its fine now

lethal lava
prisma rover
#

yes

lethal lava
#

It tells you to add a section to cargo.toml that increases the opt-level for Bevy to release levels, while keeping it at debug levels for faster compiles for your game code

#

do you have that?

prisma rover
#

yup

lethal lava
#

and still it was laggy on debug but is better on release?

prisma rover
#

honestly not sure, but its acceptable now i think

lethal lava
#

because using that config the only difference building in release is optimizing your own code, since all dependencies are already at release levels of optimization. So maybe the stutter is actually just some other system you wrote running slowly/unevenly and your fps being low or unstable?

prisma rover
#

im not sure what made the difference in the end, maybe just letting it run longer