View unanswered posts | View active topics It is currently Thu Dec 26, 2024 10:10 pm



Reply to topic  [ 12 posts ] 
 REQ: 360 degree jetpack. 
Author Message
User avatar

Joined: Sun Apr 15, 2007 5:56 am
Posts: 1191
Location: outside the shithole called the University in the Forest
Reply with quote
Post 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
Profile
REAL AMERICAN HERO
User avatar

Joined: Sat Jan 27, 2007 10:25 pm
Posts: 5655
Reply with quote
Post 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
Profile
User avatar

Joined: Sun Apr 15, 2007 5:56 am
Posts: 1191
Location: outside the shithole called the University in the Forest
Reply with quote
Post 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
Profile
User avatar

Joined: Mon Jun 04, 2007 5:55 am
Posts: 1627
Location: Ohio
Reply with quote
Post 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
Profile YIM WWW
REAL AMERICAN HERO
User avatar

Joined: Sat Jan 27, 2007 10:25 pm
Posts: 5655
Reply with quote
Post 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
Profile
User avatar

Joined: Sun Apr 15, 2007 5:56 am
Posts: 1191
Location: outside the shithole called the University in the Forest
Reply with quote
Post 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
Profile
User avatar

Joined: Sat Mar 28, 2009 2:33 pm
Posts: 718
Reply with quote
Post 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
Profile
User avatar

Joined: Sun Apr 15, 2007 5:56 am
Posts: 1191
Location: outside the shithole called the University in the Forest
Reply with quote
Post 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
Profile
REAL AMERICAN HERO
User avatar

Joined: Sat Jan 27, 2007 10:25 pm
Posts: 5655
Reply with quote
Post 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
Profile
User avatar

Joined: Sun Apr 15, 2007 5:56 am
Posts: 1191
Location: outside the shithole called the University in the Forest
Reply with quote
Post 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
Profile
REAL AMERICAN HERO
User avatar

Joined: Sat Jan 27, 2007 10:25 pm
Posts: 5655
Reply with quote
Post 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
Profile
User avatar

Joined: Sun Apr 15, 2007 5:56 am
Posts: 1191
Location: outside the shithole called the University in the Forest
Reply with quote
Post Re: REQ: 360 degree jetpack.
Great, it works now!
Thanks.


Sat Aug 29, 2009 3:36 am
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 12 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

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware for PTF.
[ Time : 0.056s | 15 Queries | GZIP : Off ]