[Question] How do you do the missile effect?
IsS127 opened this issue ยท 8 comments
Hey,
Ive been looking allover the files to see how you do the missile effect with effectlib, but i didnt really find out how you do it.
So how do you really create it?
This is how i do it but its really slow..
http://hastebin.com/sanojucari.java
That is completely a matter of how quickly you move your point:
double x = t*dir.getX() + 0.005;
That means you are moving 0.005 meters per tick, which is going to be pretty slow.
The CustomProjectile class plays multiple particles per tick, which is why the speed of the projectile doesn't change the frequency of particles.
So if you move the projectile 1 meter per tick, you might play 10 particles per tick, each stepping 1/10 of a meter.
That's more or less how it's done, just plays an effect at every step. That part really has nothing to do with effectlib.
There is also a ConeEffect overlaid on that, if I remember correctly.
Never use distance() for things like this, favor distanceSquared (you'd be comparing against 1.5 * 1.5 in this case). Not sure if by "slow" you meant inefficient, or if it's really just moving slowly through the world.
Ok i made my effect/particle work, i found a code and i modified it a little bit
But could u help me with a tiny thing? as you are one of the dev of effectlib..
I want to change color of my SPELL_MOB_AMBIENT
I use this code to display it
http://hastebin.com/yerupopede.php
And this is the full code of the effect
http://hastebin.com/adamojigaz.cpp
How do i do it?
I want the color to be white..
Thank you.
Assuming that's the EffectLib ParticleEffect class, you can use this display call:
public void display(ParticleData data, Location center, Color color, double range, float offsetX, float offsetY, float offsetZ, float speed, int amount) {
"data" can be null, so long as you're not using block_crack, icon_crack or one of the other particle types that needs data.