Data Realms Fan Forums http://45.55.195.193/ |
|
Negative Air Friction http://45.55.195.193/viewtopic.php?f=75&t=19060 |
Page 1 of 1 |
Author: | CaveCricket48 [ Tue Jun 22, 2010 1:38 am ] |
Post subject: | Re: Negative Air Friction |
Code: function Create(self) self.acceltimer = Timer(); self.acceldelay = 100; -- time-delay between accelerations (in MS). self.acceleration = 2; -- scalar acceleration. 1 is no acceleration, 0.5 is deceleration by half previous vel, 2 is acceleration by double previous vel. end function Update(self) if self.acceltimer:IsPastSimMS(self.acceldelay) then self.Vel = Vector(self.Vel.X,self.Vel.Y) end end There's your acceleration/deceleration script. |
Author: | Awesomeness [ Wed Jun 23, 2010 3:03 am ] |
Post subject: | Re: Negative Air Friction |
In your script, where does it multiply the velocity by the acceleration? It looks to me like the update method isn't changing the velocity of whatever the script is attached to at all. |
Author: | 411570N3 [ Wed Jun 23, 2010 6:02 am ] |
Post subject: | Re: Negative Air Friction |
Change Code: self.Vel = Vector(self.Vel.X,self.Vel.Y) Code: self.Vel = Vector(self.Vel.X* self.acceleration,self.Vel.Y*self.acceleration) |
Author: | CaveCricket48 [ Wed Jun 23, 2010 7:47 am ] |
Post subject: | Re: Negative Air Friction |
Whoops, forgot to put that in. What 411570N3 said. |
Author: | Dylanhutch [ Sun Jul 04, 2010 5:51 am ] |
Post subject: | Re: Negative Air Friction |
Yes all very well, and well done, but do you attach it to the bullet or the weapon? Code: AddEffect = MOPixel PresetName = *Bullet* ScriptPath = ???????/????.lua Or Code: AddDevice = HDFirearm PresetName = *Weapon* ScriptPath = ???????/????.lua Oops, it is a slightly old thread. Hope you don't mind. |
Author: | CaveCricket48 [ Sun Jul 04, 2010 6:05 am ] |
Post subject: | Re: Negative Air Friction |
You attach the script to the object that you're trying to deccelerate. |
Author: | Dylanhutch [ Sun Jul 04, 2010 6:09 am ] |
Post subject: | Re: Negative Air Friction |
Soo.. The bullet. Yeah i'll test this in a bit. |
Page 1 of 1 | All times are UTC [ DST ] |
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |