Author |
Message |
Ameefmu
Joined: Sat Aug 22, 2009 11:56 am Posts: 25
|
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 |
|
|
CaveCricket48
Joined: Tue Jun 12, 2007 11:52 pm Posts: 13144 Location: Here
|
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 |
|
|
Ameefmu
Joined: Sat Aug 22, 2009 11:56 am Posts: 25
|
Re: Reversed Air Resistance - Exponential Speed Increases
Thankyou sir, with a bit of number tweaking it worked like a charm
|
Sun Dec 13, 2009 5:13 am |
|
|
Geti
Joined: Sun Jul 13, 2008 9:57 am Posts: 4886 Location: some compy
|
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 |
|
|
Roon3
Joined: Sun May 11, 2008 12:50 pm Posts: 899
|
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 |
|
|
411570N3
Joined: Wed Jan 07, 2009 10:26 am Posts: 4074 Location: That quaint little British colony down south
|
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 |
|
|
Geti
Joined: Sun Jul 13, 2008 9:57 am Posts: 4886 Location: some compy
|
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 |
|
|
AtomicTroop
Joined: Fri Mar 16, 2007 1:28 pm Posts: 328 Location: Finland
|
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 |
|
|
|