Jump to content
Sign in to follow this  
M.Evans

Stop boat from swaying

Recommended Posts

Is there a way to get something like a boat to not move in the water, I am doing a Maritime operation and was wondering if there was someway to freeze the boat or it just stop swaying because if I could get it to stand still it would work really well.

Thanks

Share this post


Link to post
Share on other sites

this setPos [getPos this select 0, getPos this select 1, 0.1];

I just tried this and it still sways, I am using that yacht, the IMG_Marine one. could it be script in there causing it to not be able to be stopped?

If that is the case shouldnt it be able to cancel the script or animation?

Share this post


Link to post
Share on other sites

You could create a helper object then attach the boat to it. As for canceling the animation there is a enablesimulation command however all units local to the the veh will also be disabled upon boarding. The following is an example should do what you looking for.

_pos = getPosASL _veh;
if (!isMultiplayer) then {
while{isNull driver _veh} do {
	_veh setVelocity [0,0,0];
	if (_veh distance _pos > 10) then {_veh setPosASL _pos}; 
	sleep 0.01;
};
}else{ 	
_pos = getPosASL _veh;
//Attach Boat to Anchor in SP, Incase it moves while AI are moving to it.
//NOTE: Allow in MP: If player bumps the boat it will take off and not stop.
//Ataching boat in MP causes the Boat to reset to [0,0,0] if player is not local and said player boards as driver. Maybe try golbal attach to.????????????????????
if (surfaceIsWater (position _veh)) then {
	_anchor = "Sign_sphere10cm_EP1" createVehicle [0,0,0];
	WaitUntil {!isNull _anchor};
	_anchor setDir (direction _veh);
	_anchor setPosASL [_pos select 0,_pos select 1,1.25];
	_veh attachTo [_anchor,[0,0,0]];
	[-1,{_this hideObject true},_anchor] call CBA_fnc_globalExecute;//Hideobj executes globally
	WaitUntil {!isNull (driver _veh)}; 
	detach _veh;

	sleep 3;
	deleteVehicle _anchor;
};
};

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  

×