Data Realms Fan Forums
http://45.55.195.193/

Smart emitter + Particle slowing
http://45.55.195.193/viewtopic.php?f=73&t=16479
Page 1 of 1

Author:  CrazyMLC [ Wed Sep 09, 2009 3:36 am ]
Post subject:  Smart emitter + Particle slowing

How would I go about making an emitter on a craft fire when there is something in it's general range of fire. (in relation to the craft: DOWN. I do not want my craft to be at an angle and activate the emitter when something is under it.)

I also would like to know how to make code that divides a particle's speed by some variable when it hits terrain.

Author:  piipu [ Wed Sep 09, 2009 2:27 pm ]
Post subject:  Re: Smart emitter + Particle slowing

Code:
self.ToActivate = false
for thingie in MovableMan.Actors do
  if math.abs((thingie.Pos - self.Pos).AbsRadAngle  - (self.RotAngle - math.pi / 2)) < ([emitter spread] - math.atan(thingie.Diameter / (self.thingie.Pos - self.Pos).Magnitude)) then
    self.ToActivate = true
  end
end
self.emitter:EnableEmission(ToActivate)
It's pretty complicated but it should work. Just copypaste to Update and get the pointer to the emitter in some way.

Author:  CrazyMLC [ Thu Oct 01, 2009 1:52 am ]
Post subject:  Re: Smart emitter + Particle slowing

So
Code:
function Update(self)
   for actor in MovableMan.Actors do
      if actor.Team ~= self.Team then
         if math.abs((actor.Pos - self.Pos).AbsRadAngle  - (self.RotAngle - math.pi / 2)) < (2 - math.atan(actor.Diameter / (self.actor.Pos - self.Pos).Magnitude)) then
            self:EnableEmission(true)
         end
      else
         self:EnableEmission(false)
      end
   end
end

Applied to the emitter, right?

Author:  piipu [ Thu Oct 01, 2009 5:26 am ]
Post subject:  Re: Smart emitter + Particle slowing

Yes. Though it won't work if you simply attach the emitter to the ship. It needs to be either lua-attached or attachable hacked before it'll work.

Author:  CrazyMLC [ Sat Oct 03, 2009 9:03 pm ]
Post subject:  Re: Smart emitter + Particle slowing

How would I do that?

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