dc-metro-train.ac
translate
/ai/models/kcgs-metrorail/move
1.0
0
1
0
var time_node = props.globals.getNode("/sim/time/elapsed-sec");
var move_node = props.globals.getNode("/ai/models/kcgs-metrorail/move");
var loopid = 1;
var loop = func(id) {
if (id != loopid) return;
var movecyclesec = 120.0;
var movedistance = 650.0;
var movetimer = time_node.getValue()/movecyclesec - int(time_node.getValue()/movecyclesec);
var movewave = math.sin(2*math.pi*movetimer);
move_node.setValue(movewave*movedistance);
settimer(func { loop(id); }, 0);
}
settimer(func { loop(loopid); }, 0);
loopid += 1;