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

Particles spawn at origin if created during update #30

Open
Occuros opened this issue Jan 21, 2025 · 0 comments
Open

Particles spawn at origin if created during update #30

Occuros opened this issue Jan 21, 2025 · 0 comments

Comments

@Occuros
Copy link

Occuros commented Jan 21, 2025

When creating a particle spawner during Update, the particles will spawn at the origin position.

This is especially noticeable when using one_shot spawners.

It seems the GlobalTransform is not at the correct location yet when the particle spawn system is running.

To see this in action, modify one of the examples collision:

add the following to the adjust_time_scale system:

 if input.just_pressed(KeyCode::Enter) {
        commands.spawn((
            ParticleSpawner {
                rate: 100.0,
                one_shot: true,
                emission_shape: EmissionShape::Circle {
                    normal: Vec3::Y,
                    radius: 0.3,
                },
               //same spawn code as in the Startup system
                ...
              Transform {
                translation: Vec3::new(5., 3.5, 0.),
                rotation: Quat::from_rotation_z(PI / 4.),
                ..default()
            },
        ));
    }

This will create particles at the origin point instead of the provided translation

@Occuros Occuros changed the title Particles spawn at origin of created during update Particles spawn at origin if created during update Jan 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant