|
发表于 2013-10-14 13:40:05
|
显示全部楼层
hi 下网上载
别对自己失去信心,为什么说doWatch的写法不好呢?我看却好得很。
不知道您是否留意过BIS_fnc_DirTo,WeaponDirection和atan2呢?
假设我们的目标是_Target,我们让_tank dowatch _target然后就fire。
炮塔转动的时间差如何取得?用sleep是不是不准确?
首先当_tank开始dowatch时我们先得到炮塔的方位角:
- _offset = _tank weapondirection (currentWeapon _tank);
- _dir_degrees = (_offset select 0) atan2 (_offset select 1);
复制代码
在得到了炮塔方位角后我们要知道_target距离_tank的方位角:
- _dir = [_tank, getposATL _target] call BIS_fnc_dirTo;
复制代码
在得到了相对位方位角后我们需要将炮塔方位角与相对位方位角进行匹配:
- waitUntil {
- if ((round _dir_degrees) == (round _dir)) exitWith {true};
- _offset = _tank weapondirection (currentWeapon _tank);
- _dir_degrees = (_offset select 0) atan2 (_offset select 1);
- _dir = [_tank, getposATL _target] call BIS_fnc_dirTo;
- };
复制代码
这样无论是静止瞄准还是移动中瞄准都可以判断主炮是否已瞄准了目标。
祝愉快。 |
|