Motorbike
2 posters
RigidChips :: Rigid-Chips :: Files :: Cars
Page 1 of 1
Motorbike
After a loooong break I decided to make something in RC again. This time it's a motorbike. No jets, no gyros, just plain simple two-wheeled bike that stays stable at up to 504km/h. It takes a bit practice to get used to the controls, but it's fun once you have. Helmet not included.
- Code:
// [RCD]
Val
{
BRAKE(default=0, max=100, disp=0)
STAND(default=180, min=-400, max=400, disp=0)
STEER(default=0, min=-400, max=400, disp=0)
WHLPWR(default=0, min=-999999999, max=99999999, disp=0)
}
Key
{
}
Body
{
Core(name=BODY) {
N:Frame(angle=170) {
S:TrimF(angle=90) {
E:TrimF(angle=STEER, option=1) {
W:Wheel(angle=180, brake=BRAKE, option=1, effect=2) { }
}
}
}
S:Frame() {
S:Chip() {}
S:Trim(angle=90) {
W:Wheel(power=-WHLPWR, brake=BRAKE, option=1, effect=2) { }
}
E:Frame(angle=110) {
E:Frame(angle=STAND) { }
}
W:Frame(angle=110) {
W:Frame(angle=STAND) { }
}
}
}
}
Lua
{require("Bernard/Basic.lua")
function init()
standflag = 1
tilttgt = 0
end
function OnInit()
init()
end
function OnReset()
init()
end
function OnFrame()
mx,my = inputmouse(0)
v = abs(_VZ(BODY))
wz = _WZ(BODY)
vcorr = limit(1/(0.0001+v^1.5),0,1000)
tilttgt = animate(tilttgt,limit(atand(mx*2),-50,50),2.5)
tilt = asind(_XY(BODY))+tilttgt
STEER = animate(STEER,limit((tilt*20+wz*70)*vcorr,-45,45),10)
WHLPWR = animate(WHLPWR,_ML()*7000,500)
BRAKE = animate(BRAKE,_MR()*50,5)
if v > 5 then
standflag = 0
end
if v < 4 then
standflag = 1
end
STAND = animate(STAND,180+100*standflag,10)
out(0,"Bike prototype by Bernard (bwansy)")
out(1,"Mouse left button: accelerate, right button: brake")
out(2,"Mouse for steering")
end}
Re: Motorbike
Note that it does require Bwansy's Lua Library. Which is going to stop me until I can figure out how to tell RC what path to look in.
MrSparks- Tank
- Posts : 73
Join date : 2012-01-05
Age : 34
Location : Michigan
RigidChips :: Rigid-Chips :: Files :: Cars
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum