和引擎。粒子效果跟随精灵的速度太慢。如何减少延迟
我正在使用跟随球的粒子系统。当球移动时,粒子效果似乎跟随精灵的速度太慢。
我以这种方式清除粒子:
final CircleOutlineParticleEmitter ballEmitter = new CircleOutlineParticleEmitter(0, 0, 6);
final ParticleSystem particleBallSystem = new ParticleSystem(ballEmitter, 30, 30, 180, this.mParticleTextureRegion);
particleBallSystem.addParticleInitializer(new ColorInitializer(0, 0, 1));
particleBallSystem.addParticleInitializer(new AlphaInitializer(1));
particleBallSystem.setBlendFunction(GL10.GL_SRC_ALPHA, GL10.GL_ONE);
particleBallSystem.addParticleInitializer(new VelocityInitializer(-2, 2, -2, 3));
particleBallSystem.addParticleInitializer(new RotationInitializer(0.0f, 180.0f));
particleBallSystem.addParticleModifier(new org.anddev.andengine.entity.particle.modifier.ScaleModifier(1.0f, 1.2f, 0, 5));
particleBallSystem.addParticleModifier(new ColorModifier(0, 0, 0.2f, 0.1f, 0, 1, 1, 3));
particleBallSystem.addParticleModifier(new ColorModifier(0, 0, 0.1f, 0.2f, 1, 1, 4, 6));
particleBallSystem.addParticleModifier(new AlphaModifier(0, 1, 0, 1));
particleBallSystem.addParticleModifier(new AlphaModifier(1, 0, 5, 6));
particleBallSystem.addParticleModifier(new ExpireModifier(1, 6));
并在触摸事件中设置中心(在触摸移动时):
ballEmitter.setCenter(newX-15, newY);
有没有办法减少粒子系统的延迟?
I'm using a Particle system that follows a ball. As the ball is moving the Particle effects seems too follow too slowly the sprite.
I'm declearing the particle in such way:
final CircleOutlineParticleEmitter ballEmitter = new CircleOutlineParticleEmitter(0, 0, 6);
final ParticleSystem particleBallSystem = new ParticleSystem(ballEmitter, 30, 30, 180, this.mParticleTextureRegion);
particleBallSystem.addParticleInitializer(new ColorInitializer(0, 0, 1));
particleBallSystem.addParticleInitializer(new AlphaInitializer(1));
particleBallSystem.setBlendFunction(GL10.GL_SRC_ALPHA, GL10.GL_ONE);
particleBallSystem.addParticleInitializer(new VelocityInitializer(-2, 2, -2, 3));
particleBallSystem.addParticleInitializer(new RotationInitializer(0.0f, 180.0f));
particleBallSystem.addParticleModifier(new org.anddev.andengine.entity.particle.modifier.ScaleModifier(1.0f, 1.2f, 0, 5));
particleBallSystem.addParticleModifier(new ColorModifier(0, 0, 0.2f, 0.1f, 0, 1, 1, 3));
particleBallSystem.addParticleModifier(new ColorModifier(0, 0, 0.1f, 0.2f, 1, 1, 4, 6));
particleBallSystem.addParticleModifier(new AlphaModifier(0, 1, 0, 1));
particleBallSystem.addParticleModifier(new AlphaModifier(1, 0, 5, 6));
particleBallSystem.addParticleModifier(new ExpireModifier(1, 6));
And setting the center in the touch event (on touch move):
ballEmitter.setCenter(newX-15, newY);
Is there a way to reduce the latency of the particle system ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
扩展PhysicsConnector类并重写onUpdate方法。在 on update 方法中设置发射器的中心。因此,每次精灵的位置更新为主体的值时,发射器位置都会更新。
确保当您将球的主体连接到其精灵时,您传递了 MyPhysicsConnector 的实例
Extend the PhysicsConnector class and override the onUpdate method. Set the center of emitter in the on update method. So the emitter position gets updated every time the Sprite's position gets updated to the Body's values.
Make sure that when you connect the Ball's body to its sprite you pass in an instance of MyPhysicsConnector