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

ParticleCompositeCurve Curve and TwoCurves Mode not as expected #2085

Open
JujieX opened this issue Apr 24, 2024 · 0 comments
Open

ParticleCompositeCurve Curve and TwoCurves Mode not as expected #2085

JujieX opened this issue Apr 24, 2024 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@JujieX
Copy link
Contributor

JujieX commented Apr 24, 2024

Describe the bug
speed is still 0 when use ParticleCurveMode as Curve.

WebGLEngine.create({
  canvas: "canvas",
  graphicDeviceOptions: { webGLMode: WebGLMode.WebGL1 },
}).then((engine) => {
  Logger.enable();
  engine.canvas.resizeByClientSize();

  const scene = engine.sceneManager.activeScene;
  const rootEntity = scene.createRootEntity();
  scene.background.solidColor = new Color(15 / 255, 38 / 255, 18 / 255, 1);

  // Create camera
  const cameraEntity = rootEntity.createChild("camera_entity");
  cameraEntity.transform.position = new Vector3(0, 1, 3);
  const camera = cameraEntity.addComponent(Camera);
  camera.fieldOfView = 60;


      const particleEntity = cameraEntity.createChild();
      particleEntity.transform.position.set(0, -7.5, -8);

      const particleRenderer = particleEntity.addComponent(ParticleRenderer);

      const material = new ParticleMaterial(engine);
      particleRenderer.setMaterial(material);

      const { main, emission, velocityOverLifetime } =
        particleRenderer.generator;

      // Main module
      main.startSpeed.constant = 0;
      // Emission module
      emission.rateOverTime.constant = 5;

      // Velocity over lifetime module
      velocityOverLifetime.enabled = true;

      // velocityOverLifetime.velocityY.mode = ParticleCurveMode.Constant;
      // velocityOverLifetime.velocityY.constant = 1;

      velocityOverLifetime.velocityY.curve = new ParticleCurve();
      velocityOverLifetime.velocityY.curve.setKeys([
        new CurveKey(0, 1),
        new CurveKey(1, 1),
      ]);
      velocityOverLifetime.velocityY.mode = ParticleCurveMode.Curve;
    });
  engine.run();

Expected behavior

      velocityOverLifetime.velocityY.mode = ParticleCurveMode.Constant;
      velocityOverLifetime.velocityY.constant = 1;
      velocityOverLifetime.velocityY.curve = new ParticleCurve();
      velocityOverLifetime.velocityY.curve.setKeys([
        new CurveKey(0, 1),
        new CurveKey(1, 1),
      ]);
      velocityOverLifetime.velocityY.mode = ParticleCurveMode.Curve;
    });

should has almost same performance

@JujieX JujieX added the bug Something isn't working label Apr 24, 2024
@JujieX JujieX self-assigned this Apr 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant