Data Realms Fan Forums
http://45.55.195.193/

Need hover code.
http://45.55.195.193/viewtopic.php?f=73&t=17578
Page 1 of 1

Author:  dragonxp [ Fri Jan 15, 2010 2:52 am ]
Post subject:  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.

Author:  PhantomAGN [ Fri Jan 15, 2010 8:27 am ]
Post subject:  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.

Author:  CaveCricket48 [ Fri Jan 15, 2010 12:27 pm ]
Post subject:  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).

Author:  dragonxp [ Fri Jan 15, 2010 7:19 pm ]
Post subject:  Re: Need hover code.

could it not just fly in the air, im looking for a code for a hovertank if that helps.

Author:  TorrentHKU [ Fri Jan 15, 2010 7:50 pm ]
Post subject:  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.

Author:  Grif [ Sat Jan 16, 2010 12:39 am ]
Post subject:  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

Author:  dragonxp [ Sat Jan 16, 2010 1:15 am ]
Post subject:  Re: Need hover code.

guess ill find some way.

Author:  Lizardheim [ Sat Jan 16, 2010 10:09 am ]
Post subject:  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?

Author:  TheLastBanana [ Sat Jan 16, 2010 6:30 pm ]
Post subject:  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.

Author:  dragonxp [ Sat Jan 16, 2010 6:33 pm ]
Post subject:  Re: Need hover code.

ok TLB, its worth a shot.

Author:  CaveCricket48 [ Sat Jan 16, 2010 7:46 pm ]
Post subject:  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

Author:  dragonxp [ Sat Jan 16, 2010 7:55 pm ]
Post subject:  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.

Author:  CaveCricket48 [ Sat Jan 16, 2010 8:41 pm ]
Post subject:  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

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