Falsche9 11 Posted November 19, 2014 (edited) How do I change the yaw on a moving vehicle? I try setDir and setVectorDir commands and it stops the vehicle or overwrites the vehicle velocity to [0,0,0]; these 2 examples turn the boat at the required rate and angle but speed is cancelled to 0. boat01 addAction ["<t color='#FFFF00'>Rudder Port 10</t>","rudderLeft.sqf", 10, 0.4, false, true]; _boat = _this select 0; _caller = _this select 1; _amount = _this select 3; _counter = 0; _amount = _amount *10; while {_counter < _amount} do { _counter = _counter + 1; _boatDir = getDir _boat; _boat setDir (_boatDir - 0.1); sleep 0.01; }; this also: boat01 addAction ["<t color='#FFFF00'>Rudder Port 10</t>","rudderLeft.sqf", 10, 0.4, false, true]; _boat = _this select 0; _caller = _this select 1; _amount = _this select 3; _counter = 0; _amount = _amount *10; _vel = velocity _boat; _v1 = 0; _v2 = 0; while {_counter < _amount} do { _dir = round(getDir _boat); If ((_dir >= 0) && (_dir <= 90)) then {_v1 = -0.015; _v2 = 0.0015;}; If (_dir >= 90 && _dir <= 180) then {_v1 = 0.0015; _v2 = 0.0015;}; If (_dir >= 180 && _dir <= 270) then {_v1 = 0.0015; _v2 = -0.0015;}; If (_dir >= 270 && _dir <= 360) then {_v1 = -0.0015; _v2 = -0.0015;}; _counter = _counter + 1; _vecDir = vectorDir boat01; _boat setVectorDir [(_vecDir select 0) + _v1,(_vecDir select 1) + _v2,_vecDir select 2]; _boat setVelocity _vel;//I put this here to keep velocity but no effect sleep 0.001; }; Edited November 19, 2014 by Falsche9 Share this post Link to post Share on other sites
Heeeere's johnny! 51 Posted November 19, 2014 (edited) If it overwrites the velocity then get the velocity of the boat prior to changing its direction, set the new direction and set the saved velocity again: [color=#FF8040][color=#191970][b]while[/b][/color] [color=#8B3E2F][b]{[/b][/color][color=#1874CD]_counter[/color] [color=#8B3E2F][b]<[/b][/color] [color=#1874CD]_amount[/color][color=#8B3E2F][b]}[/b][/color] [color=#191970][b]do[/b][/color] [color=#8B3E2F][b]{[/b][/color] [color=#1874CD]_velocity[/color] [color=#8B3E2F][b]=[/b][/color] [color=#191970][b]velocity[/b][/color] [color=#1874CD]_boat[/color][color=#8B3E2F][b];[/b][/color] [color=#1874CD]_counter[/color] [color=#8B3E2F][b]=[/b][/color] [color=#1874CD]_counter[/color] [color=#8B3E2F][b]+[/b][/color] [color=#FF0000]1[/color][color=#8B3E2F][b];[/b][/color] [color=#1874CD]_boatDir[/color] [color=#8B3E2F][b]=[/b][/color] [color=#191970][b]getDir[/b][/color] [color=#1874CD]_boat[/color][color=#8B3E2F][b];[/b][/color] [color=#1874CD]_boat[/color] [color=#191970][b]setDir[/b][/color] [color=#8B3E2F][b]([/b][/color][color=#1874CD]_boatDir[/color] [color=#8B3E2F][b]-[/b][/color] [color=#FF0000]0.1[/color][color=#8B3E2F][b])[/b][/color][color=#8B3E2F][b];[/b][/color] [color=#1874CD]_boat[/color] [color=#191970][b]setVelocity[/b][/color] [color=#1874CD]_velocity[/color][color=#8B3E2F][b];[/b][/color][color=#191970][b] sleep[/b][/color] [color=#FF0000]0.01[/color][color=#8B3E2F][b];[/b][/color] [color=#8B3E2F][b]}[/b][/color][color=#8B3E2F][b];[/b][/color][/color] Kudos to Killzone_Kid for his SQF to BBCode Converter. I haven't tested it, but I hope it works and helps. Regards, Johnny Edited November 19, 2014 by Heeeere's Johnny! Share this post Link to post Share on other sites
Falsche9 11 Posted November 19, 2014 Thanks for reply but it doesn't work - boat has 0 velocity until loop is finished. How do BIS steer vehicles? Is there a script somewhere for WASD keys? I will try with setVelocityTransformation also. Share this post Link to post Share on other sites
Heeeere's johnny! 51 Posted November 19, 2014 Thanks for reply but it doesn't work - boat has 0 velocity until loop is finished. I'm guessing the boat has a velocity before doing the turn. Did you attempt to use "_velocity = velocity _boat;" at the very beginning of your script before doing anything else? How do BIS steer vehicles? I was asking this myself and asked a BI developer. The response was "That's classified". So we as scripters won't get to know how the commands work in detail. Is there a script somewhere for WASD keys? I don't know, but if you want the boat to follow a specific path, use BIS_fnc_UnitCapture and BIS_fnc_UnitPlay. Share this post Link to post Share on other sites
neokika 62 Posted November 19, 2014 I was asking this myself and asked a BI developer. The response was "That's classified". So we as scripters won't get to know how the commands work in detail. Well, there's nothing classified, I can assure you. ;) Currently, there is no proper support for such through scripting. Share this post Link to post Share on other sites
Heeeere's johnny! 51 Posted November 19, 2014 (edited) Well, there's nothing classified, I can assure you. ;)Currently, there is no proper support for such through scripting. Well, I was asking Accolyte (DayZ Team) the other day if there is an SQF documentation, because I wanted to know how publicVariable works as I was interested why (according to this FT ticket) arrays take 6 times more band width than other simple data types. The response was: "[...] unfortunately the BIwiki contains as much information as possible, the rest is sadly confidential and I am unable to share anything else." Granted, he is not a developer (still a manager) and he said "confidential" instead of "classified", but "confidential" isKindOf "classified", right? ;) Either way, is there a way to get informations about how certain commands work in detail? Regards, Johnny Edited November 19, 2014 by Heeeere's Johnny! Polishing, finally done Share this post Link to post Share on other sites
Falsche9 11 Posted November 19, 2014 I'm guessing the boat has a velocity before doing the turn. Did you attempt to use "_velocity = velocity _boat;" at the very beginning of your script before doing anything else?I was asking this myself and asked a BI developer. The response was "That's classified". So we as scripters won't get to know how the commands work in detail. I don't know' date=' but if you want the boat to follow a specific path, use [i']BIS_fnc_UnitCapture[/i] and BIS_fnc_UnitPlay. Thanks again - that also doesn't work. BIS_fnc_UnitCapture is not suitable as I was trying to script a sailing dinghy with the "C_Boat_Civil_01_F" and steer it from cargo positions 1&2 so the helm switches sides as in reality. So far I have a moving sail and the mathematics done for velocity relative to wind/sail angle. I thought the steering would be the easy part! It's not so bad, I will just have to use the driver position instead. Share this post Link to post Share on other sites
Tajin 349 Posted November 19, 2014 Did a quick test from the debugConsole and for me, that works for just fine: change = 1; boat spawn { while {alive _this} do { _vel = velocity _this; _vdir = vectorDir _this; _vel1 = [[_vel select 0,_vel select 1],change] call BIS_fnc_rotateVector2D; _vdir1 = [[_vdir select 0,_vdir select 1],change] call BIS_fnc_rotateVector2D; _this setVectorDir [_vdir1 select 0, _vdir1 select 1, _vdir select 2]; _this setVelocity [_vel1 select 0, _vel1 select 1, _vel select 2]; sleep 0.1; }; }; Share this post Link to post Share on other sites
Falsche9 11 Posted November 19, 2014 Thanks Tajin - that works! Share this post Link to post Share on other sites