Projectiles targetting script



I`m currently working on a targetting script, using a missile launcher as an example. The missile trails and models are nothing fancy, just placeholders.


I have implemented controls to add random velocities at fixed intervals. I called it Noise for some reason, and you can see the fields of Noise Speed and Interval. Basically it generates 3 random numbers to assemble a Vector3, then I add it to the body.velocity of each projectile.

The body.velocity is always lerped between the current speed and the next, which is based on the noise velocity and in the direction to the target. Doing so creates de effect of a curve trajectory, as it won’t point immediately to the target.

The maximum speed of each projectile is also lerped to a value, called Maximum Deacceleration, that makes it stop in midair. Then it changes back to the normal speed, going directly to the target.

Hope you like it so far, and any questions or critiques are welcome :slight_smile:


Really nice work, could we get a mini breakdown of your smoke/explosion textures? and are they hand painted? :slight_smile: ( I know you’ve said their place holders but still intrigued!)

1 Like


Here are the 4 channels of the texture.

The explosion is pretty much final, I only tweaked the bloom now, but haven’t updated the gif here yet.

So, one channel is the color, where I use a smoothstep to make it look cartoonish. Other is for the fire, another for the erosion, and the last one is the opacity (which is eroded by the blue channel).


Oh, my bad. This texture is not exactly from this explosion, but the shader is the same. This image in particular is from my Zelda’s explosion.

哇 他太棒了 我可以看一下你的着色器部分吗

strong text

very cool, also great explosion.

only comment is to have a field for when the rockets reach their appex you can trigger a ‘boost’ speed for the engine so that their re-orientation | pickup could have an extra punch…

Edit oh i meant adding a visual ‘boost’ with a prefab. I can see the speed trigger just fine. It needs a ps


It actually has something like that implemented. It triggers a particle system on each missile, but I haven’t created any PS for that yet xD. Also the speed damping is raised 3 times.

But I see the boost need adjustments. Maybe with a boost effect it will create the illusion of motion, idk

also maybe trail texture to hid polys, some texture to the edges

ah oh and an on_spawn prefab, give off a small poof using your sweet explosion tech, muzzle node or something

This looks amazing! Any possibility this script could be make public?

I did this script on my free time at work, so I kind of belongs to the company :confused:

Haha all good :smiley: Was just curious! I’ve been looking for a good projectile script.

I have made the explosion brighter, and also corrected the missile trajectory, as they were moving randomly before (I forgot to uncomment the part where I updated the trajectory)


Do you use a lerp to have the fire only be in the “cracks” of the smoke?

Yes, I erode this texture and use the value to lerp between the dark color and the bright color. But you can also add the color if you like.


Thanks for ref! (I just negate R channel and lerp for cracks).



I just wanted to say it looks great! Can you maybe specify what blending modes do you use? It looks like premultiplied to me yet it has the depth fade when it touches the ground, and to my knowledge you can’t have depth fade in premult, or am i wrong?

I always use Alpha Blended instead of premultiplied. You can always premultiply your texture on any software and save some instructions on your shader.
Not sure if soft particles works with premultiplied, never tested, but I think it works, can’t see why not :thinking:

1 Like