|
FAQ
• Search • Login
|
|
Page 1 of 1
|
[ 7 posts ] |
|
Author |
Message |
CaveCricket48
Joined: Tue Jun 12, 2007 11:52 pm Posts: 13144 Location: Here
|
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.
|
Tue Jun 22, 2010 1:38 am |
|
|
Awesomeness
Joined: Sat Jun 19, 2010 5:02 pm Posts: 331 Location: Mekkan
|
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.
|
Wed Jun 23, 2010 3:03 am |
|
|
411570N3
Joined: Wed Jan 07, 2009 10:26 am Posts: 4074 Location: That quaint little British colony down south
|
Re: Negative Air Friction
Change Code: self.Vel = Vector(self.Vel.X,self.Vel.Y) To Code: self.Vel = Vector(self.Vel.X* self.acceleration,self.Vel.Y*self.acceleration) Maybe?
|
Wed Jun 23, 2010 6:02 am |
|
|
CaveCricket48
Joined: Tue Jun 12, 2007 11:52 pm Posts: 13144 Location: Here
|
Re: Negative Air Friction
Whoops, forgot to put that in. What 411570N3 said.
|
Wed Jun 23, 2010 7:47 am |
|
|
Dylanhutch
Joined: Sun Apr 25, 2010 12:04 am Posts: 303 Location: Australia
|
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.
|
Sun Jul 04, 2010 5:51 am |
|
|
CaveCricket48
Joined: Tue Jun 12, 2007 11:52 pm Posts: 13144 Location: Here
|
Re: Negative Air Friction
You attach the script to the object that you're trying to deccelerate.
|
Sun Jul 04, 2010 6:05 am |
|
|
Dylanhutch
Joined: Sun Apr 25, 2010 12:04 am Posts: 303 Location: Australia
|
Re: Negative Air Friction
Soo.. The bullet.
Yeah i'll test this in a bit.
|
Sun Jul 04, 2010 6:09 am |
|
|
|
|
Page 1 of 1
|
[ 7 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
|
|