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

[FR]: 如果需要动态修改粒子大小有现成的方法可以调用吗? #361

Open
YBbread opened this issue Jan 25, 2024 · 6 comments
Labels
feature New feature or request

Comments

@YBbread
Copy link

YBbread commented Jan 25, 2024

因为想节省初始化时间和场景资源,场景内已创建的粒子可以进行修改发射时和结束时的大小 或 颜色吗?

@YBbread YBbread added the feature New feature or request label Jan 25, 2024
@OriIIusion
Copy link
Contributor

先将想修改属性的组件保存到一个变量中,随后在回调事件中修改即可。看下面这两个小栗子,按下qwer上面的1234键看效果。
https://codepen.io/OriIIusion/pen/zYbEPpp
https://codepen.io/OriIIusion/pen/VwRMrxg

@YBbread
Copy link
Author

YBbread commented Jan 25, 2024

先将想修改属性的组件保存到一个变量中,随后在回调事件中修改即可。看下面这两个小栗子,按下qwer上面的1234键看效果。 https://codepen.io/OriIIusion/pen/zYbEPpp https://codepen.io/OriIIusion/pen/VwRMrxg

蟹蟹~ 很感谢。
但我根据栗子用法尝试修改ParticleOverLifeScaleModule模块粒子的初始和结束时大小却修改不到。比如我是这样

this.OverLifeScaleModule = simulator.addModule(ParticleOverLifeScaleModule);
this.OverLifeScaleModule = [
new Vector4(0.1, 0.1,0.1),
new Vector4(0.1,0.1,0.1)
];

然后在事件中进行回调
this.OverLifeScaleModule = [
new Vector4(10, 10,10),
new Vector4(1,1, 1)
];

没有修改成功,是我的写法有问题吗?

@OriIIusion
Copy link
Contributor

你可以先看看控制台有没有报错。
OverLifeScaleModule是一个模块,你想修改的那个大小,应该是下面这样写。
overLifeScaleModule.scaleSegments = [new Vector4(1, 1, 1), new Vector4(3, 3, 3)];
粗心了哦

@YBbread
Copy link
Author

YBbread commented Jan 25, 2024

你可以先看看控制台有没有报错。 OverLifeScaleModule是一个模块,你想修改的那个大小,应该是下面这样写。 overLifeScaleModule.scaleSegments = [new Vector4(1, 1, 1), new Vector4(3, 3, 3)]; 粗心了哦

啊啊啊啊啊啊啊~~~好了~~ (^3^) (^3^) (^3^)

@YBbread
Copy link
Author

YBbread commented Jan 25, 2024

想再追问下,修改发射器半径时。似乎会导致粒子重置发射,缺少了变大变小时的过渡效果,这个会尝试更新吗

@OriIIusion
Copy link
Contributor

不清楚哎,我也是新手

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants