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



Reply to topic  [ 2 posts ] 
 Animating Emitters based on Velocity 
Author Message
User avatar

Joined: Sun Oct 29, 2006 4:26 am
Posts: 298
Reply with quote
Post Animating Emitters based on Velocity
Quick questions: Can you run scripts on dropship engines in the first place? If so, can you have it change animation speed on the engines to match the velocity the engine is currently travelling. No need for trig, straight up checking X velocity would work just fine for my purposes.


Tue Feb 23, 2010 9:57 pm
Profile YIM
User avatar

Joined: Tue Jun 12, 2007 11:52 pm
Posts: 13144
Location: Here
Reply with quote
Post Re: Animating Emitters based on Velocity
As of build 23, Lua scripts cannot be run on attachables (including emitters that are attached to objects). You can put the scripts on the parent object, though. The script would be something like this:

Code:
function Create(self)
   self.makeframe = 0;
   self.emitterlist = {};

   for i = 1,MovableMan:GetMOIDCount()-1 do
      attachable = MovableMan:GetMOFromID(i);
    if attachable.PresetName == "AEmitter Name" and attachable.ClassName == "AEmitter" and attachable.RootID == self.RootID then
   self.emitterlist[#self.emitterlist+1] = attachable;
    end
   end

end

function Update(self)

   if self.Vel.Magnitude < 10 then
   self.makeframe = 0;
   elseif self.Vel.Magnitude => 10 and self.Vel.Magnitude < 20 then
   self.makeframe = 1;
   end

   for i = 1, #self.emitterlist do
    if self.emitterlist[i].ID ~= 255 then
   self.emitterlist[i].Frame = self.makeframe;
    end
   end

end


What this does is that it finds AEmitters that are attached it when it is created, and then changes their frame according to the scripted object's velocity. Also, be sure to change the SpriteAnimMode so the emitters can't animate on their own and allow the script to do it.


Tue Feb 23, 2010 10:14 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 2 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:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware for PTF.
[ Time : 0.074s | 15 Queries | GZIP : Off ]