Data Realms Fan Forums http://45.55.195.193/ |
|
Emitters question http://45.55.195.193/viewtopic.php?f=1&t=16392 |
Page 1 of 1 |
Author: | Arnkh [ Sun Aug 30, 2009 1:31 pm ] |
Post subject: | Emitters question |
I have a gun that shoots an emitter that sticks to people and drags them with itself, slowly lifting them off the ground using GlobalAccScalar, and I want to make it so that it would smack the said people into ground after some time, so the question is: how can I make that emitter emit upwards, or at least perpendicular to movement direction? P.S. I feel like I've failed this assault on defenceless english language, but I hope this is understandable. >_< |
Author: | piipu [ Sun Aug 30, 2009 2:28 pm ] |
Post subject: | Re: Emitters question |
You could use this simple script: Code: function Create(self) self.unpinned = 1 self.vector = Vector(0,0) self.LTimer = Timer() self.time1 = Timer() self.time2 = Timer() for actor in MovableMan.Actors do if (actor.Pos - self.Pos).Magnitude < 60 then self.parent = actor;end end self.GlobalAccScalar = 0 end function Update(self) if self.LTimer:IsPastSimMS(50) then if self.unpinned == 1 then self.atarget = (SceneMan:CastMORay(Vector(self.Pos.X - self.Vel.X,self.Pos.Y - self.Vel.Y),Vector(self.Vel.X,self.Vel.Y),0,0,true,5)) self.target = MovableMan:GetMOFromID(self.atarget) if self.target ~= nil then self.target = MovableMan:GetMOFromID(self.target.RootID) self.unpinned = 0 self.offset = Vector(self.Pos.X - self.target.Pos.X , self.Pos.Y - self.target.Pos.Y) self.offsetang = self.offset.AbsRadAngle - self.target.RotAngle self.target:AddAbsImpulseForce(Vector((self.Vel.X - self.target.Vel.Y), (self.Vel.Y - self.target.Vel.Y)) , self.Pos) self.target.Vel = Vector(self.target.Vel.X + self.Vel.X / self.target.Mass , self.target.Vel.Y + self.Vel.Y / self.target.Mass) self.time2:Reset() end end end if MovableMan:ValidMO(self.target) and self.unpinned == 0 then self.Pos = Vector(self.target.Pos.X + (self.offset.Magnitude * math.cos(self.target.RotAngle + self.offsetang)),self.target.Pos.Y - (self.offset.Magnitude * math.sin(self.target.RotAngle + self.offsetang))) self.Vel = self.target.Vel if not self.time2:IsPastSimMS(5000) then self.target.Vel.Y = -5 elseif not self.time2:IsPastSimMS(5200) self.target.Vel.Y = 50 end else self.unpinned = 1;end end |
Author: | deathbringer [ Sun Aug 30, 2009 5:32 pm ] |
Post subject: | Re: Emitters question |
piipu wrote: You could use this simple script: Code: Super hueg code... o.O... If this is simple in lua, I'm giving up. |
Author: | Benpasko [ Sun Aug 30, 2009 7:11 pm ] |
Post subject: | Re: Emitters question |
Simple doesn't account for length. Look at the functions, though, it uses the same functions often, and doesn't require a lot of thinking to understand. That's why it's simple. |
Page 1 of 1 | All times are UTC [ DST ] |
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |