tick and update
function tick(v,t) {
if(oldTick == 0) {
oldTick = v;
}
while (oldTick < v) {
update();
oldTick = oldTick + 0.05;
}
}
function update() {
// Y-as wordt eigenlijkniet gebruikt, beweging
// i beperkt tot x/z vlak,
// maar voor de volledigheid wordt het wel
// allemaal netjes berekend...
// Spatiebalk = gas geven
if(space) {
speed[0] = speed[0] + direction[0]*0.01;
speed[1] = speed[1] + direction[1]*0.01;
speed[2] = speed[2] + direction[2]*0.01;
flame_choice = 0;
hide_text = -1;
} else {
flame_choice = -1;
}
// Pijltjes toetsen = draaien
if(upk) {
}
if(down) {
}
if(left) {
direction = (new SFRotation(0,1,0, 0.1)).multVec(direction);
}
if(right) {
direction = (new SFRotation(0,1,0,-0.1)).multVec(direction);
}
// verplaats object
position = position.add(speed);
position_changed = position;
// output de juiste updates
rotA = new SFRotation(defDirection,direction);
up = rotA.multVec(yAxis);
rotB = new SFRotation(direction.cross(up),
direction.cross(yAxis));
orientation = rotA.multiply(rotB);
orientation_changed = orientation;
}
"
}