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

Rotation of emitter doesn't affect spawned particles #375

Open
barsoosayque opened this issue Sep 11, 2024 · 0 comments
Open

Rotation of emitter doesn't affect spawned particles #375

barsoosayque opened this issue Sep 11, 2024 · 0 comments

Comments

@barsoosayque
Copy link

Crate versions
bevy version: 0.14.1
bevy_hanabi version: 0.12.2

Describe the bug
Rotation part of ParticleEffect's GlobalTransform does not rotate velocity of spawned particles. Seems like #43 should've fixed that, but maybe there was a regression ? Or I'm misunderstanding something.

Expected behavior
Particles rotate towards emitter's own rotation.

To Reproduce
Here is a diff for examples/spawn_on_command:

Diff

diff --git a/examples/spawn_on_command.rs b/examples/spawn_on_command.rs
index 7b4c0b5..b42497d 100644
--- a/examples/spawn_on_command.rs
+++ b/examples/spawn_on_command.rs
@@ -242,10 +235,11 @@ fn update(
             let color = 0xFF000000u32 | (b as u32) << 16 | (g as u32) << 8 | (r as u32);
             properties.set("spawn_color", color.into());

-            // Set the collision normal
-            let normal = normal.normalize();
-            info!("Collision: n={:?}", normal);
-            properties.set("normal", normal.extend(0.).into());
+
+            // Set the collision rotation
+            properties.set("normal", Vec3::X.into());
+            effect_transform.look_at(transform.translation + normal.extend(0.0), Vec3::Y);
+            info!("Rotation = {:?}", effect_transform.rotation);

             // Spawn the particles
             spawner.reset();

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