Author |
Message |
The Fat Sand Rat
Joined: Sun Apr 15, 2007 5:56 am Posts: 1191 Location: outside the shithole called the University in the Forest
|
REQ: 360 degree jetpack.
Here's my request: a simple template for an AHuman actor with a jetpack that fires in the opposite direction of the actor's aim, so that it can propel the actor in any direction, outside of the current ~60 degree arc. This will probably require lua, but obviously I have no idea what I'm talking about, so... yeah. I realize the same function can be carried out with a gun, but I want to use the jetpack. Pre-emptive thanks.
|
Sun Aug 23, 2009 11:30 pm |
|
|
Grif
REAL AMERICAN HERO
Joined: Sat Jan 27, 2007 10:25 pm Posts: 5655
|
Re: REQ: 360 degree jetpack.
In actor:
function Update(self) if self:GetController():IsState(Controller.BODY_JUMP) == true then local angle = self:GetAimAngle(false); self.Vel.X = self.Vel.X + math.cos(10,angle); self.Vel.Y = self.Vel.Y + math.sin(10,angle); end end
10 is a non-specific speed adjustment. Higher the number faster you go. Not perfect at all but it (should) get the job done.
|
Mon Aug 24, 2009 12:27 am |
|
|
The Fat Sand Rat
Joined: Sun Apr 15, 2007 5:56 am Posts: 1191 Location: outside the shithole called the University in the Forest
|
Re: REQ: 360 degree jetpack.
So the syntax should be Code: In actor:
function Update(self) if self:GetController():IsState(Controller.BODY_JUMP) == true then local angle = self:GetAimAngle(false); self.Vel.X = self.Vel.X + math.cos(10,angle); self.Vel.Y = self.Vel.Y + math.sin(10,angle); end end
? I can't seem to get this to work, but I'm probably doing something stupid.
|
Thu Aug 27, 2009 1:48 am |
|
|
Miles_T3hR4t
Joined: Mon Jun 04, 2007 5:55 am Posts: 1627 Location: Ohio
|
Re: REQ: 360 degree jetpack.
why not just attach the jet-pack to the arm? if its still on the actor it should work, right?..... no then we'd be able to hold guns with our faces if we wanted....
nevermind, disregard that.
|
Thu Aug 27, 2009 1:55 am |
|
|
Grif
REAL AMERICAN HERO
Joined: Sat Jan 27, 2007 10:25 pm Posts: 5655
|
Re: REQ: 360 degree jetpack.
The Fat Sand Rat wrote: So the syntax should be ? I can't seem to get this to work, but I'm probably doing something stupid. Well uh if you're including the "in actor" part that would be your problem. Just from function Update self to the last end, inside an otherwise empty .lua file directly attached to an actor (not the limbs or anything).
|
Thu Aug 27, 2009 3:04 am |
|
|
The Fat Sand Rat
Joined: Sun Apr 15, 2007 5:56 am Posts: 1191 Location: outside the shithole called the University in the Forest
|
Re: REQ: 360 degree jetpack.
Odd. That's what I tried first, but I guess I must have screwed something up. Thanks. EDIT: Now it works, but it only propels the actor to the left.
|
Thu Aug 27, 2009 8:46 pm |
|
|
lafe
Joined: Sat Mar 28, 2009 2:33 pm Posts: 718
|
Re: REQ: 360 degree jetpack.
The Fat Sand Rat wrote: Odd. That's what I tried first, but I guess I must have screwed something up. Thanks. EDIT: Now it works, but it only propels the actor to the left. you could just use a gun.
|
Fri Aug 28, 2009 12:15 am |
|
|
The Fat Sand Rat
Joined: Sun Apr 15, 2007 5:56 am Posts: 1191 Location: outside the shithole called the University in the Forest
|
Re: REQ: 360 degree jetpack.
The Fat Sand Rat wrote: I realize the same function can be carried out with a gun, but I want to use the jetpack.
Learn to read.
|
Fri Aug 28, 2009 3:05 am |
|
|
Grif
REAL AMERICAN HERO
Joined: Sat Jan 27, 2007 10:25 pm Posts: 5655
|
Re: REQ: 360 degree jetpack.
The Fat Sand Rat wrote: Odd. That's what I tried first, but I guess I must have screwed something up. Thanks. EDIT: Now it works, but it only propels the actor to the left. Try changing the GetAimAngle to true. Well; :GetAimAngle(true);
|
Fri Aug 28, 2009 2:41 pm |
|
|
The Fat Sand Rat
Joined: Sun Apr 15, 2007 5:56 am Posts: 1191 Location: outside the shithole called the University in the Forest
|
Re: REQ: 360 degree jetpack.
Odd; same problem. EDIT: removing the '10,' makes the X axis work, and the Y axis work, but flipped. I'm gonna keep on poking stuff and hope I don't cause an explosion; I'll try making the Y axis stuff negative. EDIT2: Seems to make the guy either gain altitude very slowly, combined with much horizontal movement, or just shake in place and catapult away when the jump key is released.
|
Fri Aug 28, 2009 8:44 pm |
|
|
Grif
REAL AMERICAN HERO
Joined: Sat Jan 27, 2007 10:25 pm Posts: 5655
|
Re: REQ: 360 degree jetpack.
Oh wait uh okay make the GetAimAngle true, and then make it angle = -self:GetAimAngle(true);
|
Sat Aug 29, 2009 3:04 am |
|
|
The Fat Sand Rat
Joined: Sun Apr 15, 2007 5:56 am Posts: 1191 Location: outside the shithole called the University in the Forest
|
Re: REQ: 360 degree jetpack.
Great, it works now! Thanks.
|
Sat Aug 29, 2009 3:36 am |
|
|
|