Data Realms Fan Forums
http://45.55.195.193/

help with spread of shrapnal in a cannon like weapon
http://45.55.195.193/viewtopic.php?f=1&t=17455
Page 1 of 1

Author:  snapperfisch [ Mon Dec 28, 2009 7:21 pm ]
Post subject:  help with spread of shrapnal in a cannon like weapon

hi
what i'm trying to do is make a "cannon ball" that explodes into a concentrated burst of particles (with a spread of a bout 15 degrees or less) forward in relation to the "cannon ball" i tried using s the spread variable of a MOSRotating by changing it to 0.1 but whenever it gibs the explosion is always going right, it looks like cc takes the spread as being in relation to the scene and not the round i would appreciate a solution, thanks

heres th code of the MOSRotating

Code:
AddEffect = MOSRotating
   PresetName = Fraglet
   Mass = 0.1
   OrientToVel = 1
   RestThreshold = -500
   HitsMOs = 1
   GetsHitByMOs = 0
   SpriteFile = ContentFile
      FilePath = Base.rte/Devices/Cannons/CannonRound.bmp
   ScriptPath = phalax.rte/airbirst.lua
   FrameCount = 1
   SpriteOffset = Vector
      X = -2
      Y = -2
   EntryWound = AEmitter
      CopyOf = Dent Metal
   ExitWound = AEmitter
      CopyOf = Dent Metal
   AtomGroup = AtomGroup
      AutoGenerate = 1
      Material = Material
         CopyOf = Military Stuff
      Resolution = 2
      Depth = 0
   DeepGroup = AtomGroup
      AutoGenerate = 1
      Material = Material
         CopyOf = Military Stuff
      Resolution = 4
      Depth = 1
   DeepCheck = 1
   GibImpulseLimit = 1
   GibSound = Sound
      AddSample = ContentFile
         FilePath = Base.rte/Sounds/Explode2.wav
//   AddGib = Gib
//      GibParticle = MOPixel
//         CopyOf = Flash Particle Yellow Big
//      Count = 1
//      Spread = 2.25
//      MaxVelocity = 0.1
//      MinVelocity = 0
//      InheritsVel = 0
   AddGib = Gib
      GibParticle = MOPixel
         CopyOf = Grenade Fragment Gray
         LifeTime = 100
      Count = 10
      Spread = 0.1
//      MaxVelocity = 50
//      MinVelocity = 75
      InheritsVel = 1
   AddGib = Gib
      GibParticle = MOPixel
         CopyOf = Grenade Fragment Yellow
      Count = 15
      Spread = 0.1
//      MaxVelocity = 50
//      MinVelocity = 75
      InheritsVel = 1
//   AddGib = Gib
//      GibParticle = MOSParticle
//         CopyOf = Side Thruster Blast Ball 1
//      Count = 10
//      Spread = 2.25
//      MaxVelocity = 20
//      MinVelocity = 0
//      InheritsVel = 0
//   AddGib = Gib
//      GibParticle = MOPixel
//         CopyOf = Air Blast
//      Count = 15
//      Spread = 2.25
//      MaxVelocity = 30
//      MinVelocity = 0
//      InheritsVel = 0


the air burst lua should make it explode befor it hits the ground or wall or whatever and detonate it such that the shapnal goes into the target instead of being emitted away from it because of the round rebounding but i cant see if it works untill i sort this problem out.

Author:  Abdul Alhazred [ Mon Dec 28, 2009 10:21 pm ]
Post subject:  Re: help with spread of shrapnal in a cannon like weapon

One possible solution is using inherit velocity like the Base.rte flak cannon. For a more precise method create a separate shrapnel emitter and try adding something like this to your script:

Code:
function Create(self)
   self.lastRot = self.RotAngle   -- don't bounce
end

function Destroy(self)
   local Blast = CreateAEmitter("HEAT Blast", "ModName.rte")
   Blast.Pos = self.Pos
   Blast.RotAngle = self.lastRot
   MovableMan:AddParticle(Blast)
end

function Update(self)
   self.lastRot = self.RotAngle
end

Author:  Azukki [ Tue Dec 29, 2009 3:58 am ]
Post subject:  Re: help with spread of shrapnal in a cannon like weapon

With significantly arced trajectories, that script might be a little weird. You might want to update lastRot every 100 ms or something like that instead.

Just a suggestion, make the explosion partially radial too. Sure, shaped charges, directed blast, etc, but it will look better and more believable if there's some explosion going backward, even if the main focus of the effect is directed. This can be added to the blast emitter just by making emissions with more spread and less velocity.

Author:  snapperfisch [ Thu Dec 31, 2009 12:52 pm ]
Post subject:  Re: help with spread of shrapnal in a cannon like weapon

so why is spread tied to the scene instead of the round that the particles come from then?

Author:  Shook [ Thu Dec 31, 2009 2:24 pm ]
Post subject:  Re: help with spread of shrapnal in a cannon like weapon

What you should do is to make the shrapnel inherit the projectiles velocity, have them gib in a spread of 3.14, and then give them a somewhat low maximum velocity, like 10-20 or so, depending on the speed of your projectile, like so:
Code:
   AddGib = Gib
      GibParticle = MOPixel
         CopyOf = Grenade Fragment Gray
         LifeTime = 100
      Count = 10
      Spread = 3.14
      MaxVelocity = 15
      MinVelocity = 0
      InheritsVel = 1

Give it a shot. To make the spread wider/narrower, increase/decrease MaxVelocity. This is because of the fact that an object, that detonates in the air, doesn't have its gibs inherit the objects angle, but rather is fixed at 0, meaning horizontally to the right. This is solely due to the game engine, so there's not much we can do about that one problem. There are numerous workarounds, however.

Author:  Azukki [ Mon Jan 04, 2010 3:50 am ]
Post subject:  Re: help with spread of shrapnal in a cannon like weapon

But then, if the initial projectile hits something, the velocity inherited is after the collision. The problem with that is made obvious when some vanilla explosives are used on the side of a rocket. The explosion bounces off. This can be counteracted with tweaked projectile material properties, but not entirely undone.

If it's a cluster bomb or something like that, gibs are probably the way to go, but if you want a directional explosion like a shaped charge, using an emitter as described will give more consistent results.

Page 1 of 1 All times are UTC [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/