Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Shotgun

Ivan Fassbinder
Very Dead
Join date: 9 Dec 2004
Posts: 25
07-27-2006 14:01
Hi-

I'm working on a shotgun, but I have no idea how to model the spread of the shot. Can someone help me out twith the basic math required to create a "cone of fire"? After tinkering with my scripts some, I can tell that its far more involved than what I have been trying.

Thanks-
Ivan
DoteDote Edison
Thinks Too Much
Join date: 6 Jun 2004
Posts: 790
07-27-2006 17:03
I think the easiest method would be to use an expanding single-prim shell. Suppose you use a cylinder.. start the cylinder at 0.01m diameter inside the gun, then once rezzed, run a timer that increases the diameter every tenth of a second or something.
Angela Salome
Registered User
Join date: 6 Oct 2005
Posts: 224
07-28-2006 00:36
Probably the easiest way is to have a number of bullet rezzing threads equal to the number of pellets in the shotgun shell, then in the shotgun mode, apply a random offset of +/-0.5m in the X, Y and Z directions when the pellets/bullets are rezzed. You could also apply a slight random variation in the vector velocity the pellets/bullets are fired.

As for changing diameter, your bullet script has to record it's velocity, turn physics off, change it's diameter, turn physics back on and reapply it's force. This can look disturbing in flight with a high speed bullet. Also if you're using cylinders, instead of cubes, remember to adjust the bullet rezzing code to turn the cylinder on it's side.
Ordinal Malaprop
really very ordinary
Join date: 9 Sep 2005
Posts: 4,607
07-28-2006 00:39
From: Angela Salome
Probably the easiest way is to have a number of bullet rezzing threads equal to the number of pellets in the shotgun shell, then in the shotgun mode, apply a random offset of +/-0.5m in the X, Y and Z directions when the pellets/bullets are rezzed. You could also apply a slight random variation in the vector velocity the pellets/bullets are fired.

Pretty much what I did with the shot shells in my derringer; there are only three pellets, though (it's a small cartridge). Works quite well. I've not tried it with more than three.

N.B. remember to use llCollisionFilter to stop the sub-projectiles bumping into each other.
Pinto Schnyder
Registered User
Join date: 23 May 2007
Posts: 17
10-27-2007 21:04
I made a custom double barrel side by side an use unlinked bullets the only side effect....... they sometimes hit eachother but it now an then hits me an sends me back a lil bit still messing with the bullet spacing and all but once I get it all right i hope to get it working right