Jump to content
Sign in to follow this  
barbolani

Heli TRULY stop when I want

Recommended Posts

Hi!

Anybody of this gentlemen knows a way of stopping a heli in an accurate way, wherever you want?

I'm working on a dynamic AI controlled fastrope script, everything ok, except the heli stops (speed heli < 1) two or three hundereds of meters away.

I tried forcespeed, dostop, disableAI "MOVE" on the pilot when reaches a distance < 150 mts from the landing pos, and nothing. The AI has everything disableAI. The waypoint is CARELESS and LIMITED.

It does not respect my flyinheight too....

The main thing with this is the landpos is fine calculated not to be on the sea, but as the heli is doing weird things, sometimes it drops the units in water....

EDIT: It is not a matter of accurate stopping, cause the heli when it's close starts to deccelerate, but, after two seconds, accelerates again...

Share this post


Link to post
Share on other sites

instant stop you want

this setVelocity [0,0,0];

Share this post


Link to post
Share on other sites

uffffff

setvelocity would make it magically stop, even at low speed will be noticeable.... It is a possible workaround, but requires a ton of maths, isn't it? I mean, check the velocity, check if each element is more or less than zero, gradually change each element from original status to zero.... And the heli won't change it's "stance"....

EDIT:

or not?

Have you ever tried something like this?

_vel = velocity _vehicle;

_dir = direction _vehicle;

_speed = speed _vehicle;

while {_speed > 1} do

{

_vehicle setVelocity [

(_vel select 0) + (sin _dir * _speed - 1),

(_vel select 1) + (cos _dir * _speed - 1),

(_vel select 2)

];

sleep 0.5;

_dir = direction _vehicle;

_speed = speed _vehicle;

};

Edited by barbolani

Share this post


Link to post
Share on other sites

You can lerp/interpolate vectors, for example:

// Some parameters
private ["_object", "_slowdownTime"];
_object 		= [_this, 0, objNull, [objNull]] call BIS_fnc_param;
_slowdownTime 	= [_this, 1, 10, [0]] call BIS_fnc_param;

// Store initial time
private "_initialTime";
_initialTime = time;

while { time - _initialTime <= _slowdownTime } do {
	// The current and target vectors
	private ["_vectorCurrent", "_vectorTarget"];
	_vectorCurrent = velocity _object;
	_vectorTarget = [0,0,0];

	private ["_x", "_y", "_z"];
	_x = linearConversion [_initialTime, _initialTime + _slowdownTime, time, _vectorCurrent select 0, _vectorTarget select 0];
	_y = linearConversion [_initialTime, _initialTime + _slowdownTime, time, _vectorCurrent select 1, _vectorTarget select 1];
	_z = linearConversion [_initialTime, _initialTime + _slowdownTime, time, _vectorCurrent select 2, _vectorTarget select 2];

	// Lerp
	_object setVelocity [_x, _y, _z];

	// Delay
	sleep 0.01;
};

Not tested. :P

Share this post


Link to post
Share on other sites

Damm, this is solved....

You know what? I HATE SETWAYPOINTBEHAVIOUR.... After some debugging I found that command, dont know why, is not working... A fine setBehaviour made the trick...

f**k.

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  

×