copy from flyvr
update script for flymad