Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Building a cannon for on a ship

Egbert McLuhan
Registered User
Join date: 27 Aug 2005
Posts: 5
09-04-2005 04:48
Im looking to build a cannon on a ship, one that fires on touching (or if possisble one that you can sit in and rotate and fire). Can anyone help me?
Chosen Few
Alpha Channel Slave
Join date: 16 Jan 2004
Posts: 7,496
09-04-2005 09:08
First of all, Egbert, since this your first post, welcome to SL :)

Okay, to answer your question, I'll take it in 2 sections: modeling the cannon, and getting it to fire. Here goes:

I. Modeling
1. Start with the barrel. Obviously the barrel is a cylinder with a half sphere on the back end. Cannon barrels tend to be wider at the back and narrower at the front, so you'll have to use the half sphere to cap the "bottom" of the cylinder, not the "top," since SL allows you to shrink the top of any object, but not any other side. So, make your cylinder, hollow it a little, and set the top size to something like 85% in both directions. Then use a half sphere with the exact same diameter as the cylinder to cap the bottom end of the cylinder. Select both prims and press ctrl-l to link them together as one object. Color it black and set it to high shine. Now you've got a reasonable approximation of a cannon barrel. Rotate it 90 degrees so that it sits horizonatally instead of vertically. Add more details such as a fuse, ornamentation, etc. as you wish.

2. Now build the frame and the wheels. You can get as ornate as you want here, but the basic shape obviously is a box for the frame ( the part the barrel sits on), 4 cylinders for wheels, and 2 longer and narrower cylinders for axles. I'm pretty sure boat cannons sit on 4 small wheels, but I could be wrong. Anyway, I think you get the idea of what to do here. Put the box under the barrel, put the 2 axle cylinders under the box crosswise, and put the wheels on the ends of the axles. Texture them with your favorite wood texture. Add more details such as aiming cranks, ornamentation, etc. as you see fit.

3. General tip. If you're going for a highly ornamented look, use texturing to acheive the desired look, rather than loading up on extra prims. This is always the best policy. The whole key to great modeling in SL is to keep your builds as "low-prim" as possible. The more prims you use, the more server load you create, and the more of the finiite limit you consume of the prims allowed on the land you're on. It's always best to take your time in Photoshop (or whatever your graphical editor of choice happens to be) and do it right than it is to be a prim hog.


Making it Fire
I should preface this by saying that my strengths lie in modeling and texturing, and that I'm not a great scriptor. I can give you some very basic tips here, but someone else will have to give you the step-by-steps if you can't figure it out on your own. Pretty much everything you need to know is in the popgun script. I think the popgun is still part of the standard library when you start, but if it's not, I can send you one if you need. Beyond that, you'll need a particle script to throw out some smoke when the cannon fires, and a good firing sound.

If you open the popgun script, you'll see that the way it works is it creates a bullet object, then propels it in a given direction at the same time as it plays a bang sound. You'll need to remove the parts that put you in mouselook mode, animate you to hold a gun, etc. The only part you want is the part that actually creates and fires the bullet. For touch activation, that's always there by default whenever you create a new script. Just remove the part where it makes the object say "hello avatar" and replace it with the bullet stuff. If you're a decent programmer, it won't take you long to modify the script to suit your cannon. If you're more like me, you'll spend a while reading it, scratching your head, and then you'll get a more knowledgeable friend to comment the thing for you so you know exactly what to change and how.

I'm sorry I can't give you better instructions here, but as I said, programming is just not where my talents are. Hopefully I've given you enough so at least you know what you need, even if you don't know exactly how to do it yet.
_____________________
.

Land now available for rent in Indigo. Low rates. Quiet, low-lag mainland sim with good neighbors. IM me in-world if you're interested.
squall Murakami
Burning SOMETHING
Join date: 5 Sep 2005
Posts: 84
09-05-2005 10:34
by any chance could I get the popgun script? i went straight to the sandbox when i finished the tutorial so i missed that
Egbert McLuhan
Registered User
Join date: 27 Aug 2005
Posts: 5
09-06-2005 08:58
Thanks, i managed to make one, its very basic but ill try to make it more advanced.