Jump to content
Sign in to follow this  
kingofnuthin1980

AI Helicopter spins in circles after waypoint created [SOLVED]

Recommended Posts

Hey guys... can someone please tell me, why the helicopter goes into a sharp turn and mostly stays in it? Also doMove does not help. What am I missing here?

 

Thanks in advance for your help!

[] spawn {

	//--- get insertion position
	private ["_mapSize", "_mapCenter", "_insertPos"];
	_mapSize = (getnumber (configfile >> "cfgworlds" >> worldname >> "mapSize") / 2);
	_mapCenter = [worldSize / 2, worldsize / 2, 0];
	_insertPos = [_mapCenter, _mapSize, random 360] call BIS_fnc_relPos;
	_insertPos set [2, 1000];

	//--- create vehicle
	private ["_veh"];
	_veh = createVehicle ["B_Heli_Transport_03_F", _insertPos, [], 0, "FLY"];
	_veh setPos _insertPos;
	_veh setDir (_insertPos getDir _mapCenter);

	//--- create v ehicle crew;
	private ["_vehGrp"];
	createVehicleCrew _veh;
	_vehGrp = group effectiveCommander _veh;

	//--- flight parameters
	_veh flyInHeightASL [1000, 1000, 1000];
	_veh setVelocityModelSpace [0, 55, 0];

	//--- delete waypoints
	for "_i" from 0 to ((count (waypoints _vehGrp)) - 1) do {
		deleteWaypoint [_vehGrp, _i];
	};

	//--- waypoint positions
	private ["_wpPos1", "_wpPos2"];
	_wpPos1 = _mapCenter;
	_wpPos2 = [_mapCenter, (1 * _mapSize), (position _veh) getDir _mapCenter] call BIS_fnc_relPos;

	//--- add waypoints
	private ["_wp1", "_wp2", "_wp3"];
	_wp1 = _vehGrp addWaypoint [_wpPos1, 0];
	_wp2 = _vehGrp addWaypoint [_wpPos2, 0];

	//--- Set waypoint properties
	{
		_x setWaypointType "MOVE";
		_x setWaypointBehaviour "SAFE";
		_x setWaypointCombatMode "WHITE";
		_x setWaypointSpeed "NORMAL";
	} forEach [_wp1, _wp2];
};

SOLUTION:

Flight heights above 400 meters seem to be problematic for helicopters. 

_insertPos set [2, 400];

and

_veh flyInHeightASL [400, 400, 400];

solved the problem and the helicopter is flying straight to the waypoints 🙂

Share this post


Link to post
Share on other sites

It seems the flight height is the problem on helicopters. I did several tests now and it seems to get problematic at a height of 750 meters. Between 750 and 400 meters the helicopter was wobbling left and right a lot, though. Everything below 400 meters seem to work without a problem and the helicopter is flying straight to the waypoints.

  • Like 1

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×