killshot 5 Posted January 3, 2015 Hello everybody! How am I able to let the camera do a 360° rotation around a fixed point? I fixed a position (F key) and want the camera to circle around it without losing focus, just like it does, when you are in the cam view, pressing F and then A or D to rotate around the position. I'm trying for hours now, without getting it done right. When I only use two camera positions, the cam takes the shortest way from a to b - "cutting" the wanted circle, when I use more positions, I'm still unable to flowly move in a circle. _camera camPrepareTarget [[color="#008000"]14327.86,13054.25,-0.00[/color]]; _camera camPreparePos [14355.92,13060.78,0.84]; _camera camPrepareFOV 0.700; _camera camCommitPrepared 0; Green is the fixed point I want my camera to circle around. Thank you and regards. Share this post Link to post Share on other sites
luki 53 Posted January 3, 2015 _camera camPrepareTarget [[color="#008000"]14327.86,13054.25,-0.00[/color]]; Why dont you just use a invisible target like an empty heli h, give it a name and use it this way.. back in ofp that worked _camera camPrepareTarget [color="#008000"]nameofobject[/color]; https://community.bistudio.com/wiki/camPrepareTarget Share this post Link to post Share on other sites
Greenfist 1863 Posted January 3, 2015 (edited) This might work: Camrunning = true; // set to false to stop the camera _radius = 50; // circle radius _angle = 180; // starting angle _altitude = 10; // camera altitude _dir = 0; //Direction of camera movement 0: anti-clockwise, 1: clockwise _speed = 0.02; //lower is faster _coords = [cameratarget, _radius, _angle] call BIS_fnc_relPos; _coords set [2, _altitude]; _camera = "camera" camCreate _coords; _camera cameraEffect ["INTERNAL","BACK"]; _camera camPrepareFOV 0.700; _camera camPrepareTarget cameratarget; _camera camCommitPrepared 0; while {Camrunning} do { _coords = [cameratarget, _radius, _angle] call BIS_fnc_relPos; _coords set [2, _altitude]; _camera camPreparePos _coords; _camera camCommitPrepared _speed; waitUntil {camCommitted _camera || !(Camrunning)}; _camera camPreparePos _coords; _camera camCommitPrepared 0; _angle = if (_dir == 0) then {_angle - 1} else {_angle + 1}; }; cameratarget is the circled object or position. (this was ripped and simplified from the BI's fake UAV function.) Edited January 3, 2015 by Greenfist 2 Share this post Link to post Share on other sites
Jigsor 175 Posted January 3, 2015 (edited) I haven't tried Greefist's solution maybe it works and has smoother transition, dunno. Anyway here's another method I came up with. The cam only positions and commits once. No further waituntils, calls or evaluations as it rotates. Pass it a position array, object or marker string. // circling_cam.sqf// Passed paramters could be position array, object, or marker// [[8247.5,2152.31,0.00143433]] execVM "circling_cam.sqf";// [player] execVM "circling_cam.sqf";// ["Respawn_West"] execVM "circling_cam.sqf";_pos = [_this, 0, objNull, [[], "", objNull], [3]] call BIS_fnc_param;switch (typeName _pos) do{case "ARRAY": {_pos = [_pos select 0, _pos select 1, _pos select 2];};case "OBJECT": {_pos = [getPosATL _pos select 0, getPosATL _pos select 1, getPosATL _pos select 2];};case "STRING": {_pos = [getMarkerPos _pos select 0, getMarkerPos _pos select 1, getMarkerPos _pos select 2];};};_dir = random 359;_maxRotation = (_dir + 360);// changing 360 to 45 will make camera travel only 45 degrees_camHeight = 15;_camDis = -30;_interval = 0.5;// change to 1 for faster camera travel_delay = 0.01;_logic_pos = [(_pos select 0), (_pos select 1), (_pos select 2) + 3];_logic = createVehicle ["Land_ClutterCutter_small_F", _logic_pos, [], 0, "CAN_COLLIDE"];_logic setDir _dir;_camPos = [_pos select 0, _pos select 1, (_pos select 2) + _camHeight];_cam = "camera" camCreate _camPos;_cam camSetPos _camPos;_cam camSetTarget _logic;_cam camCommit 0;waitUntil {camcommitted _cam};_cam attachto [_logic, [0,_camDis,_camHeight] ];_cam cameraEffect ["internal", "BACK"];while {_dir < _maxRotation} do{_dir = _dir + _interval;_logic setDir _dir;sleep _delay;};camDestroy _cam;deleteVehicle _logic;player cameraEffect ["terminate", "BACK"]; Edited January 4, 2015 by Jigsor 1 Share this post Link to post Share on other sites
killshot 5 Posted January 4, 2015 Thank you very much for your answers. I tried both of your scripts and both of them do work very well, they let the camera smoothly rotate in a perfect circle around the cameraTarget, very useful! If I want the smooth camera rotation of these scripts, just not for a 360°, but for example only a 90° rotation, is this still the best/easiest way to get it accomplished? And if so, is the green line I added in the script below the best way to do so? Camrunning = true; // set to false to stop the camera _radius = 10; // circle radius (distance to cameratarget) _angle = 270; // starting angle (compass direction) _altitude = 5; // camera altitude (height above ground) _dir = 1; //Direction of camera movement 0: anti-clockwise, 1: clockwise _speed = 0.02; //lower is faster _coords = [cameratarget, _radius, _angle] call BIS_fnc_relPos; _coords set [2, _altitude]; _camera camPrepareFOV 0.700; _camera camPrepareTarget cameratarget; _camera camCommitPrepared 0; while {Camrunning} do { _coords = [cameratarget, _radius, _angle] call BIS_fnc_relPos; _coords set [2, _altitude]; _camera camPreparePos _coords; _camera camCommitPrepared _speed; waitUntil {camCommitted _camera || !(Camrunning)}; _camera camPreparePos _coords; _camera camCommitPrepared 0; _angle = if (_dir == 0) then {_angle - 1} else {_angle + 1}; [color="#008000"]if (_angle == 450) then {camrunning = false;};[/color] }; Regards :) Share this post Link to post Share on other sites
Jigsor 175 Posted January 4, 2015 You can change _maxRotation = (_dir + 360); to _maxRotation = (_dir + 90); For quarter circle camera travel. Share this post Link to post Share on other sites
inlesco 233 Posted January 4, 2015 Another solution: play around with BIS'-made default camera transitions (for Triggers under 'Effects' category), dePBO code in /addons/ (most likely) dir and use for your purpose. Share this post Link to post Share on other sites
Nexus Payne 1 Posted March 14, 2016 cool script thank you very much! Share this post Link to post Share on other sites