View unanswered posts | View active topics It is currently Fri Dec 27, 2024 9:18 am



Reply to topic  [ 13 posts ] 
 Need hover code. 
Author Message
User avatar

Joined: Wed Sep 09, 2009 3:16 am
Posts: 3032
Location: Somewhere in the universe
Reply with quote
Post Need hover code.
Could i get something similar to TLB's hoverboard Lua code, but without pinning the actor ontop of the board?
I need this to attach to an ACrab.


Fri Jan 15, 2010 2:52 am
Profile
User avatar

Joined: Mon Jun 29, 2009 2:40 am
Posts: 610
Location: Deep below The Map of Mars
Reply with quote
Post Re: Need hover code.
Sorta like CC's very own bullet train?
Or more like the EAF jump trooper?
Just looking for a better description of exactly what you want.


Fri Jan 15, 2010 8:27 am
Profile
User avatar

Joined: Tue Jun 12, 2007 11:52 pm
Posts: 13144
Location: Here
Reply with quote
Post Re: Need hover code.
Here is Darlos' raw hover code from his DS Yosei, maybe that can work for you. (you have to read the thread a bit).


Fri Jan 15, 2010 12:27 pm
Profile
User avatar

Joined: Wed Sep 09, 2009 3:16 am
Posts: 3032
Location: Somewhere in the universe
Reply with quote
Post Re: Need hover code.
could it not just fly in the air, im looking for a code for a hovertank if that helps.


Fri Jan 15, 2010 7:19 pm
Profile
Loose Canon
User avatar

Joined: Sun Mar 29, 2009 11:07 pm
Posts: 2992
Location: --------------->
Reply with quote
Post Re: Need hover code.
Lafe's code, while lafetastic, is still hovery. It'll need some refinement, such as making it not bob like an insane cork.


Fri Jan 15, 2010 7:50 pm
Profile WWW
REAL AMERICAN HERO
User avatar

Joined: Sat Jan 27, 2007 10:25 pm
Posts: 5655
Reply with quote
Post Re: Need hover code.
dragonxp wrote:
could it not just fly in the air, im looking for a code for a hovertank if that helps.


yeah uh I hate to break it to you

but you can't just do

function Update(self)
hover(self,altitude,velocity)
end


Sat Jan 16, 2010 12:39 am
Profile
User avatar

Joined: Wed Sep 09, 2009 3:16 am
Posts: 3032
Location: Somewhere in the universe
Reply with quote
Post Re: Need hover code.
guess ill find some way.


Sat Jan 16, 2010 1:15 am
Profile
DRL Developer
DRL Developer

Joined: Fri May 15, 2009 10:29 am
Posts: 4107
Location: Russia
Reply with quote
Post Re: Need hover code.
To make a "manual" hover i think you can use air particles that are heavy and have them be sent from the bottom so that they reflect back on it, and maybe have them invisible too?


Sat Jan 16, 2010 10:09 am
Profile
DRL Developer
DRL Developer
User avatar

Joined: Wed Dec 13, 2006 5:27 am
Posts: 3138
Location: A little south and a lot west of Moscow
Reply with quote
Post Re: Need hover code.
It shouldn't be too hard to just adapt my code. It's documented and everything, so just take out the parts you don't need and you should be fine. Give it a try first, and then post if you have any problems in doing so.


Sat Jan 16, 2010 6:30 pm
Profile WWW
User avatar

Joined: Wed Sep 09, 2009 3:16 am
Posts: 3032
Location: Somewhere in the universe
Reply with quote
Post Re: Need hover code.
ok TLB, its worth a shot.


Sat Jan 16, 2010 6:33 pm
Profile
User avatar

Joined: Tue Jun 12, 2007 11:52 pm
Posts: 13144
Location: Here
Reply with quote
Post Re: Need hover code.
Here is a simple hover script:

Code:
function Create(self)
   self.hoverheight = 20; -- You can edit this
   self.hoverspeed = 5; -- and this
end

