View unanswered posts | View active topics It is currently Wed Oct 02, 2024 10:50 am



Reply to topic  [ 8 posts ] 
 Reversed Air Resistance - Exponential Speed Increases 
Author Message

Joined: Sat Aug 22, 2009 11:56 am
Posts: 25
Reply with quote
Post Reversed Air Resistance - Exponential Speed Increases
Hi all.

I'm trying to create a particle to be fired from a bomb or from a weapon, that begins with a movement speed of 5, yet increases drastically for each second it's active. I've tried setting a negative AirResistance variable to the particle, yet that does absolutely nothing to the speed at which it progresses.
I'm looking for a way to create the desired effect, preferably just by modifying the .ini file, but I'll have a go at Lua if necessary.

It seems many variables can be modified by making them negative, I guess I just got my hopes up about AirResistance a bit too early. Thanks in advance!

Ameefmu (Who's still a Crabling, despite purchasing)


Sun Dec 13, 2009 3:10 am
Profile
User avatar

Joined: Tue Jun 12, 2007 11:52 pm
Posts: 13143
Location: Here
Reply with quote
Post Re: Reversed Air Resistance - Exponential Speed Increases
Code:
function Create(self)
   self.AccelTimer = Timer();
   self.acceleration = 5; -- acceleration
   self.accelpertime = 1000; -- per time
end

function Update(self)
   if self.AccelTimer:IsPastSimMS(self.accelpertime) then
   self.AccelTimer:Reset();
   self.Vel = Vector(self.Vel.X,self.Vel.Y):SetMagnitude(self.Vel.Magntiude+self.acceleration);
   end
end


Attach that script to your particle.


Sun Dec 13, 2009 3:26 am
Profile

Joined: Sat Aug 22, 2009 11:56 am
Posts: 25
Reply with quote
Post Re: Reversed Air Resistance - Exponential Speed Increases
Thankyou sir, with a bit of number tweaking it worked like a charm :D


Sun Dec 13, 2009 5:13 am
Profile
User avatar

Joined: Sun Jul 13, 2008 9:57 am
Posts: 4886
Location: some compy
Reply with quote
Post Re: Reversed Air Resistance - Exponential Speed Increases
why not just
Code:
function Update(self)
self.Vel = self.Vel * 1.5 --put your number here
end
?
obviously 1.5 will make it go inordinately fast, but tweaking should be easy enough.


Sun Dec 13, 2009 7:17 am
Profile WWW
User avatar

Joined: Sun May 11, 2008 12:50 pm
Posts: 899
Reply with quote
Post Re: Reversed Air Resistance - Exponential Speed Increases
How about this
Code:
function Create(self)
self.A = <Insert starting speed of choice>;
end

function Update(self)
self.Vel = self.Vel.Normalized * self.A;
self.A = self.A + <Insert increment of choice>;
end

?


Sun Dec 13, 2009 8:29 am
Profile WWW
User avatar

Joined: Wed Jan 07, 2009 10:26 am
Posts: 4074
Location: That quaint little British colony down south
Reply with quote
Post Re: Reversed Air Resistance - Exponential Speed Increases
How about directly reading from Air resistance and applying only if it's negative?


Sun Dec 13, 2009 9:30 am
Profile WWW
User avatar

Joined: Sun Jul 13, 2008 9:57 am
Posts: 4886
Location: some compy
Reply with quote
Post Re: Reversed Air Resistance - Exponential Speed Increases
cause that would be silly when you could do it with an int and save reading the airresistance, and check how it works with PresetMan:ReloadAllScripts()


Tue Dec 15, 2009 5:36 am
Profile WWW

Joined: Fri Mar 16, 2007 1:28 pm
Posts: 328
Location: Finland
Reply with quote
Post Re: Reversed Air Resistance - Exponential Speed Increases
Right, so you purchased already? To get rid of the crabling, go to your forum profile settings and add your reg key to the corresponding slot.


Wed Dec 16, 2009 11:56 am
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 8 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.060s | 13 Queries | GZIP : Off ]