Hovercraft
3 posters
Page 1 of 1
Hovercraft
Nothing much, just the LB version of my battle hover, except:
1. it has no guns
2. it's supersonic
1. it has no guns
2. it's supersonic
- Code:
<?xml version="1.0" encoding="UTF-8"?>
<LB>
<ATTRIB>
<version>1.0.2</version>
<TARGET>
<u>0.2</u>
<v>-32.5333</v>
</TARGET>
<LUA>
<index>bottom</index>
</LUA>
<DESCRIPTION>
<text>GIFT</text>
<product>1</product>
</DESCRIPTION>
</ATTRIB>
<CONTROL>
<name>Rudder</name>
<default>0</default>
<maintain>0</maintain>
<min>-200</min>
<max>200</max>
<upKey0>0</upKey0>
<upStep0>2</upStep0>
<upKey1>0</upKey1>
<upStep1>-2</upStep1>
<upKey2>0</upKey2>
<upStep2>1</upStep2>
<upKey3>0</upKey3>
<upStep3>1</upStep3>
</CONTROL>
<CONTROL>
<name>JetPwrR</name>
<default>0</default>
<maintain>0</maintain>
<min>-200</min>
<max>200</max>
<upKey0>0</upKey0>
<upStep0>1</upStep0>
<upKey1>0</upKey1>
<upStep1>-1</upStep1>
<upKey2>0</upKey2>
<upStep2>1</upStep2>
<upKey3>0</upKey3>
<upStep3>1</upStep3>
</CONTROL>
<CONTROL>
<name>JetPwrL</name>
<default>0</default>
<maintain>0</maintain>
<min>-200</min>
<max>200</max>
<upKey0>0</upKey0>
<upStep0>1</upStep0>
<upKey1>0</upKey1>
<upStep1>-1</upStep1>
<upKey2>0</upKey2>
<upStep2>1</upStep2>
<upKey3>0</upKey3>
<upStep3>1</upStep3>
</CONTROL>
<CONTROL>
<name>JetPwrBR</name>
<default>0</default>
<maintain>0</maintain>
<min>-200</min>
<max>200</max>
<upKey0>0</upKey0>
<upStep0>1</upStep0>
<upKey1>0</upKey1>
<upStep1>-1</upStep1>
<upKey2>0</upKey2>
<upStep2>1</upStep2>
<upKey3>0</upKey3>
<upStep3>1</upStep3>
</CONTROL>
<CONTROL>
<name>JetPwrBL</name>
<default>0</default>
<maintain>0</maintain>
<min>-200</min>
<max>200</max>
<upKey0>0</upKey0>
<upStep0>1</upStep0>
<upKey1>0</upKey1>
<upStep1>-1</upStep1>
<upKey2>0</upKey2>
<upStep2>1</upStep2>
<upKey3>0</upKey3>
<upStep3>1</upStep3>
</CONTROL>
<CONTROL>
<name>JetPwrFR</name>
<default>0</default>
<maintain>0</maintain>
<min>-200</min>
<max>200</max>
<upKey0>0</upKey0>
<upStep0>1</upStep0>
<upKey1>0</upKey1>
<upStep1>-1</upStep1>
<upKey2>0</upKey2>
<upStep2>1</upStep2>
<upKey3>0</upKey3>
<upStep3>1</upStep3>
</CONTROL>
<CONTROL>
<name>JetPwrFL</name>
<default>0</default>
<maintain>0</maintain>
<min>-200</min>
<max>200</max>
<upKey0>0</upKey0>
<upStep0>1</upStep0>
<upKey1>0</upKey1>
<upStep1>-1</upStep1>
<upKey2>0</upKey2>
<upStep2>1</upStep2>
<upKey3>0</upKey3>
<upStep3>1</upStep3>
</CONTROL>
<OBJ id="0">
<name>Box3_1</name>
<type>box</type>
<u>4</u>
<v>38</v>
<width>15</width>
<height>9</height>
<thick>1</thick>
<material>10</material>
<coloring>0</coloring>
<lightweight>0</lightweight>
<glue>0</glue>
</OBJ>
<OBJ id="1">
<name>Box3</name>
<type>box</type>
<u>-19</u>
<v>38</v>
<width>15</width>
<height>9</height>
<thick>1</thick>
<material>10</material>
<coloring>0</coloring>
<lightweight>0</lightweight>
<glue>0</glue>
</OBJ>
<OBJ id="2">
<name>Box2</name>
<type>box</type>
<u>-4</u>
<v>-38</v>
<width>8</width>
<height>15</height>
<thick>4</thick>
<material>3</material>
<coloring>1</coloring>
<colorR>0.298039</colorR>
<colorG>0.298039</colorG>
<colorB>0.298039</colorB>
<lightweight>1</lightweight>
<glue>0</glue>
</OBJ>
<OBJ id="3">
<name>JetL_1</name>
<type>disk</type>
<u>10</u>
<v>30</v>
<width>0</width>
<height>3</height>
<thick>8</thick>
<material>0</material>
<coloring>0</coloring>
<lightweight>0</lightweight>
<glue>0</glue>
</OBJ>
<OBJ id="4">
<name>JetL</name>
<type>disk</type>
<u>-10</u>
<v>30</v>
<width>0</width>
<height>3</height>
<thick>8</thick>
<material>0</material>
<coloring>0</coloring>
<lightweight>0</lightweight>
<glue>0</glue>
</OBJ>
<OBJ id="5">
<name>JetBL</name>
<type>disk</type>
<u>-30</u>
<v>30</v>
<width>0</width>
<height>5</height>
<thick>2</thick>
<material>0</material>
<coloring>0</coloring>
<lightweight>0</lightweight>
<glue>0</glue>
</OBJ>
<OBJ id="6">
<name>JetBR</name>
<type>disk</type>
<u>30</u>
<v>30</v>
<width>0</width>
<height>5</height>
<thick>2</thick>
<material>0</material>
<coloring>0</coloring>
<lightweight>0</lightweight>
<glue>0</glue>
</OBJ>
<OBJ id="7">
<name>JetFR</name>
<type>disk</type>
<u>30</u>
<v>-30</v>
<width>0</width>
<height>5</height>
<thick>2</thick>
<material>0</material>
<coloring>0</coloring>
<lightweight>0</lightweight>
<glue>0</glue>
</OBJ>
<OBJ id="8">
<name>JetFL</name>
<type>disk</type>
<u>-30</u>
<v>-30</v>
<width>0</width>
<height>5</height>
<thick>2</thick>
<material>0</material>
<coloring>0</coloring>
<lightweight>0</lightweight>
<glue>0</glue>
</OBJ>
<OBJ id="9">
<name>Body</name>
<type>box</type>
<u>-15</u>
<v>-20</v>
<width>30</width>
<height>40</height>
<thick>2</thick>
<material>0</material>
<coloring>1</coloring>
<colorR>0.560784</colorR>
<colorG>0.65098</colorG>
<colorB>0.941176</colorB>
<lightweight>0</lightweight>
<glue>0</glue>
</OBJ>
<ATTACHMENT>
<ATTACH>
<type>servo</type>
<direction>5</direction>
<name>Rudder</name>
<reverse>1</reverse>
<angle>90</angle>
</ATTACH>
<FROM>
<obj>0</obj>
<type>box</type>
<side>1</side>
<coord>1</coord>
<u>0.733333</u>
<v>0</v>
<bury>0</bury>
<cover>1</cover>
</FROM>
<TO>
<obj>3</obj>
<type>disk</type>
<side>2</side>
<coord>0</coord>
<angle>-90</angle>
<bury>0</bury>
</TO>
</ATTACHMENT>
<ATTACHMENT>
<ATTACH>
<type>servo</type>
<direction>5</direction>
<name>Rudder</name>
<reverse>1</reverse>
<angle>-90</angle>
</ATTACH>
<FROM>
<obj>1</obj>
<type>box</type>
<side>1</side>
<coord>1</coord>
<u>0.266667</u>
<v>0</v>
<bury>0</bury>
<cover>1</cover>
</FROM>
<TO>
<obj>4</obj>
<type>disk</type>
<side>2</side>
<coord>0</coord>
<angle>-90</angle>
<bury>0</bury>
</TO>
</ATTACHMENT>
<ATTACHMENT>
<ATTACH>
<type>fix</type>
<direction>4</direction>
<angle>0</angle>
</ATTACH>
<FROM>
<obj>2</obj>
<type>box</type>
<side>2</side>
<coord>1</coord>
<u>0.5</u>
<v>0.5</v>
<bury>0</bury>
<cover>1</cover>
</FROM>
<TO>
<obj>9</obj>
<type>box</type>
<side>1</side>
<coord>1</coord>
<u>0.5</u>
<v>0.05</v>
<bury>0</bury>
</TO>
</ATTACHMENT>
<ATTACHMENT>
<ATTACH>
<type>linear</type>
<direction>5</direction>
<name>JetPwrR</name>
<reverse>1</reverse>
<angle>0</angle>
</ATTACH>
<FROM>
<obj>3</obj>
<type>disk</type>
<side>1</side>
<coord>1</coord>
<u>-0.0175439</u>
<v>-0.403509</v>
<bury>0</bury>
<cover>1</cover>
</FROM>
<TO>
<obj>9</obj>
<type>box</type>
<side>2</side>
<coord>1</coord>
<u>0.833333</u>
<v>1</v>
<bury>0</bury>
</TO>
</ATTACHMENT>
<ATTACHMENT>
<ATTACH>
<type>linear</type>
<direction>5</direction>
<name>JetPwrL</name>
<reverse>1</reverse>
<angle>0</angle>
</ATTACH>
<FROM>
<obj>4</obj>
<type>disk</type>
<side>1</side>
<coord>1</coord>
<u>0.0175439</u>
<v>-0.421053</v>
<bury>0</bury>
<cover>1</cover>
</FROM>
<TO>
<obj>9</obj>
<type>box</type>
<side>2</side>
<coord>1</coord>
<u>0.166667</u>
<v>1</v>
<bury>0</bury>
</TO>
</ATTACHMENT>
<ATTACHMENT>
<ATTACH>
<type>linear</type>
<direction>5</direction>
<name>JetPwrBR</name>
<reverse>1</reverse>
<angle>0</angle>
</ATTACH>
<FROM>
<obj>6</obj>
<type>disk</type>
<side>1</side>
<coord>0</coord>
<angle>-180</angle>
<bury>0</bury>
<cover>1</cover>
</FROM>
<TO>
<obj>9</obj>
<type>box</type>
<side>2</side>
<coord>1</coord>
<u>1</u>
<v>0.875</v>
<bury>0</bury>
</TO>
</ATTACHMENT>
<ATTACHMENT>
<ATTACH>
<type>linear</type>
<direction>5</direction>
<name>JetPwrBL</name>
<reverse>1</reverse>
<angle>0</angle>
</ATTACH>
<FROM>
<obj>5</obj>
<type>disk</type>
<side>1</side>
<coord>0</coord>
<angle>0</angle>
<bury>0</bury>
<cover>1</cover>
</FROM>
<TO>
<obj>9</obj>
<type>box</type>
<side>2</side>
<coord>1</coord>
<u>0</u>
<v>0.875</v>
<bury>0</bury>
</TO>
</ATTACHMENT>
<ATTACHMENT>
<ATTACH>
<type>linear</type>
<direction>5</direction>
<name>JetPwrFR</name>
<reverse>1</reverse>
<angle>0</angle>
</ATTACH>
<FROM>
<obj>7</obj>
<type>disk</type>
<side>1</side>
<coord>0</coord>
<angle>-180</angle>
<bury>0</bury>
<cover>1</cover>
</FROM>
<TO>
<obj>9</obj>
<type>box</type>
<side>2</side>
<coord>1</coord>
<u>1</u>
<v>0.125</v>
<bury>0</bury>
</TO>
</ATTACHMENT>
<ATTACHMENT>
<ATTACH>
<type>linear</type>
<direction>5</direction>
<name>JetPwrFL</name>
<reverse>1</reverse>
<angle>0</angle>
</ATTACH>
<FROM>
<obj>8</obj>
<type>disk</type>
<side>1</side>
<coord>0</coord>
<angle>0</angle>
<bury>0</bury>
<cover>1</cover>
</FROM>
<TO>
<obj>9</obj>
<type>box</type>
<side>2</side>
<coord>1</coord>
<u>0</u>
<v>0.125</v>
<bury>0</bury>
</TO>
</ATTACHMENT>
</LB>
<!--##LB_LUA_BLOCK
function OnInit()
lb.print(lb.gettime(),"Init")
end
function OnReset()
lb.print(lb.gettime(),"Reset")
end
function getht(obj)
return math.min(lb.objects[obj].getposy(),lb.rangefinder(lb.objects[obj].getposition(),-lb.objects[obj].getvecy()))
end
function hover()
inpfwd = lb.getkey(0)-lb.getkey(1)
inpturn = lb.getkey(2)-lb.getkey(3)
fwdf = inpfwd
yawt = inpturn*0.5-lb.objects.Body.getangvely()*0.2
Rudder = -inpturn*5
JetPwrL = (fwdf-yawt)*100
JetPwrR = (fwdf+yawt)*100
k0 = 1
k1 = 0.3
k2 = 2
hfl = getht("JetFL")
vfl = hfl-(hfl0 or hfl)
JetPwrFL = limit(100*(k1*(k0-hfl)-k2*vfl),-30,30)
hfl0 = hfl
hfr = getht("JetFR")
vfr = hfr-(hfr0 or hfr)
JetPwrFR = limit(100*(k1*(k0-hfr)-k2*vfr),-30,30)
hfr0 = hfr
hbl = getht("JetBL")
vbl = hbl-(hbl0 or hbl)
JetPwrBL = limit(100*(k1*(k0-hbl)-k2*vbl),-30,30)
hbl0 = hbl
hbr =getht("JetBR")
vbr = hbr-(hbr0 or hbr)
JetPwrBR = limit(100*(k1*(k0-hbr)-k2*vbr),-30,30)
hbr0 = hbr
end
function OnFrame()
loadctrls()
hover()
lb.drawtext(30,30,"Hovercraft by Bernard (bwansy)")
lb.drawtext(30,40,string.format("Speed: %6i km/h",lb.objects.Body.getvelocity().length()*3.6))
dumpctrls()
end
function switch(var,key)
if lb.getkeydown(key) > 0 then
if var < 1 then
var = 1
else
var = 0
end
end
return var
end
function limit(x,n1,n2)
if n1 > n2 then
maxx,minx = n1,n2
else
maxx,minx = n2,n1
end
if x < minx then x = minx end
if x > maxx then x = maxx end
return x
end
function loadctrls()
for k,v in pairs(lb.controls) do
_G[k] = v.getvalue()
end
end
function dumpctrls()
for k,v in pairs(lb.controls) do
v.setvalue(_G[k])
end
end
##LB_LUA_BLOCK-->
Re: Hovercraft
Awesome Bwansy, it's very smooth and quick, but a little jumpy on the throttle(disregard this, we build chips to our liking, not to fit in realistic situations, xD)
Edit;
Ummm bwansy, will Takeya put a limit on the speed? Cuz I finally fully tested your hover, and the speedometer says limit 800km/h but your object goes well past it, it's max speed before it flips out is just under 1400 km/h
Edit;
Ummm bwansy, will Takeya put a limit on the speed? Cuz I finally fully tested your hover, and the speedometer says limit 800km/h but your object goes well past it, it's max speed before it flips out is just under 1400 km/h
Re: Hovercraft
i think not. looks like a full gauge revolution = 1000 kph.
RA2lover- Walker
- Posts : 382
Join date : 2010-10-11
Age : 29
Location : Brazil
Re: Hovercraft
My gauge went to 800, off gauge, then 0-100-200-300-350. At 350, its at 1350km/h, and that time is where it lifts off
What I'm talking about is Rc has an absolute limit of 500km/h (and recently reached 507.3km/h with the Japanese Kyata mod I have) while LB has no limit.
Should we suggest a 'digital' speedometer instead of a 'dial' without a limit or edit the original to support these new speeds?
What I'm talking about is Rc has an absolute limit of 500km/h (and recently reached 507.3km/h with the Japanese Kyata mod I have) while LB has no limit.
Should we suggest a 'digital' speedometer instead of a 'dial' without a limit or edit the original to support these new speeds?
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum