So! If you've paid any attention to my rampant forum-posting you'll have noticed me mention the use of the cannon parts as anti-aircraft. I do this by using timed fuse shells!
If you've come to this blog post then I'm sure you're only here to know how to do what the title says this post will show you how to do. So I shall get to it now!
Alright, so, let's say you have a cannon on a turret that you want to be able to shoot planes down. I'd suggest it shoots quickly or has a large caliber for it to be more effective. You want the shells it fires to explode at a certain distance, but you don't know how! The best way to do it is with the Metric system. This works with the Imperial system but it's not as friendly since feet into miles are a little less straightforward than meters into kilometers.
Anyways, let's say you want the shells to explode at 4.5 kilometers. Check your cannon's properties and look at the shell velocity. Change it if you want, but remember the velocity in m/s or f/s depending on what you're doing. Let's say here that it is 500m/s. After you check this, make sure the shell is explosive. If not, it will not explode and will just disappear.
Once you have the velocity, take a calculator and divide the distance you want (in meters or feet) by the velocity (in meters or feet), in this case 4500 divided by 500. After doing so, you will get a number (in this case being 9). This number is the amount of seconds the shell takes to get to the specified distance.
Once you have the calculated number, select the cannon and open up Overload. Select the drop-down menu at the top and select Cannon. Once you do that, you will see somewhere near the bottom a parameter that should say "lifetime" or something of the like. Maybe it was "projectileLifetime" but I forget. There should be a very large number with an E+ at the end to the right of the parameter. Delete that, and input the number you obtained (in this case 9). The projectile lifetime is measured in seconds, so keep that in mind. Once you've done that, confirm what you put and close Overload, and feel satisfied that you've managed to do something cool.
If you want a cannon that has multiple different fuses for different distances, just duplicate the cannon, do the same process as before but with the different distance, set activation groups, and then place the duped cannon(s) in the same location as the original. Should work fine as long as they don't shoot themselves, but that shouldn't happen.
Anyways, I hope this helped. Make cool stuff!
@GeneralPatrick2 ok
@adiman52888 likely you'd have to mess around with Funky Trees coding for that kind of shenanigans.
How to i make it explode near the target no matter the range?
projectileLifetime(seconds as unit)
@SnoWFLakE0s i'm very intrigued by this squint-eyes emoji
@GeneralPatrick2
.
Nope, there is, and that's what I'm doing. Kinematics for the win!
@SnoWFLakE0s I know, but there's no better way to compensate for that (as far as I know) except aim up a little higher the further away the target is.
You are incorrect. You're on the right track, but you have completely neglected the physics of projectile motion that cannon shells follow, both IRL and in SP. For this to be true, cannon shells would have to move like laser beams.
Yes, typeitlikeitshouldhavebeen