function Update(self)
   local terrcheck = Vector(0,0);
   local ray = SceneMan:CastStrengthRay(self.Pos,Vector(0,self.hoverheight+50),0,terrcheck,1,0,true);
   if ray == true then
   self.Vel.Y = (((terrcheck+Vector(0,-self.hoverheight))-self.Pos):CapMagnitude(self.hoverspeed)).Y;
   end
end


Sat Jan 16, 2010 7:46 pm
Profile
User avatar

Joined: Wed Sep 09, 2009 3:16 am
Posts: 3032
Location: Somewhere in the universe
Reply with quote
Post Re: Need hover code.
i still think TLB's code would work better, because i need to move the tank?

Im guessing that script makes the tank float, but unable to move.

But, maybe i could have a horizontal jetpack to propel the tank...

we'll see.


Sat Jan 16, 2010 7:55 pm
Profile
User avatar

Joined: Tue Jun 12, 2007 11:52 pm
Posts: 13144
Location: Here
Reply with quote
Post Re: Need hover code.
EDIT: Hovering script with hovering at set altitude, controlable horizantal-movement, and smooth rotation.

Code:
function Create(self)
   self.AccelTimer = Timer();
   self.moved = false;
   self.mapwrapx = SceneMan.SceneWrapsX;

   self.hoverheight = 20; -- hover height
   self.hoverspeed = 5; -- max hover speed
   self.movespeed = 10; -- max move speed
   self.acceltime = 1000; -- time before reaching top speed
   self.rotatespeed = 3; -- max rotate speed
end

function Update(self)
   local terrcheck = Vector(0,0);
   local ray = SceneMan:CastStrengthRay(self.Pos,Vector(0,self.hoverheight+50),0,terrcheck,1,0,true);
   if ray == true then
   self.Vel.Y = (((terrcheck+Vector(0,-self.hoverheight))-self.Pos):CapMagnitude(self.hoverspeed)).Y;
   end

   if self.AccelTimer:IsPastSimMS(self.acceltime/100) and ((self.Vel.X < 0 and self.Vel.X >= -self.movespeed) or (self.Vel.X > 0 and self.Vel.X <= self.movespeed) or self.Vel.X == 0) then
   self.moved = false;
    if self:GetController():IsState(Controller.MOVE_LEFT) then
   self.moved = true;
   self.Vel.X = self.Vel.X - (self.movespeed/100);
   self.AccelTimer:Reset();
    end
    if self:GetController():IsState(Controller.MOVE_RIGHT) then
   self.moved = true;
   self.Vel.X = self.Vel.X + (self.movespeed/100);
   self.AccelTimer:Reset();
    end
    if self.moved == false then
     if self.Vel.X < 0 and self.Vel.X >= -self.movespeed then
   self.Vel.X = self.Vel.X + (self.movespeed/100);
   self.AccelTimer:Reset();
     elseif self.Vel.X > 0 and self.Vel.X <= self.movespeed then
   self.Vel.X = self.Vel.X - (self.movespeed/100);
   self.AccelTimer:Reset();
     end
    end
   end

   local terrcheckl = Vector(0,0);
   local balancerayl = SceneMan:CastStrengthRay(self.Pos,Vector(-self.Radius,self.hoverheight+100),0,terrcheckl,1,0,true);
   local terrcheckr = Vector(0,0);
   local balancerayr = SceneMan:CastStrengthRay(self.Pos,Vector(self.Radius,self.hoverheight+100),0,terrcheckr,1,0,true);
   local rotatething = Vector(SceneMan:ShortestDistance(terrcheckl,terrcheckr,self.mapwrapx).AbsRadAngle-self.RotAngle,0);
   if balancerayl == true and balancerayr == true then
   local rotatething = Vector(SceneMan:ShortestDistance(terrcheckl,terrcheckr,self.mapwrapx).AbsRadAngle-self.RotAngle,0);
   self.AngularVel = ((rotatething*3):CapMagnitude(self.rotatespeed)).X;
   end

end


Sat Jan 16, 2010 8:41 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 13 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.044s | 13 Queries | GZIP : Off ]