|
Page 1 of 1
|
[ 13 posts ] |
|
Author |
Message |
dragonxp
Joined: Wed Sep 09, 2009 3:16 am Posts: 3032 Location: Somewhere in the universe
|
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 |
|
|
PhantomAGN
Joined: Mon Jun 29, 2009 2:40 am Posts: 610 Location: Deep below The Map of Mars
|
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 |
|
|
CaveCricket48
Joined: Tue Jun 12, 2007 11:52 pm Posts: 13144 Location: Here
|
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 |
|
|
dragonxp
Joined: Wed Sep 09, 2009 3:16 am Posts: 3032 Location: Somewhere in the universe
|
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 |
|
|
TorrentHKU
Loose Canon
Joined: Sun Mar 29, 2009 11:07 pm Posts: 2992 Location: --------------->
|
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 |
|
|
Grif
REAL AMERICAN HERO
Joined: Sat Jan 27, 2007 10:25 pm Posts: 5655
|
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 |
|
|
dragonxp
Joined: Wed Sep 09, 2009 3:16 am Posts: 3032 Location: Somewhere in the universe
|
Re: Need hover code.
guess ill find some way.
|
Sat Jan 16, 2010 1:15 am |
|
|
Lizardheim
DRL Developer
Joined: Fri May 15, 2009 10:29 am Posts: 4107 Location: Russia
|
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 |
|
|
TheLastBanana
DRL Developer
Joined: Wed Dec 13, 2006 5:27 am Posts: 3138 Location: A little south and a lot west of Moscow
|
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 |
|
|
dragonxp
Joined: Wed Sep 09, 2009 3:16 am Posts: 3032 Location: Somewhere in the universe
|
Re: Need hover code.
ok TLB, its worth a shot.
|
Sat Jan 16, 2010 6:33 pm |
|
|
CaveCricket48
Joined: Tue Jun 12, 2007 11:52 pm Posts: 13144 Location: Here
|
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 |
|
|
dragonxp
Joined: Wed Sep 09, 2009 3:16 am Posts: 3032 Location: Somewhere in the universe
|
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 |
|
|
CaveCricket48
Joined: Tue Jun 12, 2007 11:52 pm Posts: 13144 Location: Here
|
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 |
|
|
|
|
Page 1 of 1
|
[ 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
|
|