View unanswered posts | View active topics It is currently Fri Dec 27, 2024 6:48 am



Reply to topic  [ 5 posts ] 
 Smart emitter + Particle slowing 
Author Message
User avatar

Joined: Fri Dec 22, 2006 4:20 am
Posts: 4772
Location: Good news everyone!
Reply with quote
Post 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.


Wed Sep 09, 2009 3:36 am
Profile WWW
User avatar

Joined: Mon Jun 30, 2008 9:13 pm
Posts: 499
Location: Finland
Reply with quote
Post 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.


Wed Sep 09, 2009 2:27 pm
Profile
User avatar

Joined: Fri Dec 22, 2006 4:20 am
Posts: 4772
Location: Good news everyone!
Reply with quote
Post 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?


Thu Oct 01, 2009 1:52 am
Profile WWW
User avatar

Joined: Mon Jun 30, 2008 9:13 pm
Posts: 499
Location: Finland
Reply with quote
Post 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.


Thu Oct 01, 2009 5:26 am
Profile
User avatar

Joined: Fri Dec 22, 2006 4:20 am
Posts: 4772
Location: Good news everyone!
Reply with quote
Post Re: Smart emitter + Particle slowing
How would I do that?


Sat Oct 03, 2009 9:03 pm
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 5 posts ] 

Who is online

Users browsing this forum: No registered users


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware for PTF.
[ Time : 0.028s | 13 Queries | GZIP : Off ]