Data Realms Fan Forums
http://45.55.195.193/

REQ: 360 degree jetpack.
http://45.55.195.193/viewtopic.php?f=75&t=16339
Page 1 of 1

Author:  The Fat Sand Rat [ Sun Aug 23, 2009 11:30 pm ]
Post subject:  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.

Author:  Grif [ Mon Aug 24, 2009 12:27 am ]
Post subject:  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.

Author:  The Fat Sand Rat [ Thu Aug 27, 2009 1:48 am ]
Post subject:  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.

Author:  Miles_T3hR4t [ Thu Aug 27, 2009 1:55 am ]
Post subject:  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.

Author:  Grif [ Thu Aug 27, 2009 3:04 am ]
Post subject:  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).

Author:  The Fat Sand Rat [ Thu Aug 27, 2009 8:46 pm ]
Post subject:  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.

Author:  lafe [ Fri Aug 28, 2009 12:15 am ]
Post subject:  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.

Author:  The Fat Sand Rat [ Fri Aug 28, 2009 3:05 am ]
Post subject:  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.

Author:  Grif [ Fri Aug 28, 2009 2:41 pm ]
Post subject:  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);

Author:  The Fat Sand Rat [ Fri Aug 28, 2009 8:44 pm ]
Post subject:  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.

Author:  Grif [ Sat Aug 29, 2009 3:04 am ]
Post subject:  Re: REQ: 360 degree jetpack.

Oh wait uh okay make the GetAimAngle true, and then make it angle = -self:GetAimAngle(true);

Author:  The Fat Sand Rat [ Sat Aug 29, 2009 3:36 am ]
Post subject:  Re: REQ: 360 degree jetpack.

Great, it works now!
Thanks.

Page 1 of 1 All times are UTC [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/